Skip to content

Refactor & optimize 1.8 chunk reading/writing - #1567

Open
Beaness wants to merge 8 commits into
retrooper:2.0from
Beaness:optimizechunk1_8
Open

Beaness wants to merge 8 commits into
retrooper:2.0from
Beaness:optimizechunk1_8

Conversation

@Beaness

@Beaness Beaness commented Aug 7, 2026

Copy link
Copy Markdown
Contributor

Refactor of 1.8 chunk handling, reduces allocations by quite a bit. Deprecates NetworkChunkData chunksToData(Chunk_v1_8[] chunks, byte[] biomes) as it's entirely skipped now to reduce memory copies.

@booky10 booky10 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, and also added some minor changes/improvements


0002f2c#diff-f324d7963c6177fb5a6763389a67c36b842d3a40a09530c32a5f916dab21c1a7R155
Don't know much about 1.8 chunk format, but this seemed like a bug to me - can you confirm this?

@Beaness

Beaness commented Oct 17, 2026

Copy link
Copy Markdown
Contributor Author

The previous !fullChunk || !chunk.isEmpty() matches vanilla: groundUp packets can skip empty sections because the client clears every section missing from the mask. Non-groundUp packets only replace the sections in the mask, so empty ones have to be included.

Also, the light loops in writeChunkData don't check chunkMask anymore, so sections left out of the mask still get their light written.

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants