barneygale / quarry

Python library that implements the Minecraft network protocol and data types
Other
534 stars 74 forks source link

properly decode chunks (code) #177

Open davidawesome02 opened 2 years ago

davidawesome02 commented 2 years ago

        x,y = struct.unpack(">ll",buff.read(8))
        height_map = buff.unpack_nbt()
        size = buff.unpack_varint()
        chunk_data = buff.read(size)
        block_ents = buff.unpack_varint()
        for i in range(block_ents):
            xz_ent = buff.read(1)
            y_ent = struct.unpack(">h",buff.read(2))[0]
            type_ent = buff.unpack_varint()
            data_ent = buff.unpack_nbt()
        trust_edges = buff.read(1)
        sky_light_mask_len = buff.unpack_varint()
        sky_light_mask_dat = buff.read(8*sky_light_mask_len)
        print(sky_light_mask_len)
        block_light_mask_len = buff.unpack_varint()
        block_light_mask_dat = buff.read(8*block_light_mask_len)
        print(block_light_mask_len)
        empt_sky_light_mask_len = buff.unpack_varint()
        empt_sky_light_mask_dat = buff.read(8*empt_sky_light_mask_len)
        print(empt_sky_light_mask_len)
        empt_block_light_mask_len = buff.unpack_varint()
        empt_block_light_mask_dat = buff.read(8*empt_block_light_mask_len)
        print(empt_block_light_mask_len)

        sky_light_count = buff.unpack_varint()
        sky_light_data = b''
        for i in range(sky_light_count):
            sky_light_len = buff.unpack_varint()
            sky_light_data += buff.read(sky_light_len)

        block_light_count = buff.unpack_varint()
        block_light_data = b''
        for i in range(block_light_count):
            block_light_len = buff.unpack_varint()
            block_light_data += buff.read(block_light_len)```

just wrote and tested works, but I dont know how to request a merge to the main proj

(Should work, dont think it will work great though)
(will comment soon how to unpack chunk_data)