Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

properly decode chunks (code) #177

Open
davidawesome02 opened this issue Sep 10, 2022 · 0 comments
Open

properly decode chunks (code) #177

davidawesome02 opened this issue Sep 10, 2022 · 0 comments

Comments

@davidawesome02
Copy link

        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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant