Limit SubChunk
to 2 block layers
#6575
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
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 twoPalettedBlockArray
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
The text was updated successfully, but these errors were encountered: