Mirror von
https://github.com/ViaVersion/ViaVersion.git
synchronisiert 2024-11-03 14:50:30 +01:00
fix chunk unload packet
Dieser Commit ist enthalten in:
Ursprung
cf0bd6f021
Commit
34c701e039
@ -121,16 +121,20 @@ public class WorldPackets {
|
|||||||
@Override
|
@Override
|
||||||
public void handle(PacketWrapper wrapper) throws Exception {
|
public void handle(PacketWrapper wrapper) throws Exception {
|
||||||
ClientChunks clientChunks = wrapper.user().get(ClientChunks.class);
|
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()) {
|
if (chunk.isUnloadPacket()) {
|
||||||
wrapper.setId(0x1D);
|
wrapper.setId(0x1D);
|
||||||
|
|
||||||
|
wrapper.write(Type.INT, chunk.getX());
|
||||||
|
wrapper.write(Type.INT, chunk.getZ());
|
||||||
// Remove commandBlocks on chunk unload
|
// Remove commandBlocks on chunk unload
|
||||||
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
CommandBlockProvider provider = Via.getManager().getProviders().get(CommandBlockProvider.class);
|
||||||
provider.unloadChunk(wrapper.user(), chunk.getX(), chunk.getZ());
|
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);
|
wrapper.read(Type.REMAINING_BYTES);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren