mirror of
https://github.com/ViaVersion/ViaVersion.git
synced 2024-11-26 20:16:02 +01:00
fix chunk unload packet
This commit is contained in:
parent
cf0bd6f021
commit
34c701e039
@ -121,16 +121,20 @@ public class WorldPackets {
|
||||
@Override
|
||||
public void handle(PacketWrapper wrapper) throws Exception {
|
||||
ClientChunks clientChunks = wrapper.user().get(ClientChunks.class);
|
||||
Chunk1_8 chunk = (Chunk1_8) wrapper.passthrough(new Chunk1_9to1_8Type(clientChunks));
|
||||
Chunk1_9to1_8Type type = new Chunk1_9to1_8Type(clientChunks);
|
||||
Chunk1_8 chunk = (Chunk1_8) wrapper.read(type);
|
||||
if (chunk.isUnloadPacket()) {
|
||||
wrapper.setId(0x1D);
|
||||
|
||||
wrapper.write(Type.INT, chunk.getX());
|
||||
wrapper.write(Type.INT, chunk.getZ());
|
||||
// Remove commandBlocks on chunk unload
|
||||
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
||||
provider.unloadChunk(wrapper.user(), chunk.getX(), chunk.getZ());
|
||||
} else {
|
||||
wrapper.write(type, chunk);
|
||||
// eat any other data (Usually happens with unload packets)
|
||||
}
|
||||
|
||||
// eat any other data (Usually happens with unload packets)
|
||||
wrapper.read(Type.REMAINING_BYTES);
|
||||
}
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user