mirror of
https://github.com/Minestom/Minestom.git
synced 2025-02-14 03:11:25 +01:00
Fix anvil saving (minimum 4 bits per entry in block_states palette) (#2450)
This commit is contained in:
parent
bcb0301fb1
commit
dba90a461b
@ -464,7 +464,7 @@ public class AnvilLoader implements IChunkLoader {
|
||||
blockStates.put("palette", ListBinaryTag.listBinaryTag(BinaryTagTypes.COMPOUND, blockPaletteEntries));
|
||||
if (blockPaletteEntries.size() > 1) {
|
||||
// If there is only one entry we do not need to write the packed indices
|
||||
var bitsPerEntry = (int) Math.max(1, Math.ceil(Math.log(blockPaletteEntries.size()) / Math.log(2)));
|
||||
var bitsPerEntry = (int) Math.max(4, Math.ceil(Math.log(blockPaletteEntries.size()) / Math.log(2)));
|
||||
blockStates.putLongArray("data", ArrayUtils.pack(blockIndices, bitsPerEntry));
|
||||
}
|
||||
sectionData.put("block_states", blockStates.build());
|
||||
|
Loading…
Reference in New Issue
Block a user