Merge pull request #172 from StackDoubleFlow/master

Fix palette resize issue
This commit is contained in:
TheMode 2021-03-16 04:32:55 +01:00 committed by GitHub
commit bda4658cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -275,7 +275,7 @@ public class PaletteStorage implements PublicCloneable<PaletteStorage> {
final int section = ChunkUtils.getSectionAt(y);
final int valuesPerLong = paletteStorage.valuesPerLong;
int valuesPerLong = paletteStorage.valuesPerLong;
if (paletteStorage.sectionBlocks[section].length == 0) {
if (blockId == 0) {
@ -294,6 +294,9 @@ public class PaletteStorage implements PublicCloneable<PaletteStorage> {
// Change to palette value
blockId = paletteStorage.getPaletteIndex(section, blockId);
// The storage could have been resized
valuesPerLong = paletteStorage.valuesPerLong;
final int sectionIndex = getSectionIndex(x, y, z);
final int index = sectionIndex / valuesPerLong;