Skip to content

Commit a5f092b

Browse files
committed
Add world_chunk_update event, emitted for every single chunk
1 parent 3ed914e commit a5f092b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

spockbot/plugins/helpers/world.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,8 @@ def handle_new_dimension(self, name, packet):
6262
def handle_chunk_data(self, name, packet):
6363
"""Chunk Data - Update World state"""
6464
self.world.unpack_column(packet.data)
65+
location = packet.data['chunk_x'], packet.data['chunk_z']
66+
self.event.emit('world_chunk_update', {'location': location})
6567

6668
def handle_multi_block_change(self, name, packet):
6769
"""Multi Block Change - Update multiple blocks"""
@@ -96,6 +98,9 @@ def handle_block_change(self, name, packet):
9698
def handle_map_chunk_bulk(self, name, packet):
9799
"""Map Chunk Bulk - Update World state"""
98100
self.world.unpack_bulk(packet.data)
101+
for meta in packet.data['metadata']:
102+
location = meta['chunk_x'], meta['chunk_z']
103+
self.event.emit('world_chunk_update', {'location': location})
99104

100105
def handle_update_sign(self, event, packet):
101106
location = Vector3(packet.data['location'])

0 commit comments

Comments
 (0)