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

Limit SubChunk to 2 block layers #6575

Open
dktapps opened this issue Dec 16, 2024 · 0 comments
Open

Limit SubChunk to 2 block layers #6575

dktapps opened this issue Dec 16, 2024 · 0 comments
Labels
BC break Breaks API compatibility Category: Core Related to internal functionality Easy task Probably really easy to do, good task for first-time contributors Performance Type: Enhancement Contributes features or other improvements to PocketMine-MP

Comments

@dktapps
Copy link
Member

dktapps commented Dec 16, 2024

Problem description

Currently we allow an arbitrary number of block layers in SubChunk. This impacts performance because of an extra level of indirection (deref property + array lookup, instead of just deref property).

Minecraft itself only permits the use of 2 layers anyway (one for blocks, one for water), so it doesn't really make sense to nerf performance for this.

Proposed solution

Get rid of array $blockLayers and just have two PalettedBlockArray properties for layer 0 and layer 1.

Side note: It's kinda annoying to name these. We can't really call layer 1 the liquid layer since liquids normally appear in layer 0.

Alternative solutions that don't require API changes

@dktapps dktapps added Category: Core Related to internal functionality BC break Breaks API compatibility Type: Enhancement Contributes features or other improvements to PocketMine-MP Performance Easy task Probably really easy to do, good task for first-time contributors labels Dec 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BC break Breaks API compatibility Category: Core Related to internal functionality Easy task Probably really easy to do, good task for first-time contributors Performance Type: Enhancement Contributes features or other improvements to PocketMine-MP
Projects
None yet
Development

No branches or pull requests

1 participant