|
|
|
@ -40,6 +40,7 @@ class ChunksManager: |
|
|
|
|
self.data = data_manager |
|
|
|
|
self.chunks = {} |
|
|
|
|
self.biomes = {} |
|
|
|
|
self.index = {} |
|
|
|
|
|
|
|
|
|
def handle_block(self, block_packet): |
|
|
|
|
self.set_block_at(block_packet.location.x, block_packet.location.y, block_packet.location.z, block_packet.block_state_id) |
|
|
|
@ -53,7 +54,22 @@ class ChunksManager: |
|
|
|
|
|
|
|
|
|
def handle_chunk(self, chunk_packet): |
|
|
|
|
for i in chunk_packet.chunks: |
|
|
|
|
self.chunks[(chunk_packet.x, i, chunk_packet.z)] = chunk_packet.chunks[i] |
|
|
|
|
chunk = chunk_packet.chunks[i] |
|
|
|
|
self.chunks[(chunk_packet.x, i, chunk_packet.z)] = chunk |
|
|
|
|
|
|
|
|
|
if chunk.sub_index: |
|
|
|
|
dx = chunk.x * 16 |
|
|
|
|
dy = chunk.y * 16 |
|
|
|
|
dz = chunk.z * 16 |
|
|
|
|
|
|
|
|
|
for item_id, locations in chunk.sub_index.items(): |
|
|
|
|
if item_id not in self.index: |
|
|
|
|
self.index[item_id] = [] |
|
|
|
|
|
|
|
|
|
for l in locations: |
|
|
|
|
coords = (dx + l%16, dy + l//256, dz + l%256//16) |
|
|
|
|
self.index[item_id].append(coords) |
|
|
|
|
|
|
|
|
|
self.biomes[(chunk_packet.x, None, chunk_packet.z)] = chunk_packet.biomes # FIXME |
|
|
|
|
|
|
|
|
|
def register(self, connection): |
|
|
|
|