Use the block value to find the current block

This commit is contained in:
Anders 2021-05-19 13:42:57 +02:00
parent ca25cc0470
commit ef51a3765b
No known key found for this signature in database
GPG Key ID: 51A1CC4FE32C205A

View File

@ -92,11 +92,14 @@ public class Section implements PublicCloneable<Section> {
{
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.