From 71918953c2a0a2bcf97f5572a5102d0a4550350d Mon Sep 17 00:00:00 2001 From: Tanner Collin Date: Sat, 5 Sep 2020 21:24:57 -0600 Subject: [PATCH] Begin 1.16.2 chunk conversion --- custom/networking/packets/clientbound/play/chunk_data.py | 6 ++++-- start.py | 2 ++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/custom/networking/packets/clientbound/play/chunk_data.py b/custom/networking/packets/clientbound/play/chunk_data.py index 7cf12da..1192b78 100644 --- a/custom/networking/packets/clientbound/play/chunk_data.py +++ b/custom/networking/packets/clientbound/play/chunk_data.py @@ -11,12 +11,13 @@ from ....types import nbt class ChunkDataPacket(Packet): @staticmethod def get_id(context): - return 0x22 # FIXME + return 0x20 # FIXME packet_name = 'chunk data' fields = 'x', 'bit_mask_y', 'z', 'full_chunk' def read(self, file_object): + print('reading chunk') self.x = Integer.read(file_object) self.z = Integer.read(file_object) self.full_chunk = Boolean.read(file_object) @@ -24,7 +25,8 @@ class ChunkDataPacket(Packet): self.heightmaps = Nbt.read(file_object) self.biomes = [] if self.full_chunk: - for i in range(1024): + biomes_length = VarInt.read(file_object) + for i in range(biomes_length): self.biomes.append(Integer.read(file_object)) size = VarInt.read(file_object) self.data = file_object.read(size) diff --git a/start.py b/start.py index 075880f..7c3ba54 100644 --- a/start.py +++ b/start.py @@ -127,6 +127,8 @@ def main(): packet = serverbound.play.ClientStatusPacket() packet.action_id = serverbound.play.ClientStatusPacket.RESPAWN connection.write_packet(packet) + elif text == '!test': + print(chunks.get_block_at(91, 65, 57)) else: packet = serverbound.play.ChatPacket() packet.message = text