aadnk / ProtocolLib

Provides read and write access to the Minecraft protocol with Bukkit.
GNU General Public License v2.0
288 stars 92 forks source link

MultiBlockChange Packet sometimes contains wrong chunk coordinates #69

Closed Postremus closed 9 years ago

Postremus commented 10 years ago

Hi,

I'am using version 3.4 of protocollib and 1.7.2-R0.5 of packetwrapper. The following code sometimes generates the x and z coordinate with an offset of 16. This seems to be based on wrong Chunk x and z coordinates.

WrapperPlayServerMultiBlockChange packetWrapper = new WrapperPlayServerMultiBlockChange(packet);
BlockChangeArray array = packetWrapper.getRecordDataArray();
int chunkX = packetWrapper.getChunkX();
int chunkZ = packetWrapper.getChunkZ();
System.out.println("chunk: "+chunkX+"; "+chunkZ);
for (int i=0; i<array.getSize();i++) {
        BlockChange change = array.getBlockChange(i);
        int x = chunkX * 16 + change.getRelativeX();
        int y = change.getAbsoluteY();
        int z = chunkZ * 16 + change.getRelativeZ();
}
packetWrapper.setRecordData(array);

Greetings Postremus

Postremus commented 9 years ago

fixed in packetwrapper.