fix: why was I awaiting run_callbacks
This commit is contained in:
parent
99a4a78dcb
commit
0b4847fb9c
1 changed files with 3 additions and 3 deletions
|
@ -33,7 +33,7 @@ class GameWorld(Scaffold):
|
||||||
async def block_change_cb(packet:PacketBlockChange):
|
async def block_change_cb(packet:PacketBlockChange):
|
||||||
self.world.put_block(packet.location[0], packet.location[1], packet.location[2], packet.type)
|
self.world.put_block(packet.location[0], packet.location[1], packet.location[2], packet.type)
|
||||||
pos = BlockPos(packet.location[0], packet.location[1], packet.location[2])
|
pos = BlockPos(packet.location[0], packet.location[1], packet.location[2])
|
||||||
await self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, packet.type))
|
self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, packet.type))
|
||||||
|
|
||||||
@self.on_packet(PacketMultiBlockChange)
|
@self.on_packet(PacketMultiBlockChange)
|
||||||
async def multi_block_change_cb(packet:PacketMultiBlockChange):
|
async def multi_block_change_cb(packet:PacketMultiBlockChange):
|
||||||
|
@ -45,7 +45,7 @@ class GameWorld(Scaffold):
|
||||||
z_off = entry['horizontalPos'] & 15
|
z_off = entry['horizontalPos'] & 15
|
||||||
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']))
|
self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, entry['blockId']))
|
||||||
elif self.dispatcher.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)
|
||||||
|
@ -57,6 +57,6 @@ class GameWorld(Scaffold):
|
||||||
dy = ((loc & 0x0FFF) ) & 0x0F
|
dy = ((loc & 0x0FFF) ) & 0x0F
|
||||||
pos = BlockPos(16*x + dx, 16*y + dy, 16*z + dz)
|
pos = BlockPos(16*x + dx, 16*y + dy, 16*z + dz)
|
||||||
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))
|
self.run_callbacks(BlockUpdateEvent, BlockUpdateEvent(pos, state))
|
||||||
else:
|
else:
|
||||||
self.logger.error("Cannot process MultiBlockChange for protocol %d", self.dispatcher.proto)
|
self.logger.error("Cannot process MultiBlockChange for protocol %d", self.dispatcher.proto)
|
||||||
|
|
Loading…
Reference in a new issue