Skip to content

Commit 1f3622e

Browse files
committed
Fix resized single-value-palette size
1 parent 3d852e9 commit 1f3622e

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

common/src/main/java/dev/booky/betterview/common/antixray/AntiXrayProcessor.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,8 +161,12 @@ public synchronized void process(ByteBuf buf, int sectionY, boolean storageLengt
161161
}
162162
presetPalette[presetIndex] = 0;
163163
}
164+
// don't move single value away from position 0
164165
newPalette[0] = value;
165-
newPaletteBits = MathUtil.ceilLog2(newPalette.length);
166+
// when resizing a single-value palette, we will most likely be using a linear/hashmap
167+
// palette; if so, specify that we need at least 4 bits, as the linear palette
168+
// always expects to read 4 bits per entry
169+
newPaletteBits = Math.max(4, MathUtil.ceilLog2(newPalette.length));
166170
break;
167171
}
168172
// linear palette

0 commit comments

Comments
 (0)