Block palette with bpe within 1-4 is hardcoded to 4
The strategy for section states hardcodes the bits per entry to 4 instead of reusing the input being between 1 & 4. It does cause the client to render air (I assume because of corrupted data) when the palette length is too small.
Problematic line is visible in `PalettedContainer.Strategy.SECTION_STATES`. SECTION_BIOMES does handle it properly.
Environment
PopOS/Linux
Java 17
Created Issue:
Block palette with bpe within 1-4 is hardcoded to 4
The strategy for section states hardcodes the bits per entry to 4 instead of reusing the input being between 1 & 4. It does cause the client to render air (I assume because of corrupted data) when the palette length is too small.
Problematic code is visible in `PalettedContainer.Strategy.SECTION_STATES`. SECTION_BIOMES does handle it properly.
Environment
PopOS/Linux
Java 17
The strategy for section states hardcodes the bits per entry to 4 instead of reusing the input being between 1 & 4. It does cause the client to render air (I assume because of corrupted data) when the palette length is too small.
Problematic
code is visible in `PalettedContainer.Strategy.SECTION_STATES`. SECTION_BIOMES does handle it properly.The strategy for section states hardcodes the bits per entry to 4 instead of reusing the input being between 1 & 4. It does cause the client to render air (I assume because of corrupted data) when the palette length is too small.
Problematic line is visible in `PalettedContainer.Strategy.SECTION_STATES`. SECTION_BIOMES does handle it properly.
Affects 1.18.2
How does this effect the game play of the game?
This is mostly prevention. Such hard to debug issue could cause anvil world corruption, break third party applications respecting the protocol, and even break the whole chunk loading process if this 4 magic number is replaced to 1-3 for whatever reason (memory footprint, dynamic resizing, ...)
And this is a one line/character fix. I therefore believe that it is worth fixing, to both avoid unavoidable issues down the line, and actually respect the protocol to also match how the biome palette work.
Could a developer at least take a look at it before being marked as invalid? Not being a priority is one thing, refused because misunderstood is another.
The person that commented and resolved this is a Mojang employee, they just don't have "[Mojang]" in the name.
I have been asked how a corrupted palette could affect the game, so I just assumed. I do apologize otherwise.