From 99a4a78dcb5d721a2eb8c566bcc4a40f1c0daced Mon Sep 17 00:00:00 2001 From: alemi Date: Fri, 2 Jun 2023 14:51:01 +0200 Subject: [PATCH] fix: wrong field --- src/treepuncher/game/world.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/treepuncher/game/world.py b/src/treepuncher/game/world.py index 02a338b..6e07ed0 100644 --- a/src/treepuncher/game/world.py +++ b/src/treepuncher/game/world.py @@ -21,7 +21,7 @@ class GameWorld(Scaffold): if not self.cfg.getboolean("process_world", fallback=True): return - if self.proto == 340: # Chunk parsing is only implemented for 1.12 + if self.dispatcher.proto == 340: # Chunk parsing is only implemented for 1.12 @self.on_packet(PacketMapChunk) async def map_chunk_cb(packet:PacketMapChunk): assert isinstance(packet.bitMap, int) @@ -37,7 +37,7 @@ class GameWorld(Scaffold): @self.on_packet(PacketMultiBlockChange) async def multi_block_change_cb(packet:PacketMultiBlockChange): - if self.proto < 751: + if self.dispatcher.proto < 751: chunk_x_off = packet.chunkX * 16 chunk_z_off = packet.chunkZ * 16 for entry in packet.records: @@ -46,7 +46,7 @@ class GameWorld(Scaffold): pos = BlockPos(x_off + chunk_x_off, entry['y'], z_off + chunk_z_off) self.world.put_block(pos.x,pos.y, pos.z, entry['blockId']) await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, entry['blockId'])) - elif self.proto < 760: + elif self.dispatcher.proto < 760: x = twos_comp((packet.chunkCoordinates >> 42) & 0x3FFFFF, 22) z = twos_comp((packet.chunkCoordinates >> 20) & 0x3FFFFF, 22) y = twos_comp((packet.chunkCoordinates ) & 0xFFFFF , 20) @@ -59,4 +59,4 @@ class GameWorld(Scaffold): self.world.put_block(pos.x, pos.y, pos.z, state) await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, state)) else: - self.logger.error("Cannot process MultiBlockChange for protocol %d", self.proto) + self.logger.error("Cannot process MultiBlockChange for protocol %d", self.dispatcher.proto)