Fix registry packets
This commit is contained in:
parent
e2115397fe
commit
aac28a4704
@ -134,7 +134,7 @@ object AndroidResearchManager : SimpleJsonResourceReloadListener(GsonBuilder().s
|
||||
}
|
||||
|
||||
context.enqueueWork {
|
||||
minecraft.player?.matteryPlayer?.reloadResearch(MINECRAFT_SERVER.registryAccess())
|
||||
context.player().matteryPlayer.reloadResearch(context.player().registryAccess())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -101,6 +101,7 @@ import ru.dbotthepony.mc.otm.core.writeComponent
|
||||
import ru.dbotthepony.mc.otm.core.writeItemType
|
||||
import ru.dbotthepony.mc.otm.matter.MatterManager.Finder
|
||||
import ru.dbotthepony.mc.otm.milliTime
|
||||
import ru.dbotthepony.mc.otm.onceServer
|
||||
import ru.dbotthepony.mc.otm.registry.MDeferredRegister
|
||||
import ru.dbotthepony.mc.otm.registry.RegistryDelegate
|
||||
import ru.dbotthepony.mc.otm.secondTime
|
||||
@ -1771,8 +1772,16 @@ object MatterManager {
|
||||
|
||||
LOGGER.debug("Encoding matter registry packets took ${time.millis}ms, (${totalSize} bytes total, $compressedSize bytes compressed)")
|
||||
|
||||
for (chunk in chunks) {
|
||||
distributor.invoke(chunk)
|
||||
/**
|
||||
* Delay sending by one server tick;
|
||||
* this way client is guaranteed to be in "PLAY" state, with local player present.
|
||||
* This hack is required because we manually compressing and splitting packet between multiple payloads,
|
||||
* hence it is impossible to "read" parsed data from network directly, using provided RegistryFriendlyByteBuf.
|
||||
*/
|
||||
onceServer {
|
||||
for (chunk in chunks) {
|
||||
distributor.invoke(chunk)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user