Begin 1.16.2 chunk conversion

This commit is contained in:
Tanner Collin 2020-09-05 21:24:57 -06:00
parent 55ea50a6de
commit 71918953c2
2 changed files with 6 additions and 2 deletions

View File

@ -11,12 +11,13 @@ from ....types import nbt
class ChunkDataPacket(Packet): class ChunkDataPacket(Packet):
@staticmethod @staticmethod
def get_id(context): def get_id(context):
return 0x22 # FIXME return 0x20 # FIXME
packet_name = 'chunk data' packet_name = 'chunk data'
fields = 'x', 'bit_mask_y', 'z', 'full_chunk' fields = 'x', 'bit_mask_y', 'z', 'full_chunk'
def read(self, file_object): def read(self, file_object):
print('reading chunk')
self.x = Integer.read(file_object) self.x = Integer.read(file_object)
self.z = Integer.read(file_object) self.z = Integer.read(file_object)
self.full_chunk = Boolean.read(file_object) self.full_chunk = Boolean.read(file_object)
@ -24,7 +25,8 @@ class ChunkDataPacket(Packet):
self.heightmaps = Nbt.read(file_object) self.heightmaps = Nbt.read(file_object)
self.biomes = [] self.biomes = []
if self.full_chunk: 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)) self.biomes.append(Integer.read(file_object))
size = VarInt.read(file_object) size = VarInt.read(file_object)
self.data = file_object.read(size) self.data = file_object.read(size)

View File

@ -127,6 +127,8 @@ def main():
packet = serverbound.play.ClientStatusPacket() packet = serverbound.play.ClientStatusPacket()
packet.action_id = serverbound.play.ClientStatusPacket.RESPAWN packet.action_id = serverbound.play.ClientStatusPacket.RESPAWN
connection.write_packet(packet) connection.write_packet(packet)
elif text == '!test':
print(chunks.get_block_at(91, 65, 57))
else: else:
packet = serverbound.play.ChatPacket() packet = serverbound.play.ChatPacket()
packet.message = text packet.message = text