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): if not self.cfg.getboolean("process_world", fallback=True):
return 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) @self.on_packet(PacketMapChunk)
async def map_chunk_cb(packet:PacketMapChunk): async def map_chunk_cb(packet:PacketMapChunk):
assert isinstance(packet.bitMap, int) assert isinstance(packet.bitMap, int)
@ -37,7 +37,7 @@ class GameWorld(Scaffold):
@self.on_packet(PacketMultiBlockChange) @self.on_packet(PacketMultiBlockChange)
async def multi_block_change_cb(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_x_off = packet.chunkX * 16
chunk_z_off = packet.chunkZ * 16 chunk_z_off = packet.chunkZ * 16
for entry in packet.records: 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) 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']) self.world.put_block(pos.x,pos.y, pos.z, entry['blockId'])
await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, 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) x = twos_comp((packet.chunkCoordinates >> 42) & 0x3FFFFF, 22)
z = twos_comp((packet.chunkCoordinates >> 20) & 0x3FFFFF, 22) z = twos_comp((packet.chunkCoordinates >> 20) & 0x3FFFFF, 22)
y = twos_comp((packet.chunkCoordinates ) & 0xFFFFF , 20) 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) self.world.put_block(pos.x, pos.y, pos.z, state)
await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, state)) await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, state))
else: else:
self.logger.error("Cannot process MultiBlockChange for protocol %d", self.proto) self.logger.error("Cannot process MultiBlockChange for protocol %d", self.dispatcher.proto)