3
0
Mirror von https://github.com/ViaVersion/ViaVersion.git synchronisiert 2024-11-08 17:20:24 +01:00

Fix chunk sending order, Fixes #338, #292 (I believe.)

Dieser Commit ist enthalten in:
Myles 2016-04-13 15:05:50 +01:00
Ursprung 1c9229a2fc
Commit 4c7b50d6fb
2 geänderte Dateien mit 8 neuen und 9 gelöschten Zeilen

Datei anzeigen

@ -115,14 +115,9 @@ 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);
Chunk chunk = wrapper.passthrough(new ChunkType(clientChunks)); wrapper.passthrough(new ChunkType(clientChunks));
if (chunk.isUnloadPacket()) { // eat any other data (Usually happens with unload packets)
PacketWrapper unload = wrapper.create(0x1D); wrapper.read(Type.REMAINING_BYTES);
unload.write(Type.INT, chunk.getX());
unload.write(Type.INT, chunk.getZ());
unload.send();
wrapper.cancel();
}
} }
}); });
} }

Datei anzeigen

@ -128,11 +128,15 @@ public class ChunkType extends PartialType<Chunk, ClientChunks> {
@Override @Override
public void write(ByteBuf output, ClientChunks param, Chunk chunk) throws Exception { public void write(ByteBuf output, ClientChunks param, Chunk chunk) throws Exception {
if (chunk.isUnloadPacket()) return; if (chunk.isUnloadPacket()) {
output.clear();
Type.VAR_INT.write(output, 0x1D); // Unload packet ID
}
// Write primary info // Write primary info
output.writeInt(chunk.getX()); output.writeInt(chunk.getX());
output.writeInt(chunk.getZ()); output.writeInt(chunk.getZ());
if (chunk.isUnloadPacket()) return;
output.writeByte(chunk.isGroundUp() ? 0x01 : 0x00); output.writeByte(chunk.isGroundUp() ? 0x01 : 0x00);
Type.VAR_INT.write(output, chunk.getPrimaryBitmask()); Type.VAR_INT.write(output, chunk.getPrimaryBitmask());