From ef51a3765bb0d8c724525024367ace125a24c312 Mon Sep 17 00:00:00 2001 From: Anders Date: Wed, 19 May 2021 13:42:57 +0200 Subject: [PATCH] Use the block value to find the current block --- .../java/net/minestom/server/instance/palette/Section.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/main/java/net/minestom/server/instance/palette/Section.java b/src/main/java/net/minestom/server/instance/palette/Section.java index 0dde805a2..1976b930f 100644 --- a/src/main/java/net/minestom/server/instance/palette/Section.java +++ b/src/main/java/net/minestom/server/instance/palette/Section.java @@ -92,11 +92,14 @@ public class Section implements PublicCloneable
{ { final long clear = MAGIC_MASKS[bitsPerEntry]; + final long value = block >> bitIndex & clear; + final boolean isCurrentAir = Block.fromStateId( + hasPalette ? paletteBlockMap.get((short) value) : (short) value).isAir(); + block |= clear << bitIndex; block ^= clear << bitIndex; block |= (long) blockId << bitIndex; - final boolean isCurrentAir = Block.fromStateId(getBlockAt(x, y, z)).isAir(); if (!isCurrentAir && isAir) { // The old block isn't air & the new block is. this.blockCount--; } else if (isCurrentAir && !isAir) { // The old block is air & the new block isn't.