fix: wrong field

This commit is contained in:
əlemi 2023-06-02 14:51:01 +02:00
parent f920bbc838
commit 99a4a78dcb

View file

@ -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)