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

Unpacking chunks in 1.18 #161

Open
davidawesome02 opened this issue Jun 7, 2022 · 1 comment
Open

Unpacking chunks in 1.18 #161

davidawesome02 opened this issue Jun 7, 2022 · 1 comment

Comments

@davidawesome02
Copy link

I don't know if this is incorrect, (this is my first time using github)

It seams that as in 1.18 the way of unpacking chunks has changed vs what is used in the official 1.18 release of this project.
(I couldn't figure out how to unpack palliated containers my self)

previously, you got chunks with a bitmask,
buff = bt(packet_data_before)
bitmask = buff.unpack_varint()
heightmap = buff.unpack_nbt()
biomes = [buff.unpack_varint() for _ in range(buff.unpack_varint())]
sections_length = buff.unpack_varint()
sections = buff.unpack_chunk(bitmask)
block_entities = [buff.unpack_nbt() for _ in range(buff.unpack_varint())]

https://github.com/barneygale/quarry/blob/master/tests/types/test_chunk.py
def packet_chunk_data(self, buff):
x, z, full = buff.unpack('ii?')
bitmask = buff.unpack_varint()
heightmap = buff.unpack_nbt() # added in 1.14
biomes = buff.unpack_array('I', 1024) if full else None # changed in 1.15
sections_length = buff.unpack_varint()
sections = buff.unpack_chunk(bitmask)
block_entities = [buff.unpack_nbt() for _ in range(buff.unpack_varint())]

https://quarry.readthedocs.io/en/latest/data_types/chunks.html?highlight=packet_chunk_data

Now looking at the wiki.vg page, https://wiki.vg/Chunk_Format#Packet_structure, https://wiki.vg/Protocol#Chunk_Data_And_Update_Light

I am wondering could anyone help me get a working version for packing/unpacking chunks in 1.18 or can we make a fix for the quarry project (if it is that and not me just being stupid).

also now that it is "Chunk Data And Update Light" the packet name should be changed (outdated right now) and it would be nice if there was a function to unpack both at once.

(Sorry that this is bad, also is there a discord or some place to ask questions without having to post it here)
(If I was not supposed to post here please remove it)
(also https://quarry.readthedocs.io is outdated)

@tmshader
Copy link

Hi there! I've mentioned this in the issue #121 and #88 and it hasn't been fixed yet. I tried coming up with my own solution but I couldn't at the time. The main problem seems to be that the server sends a few values as a BitSet with is a Java exclusive feature/variable type. If we can solve how the serialisation works then we could reverse engineer it and make an unpacking function for it.

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

2 participants