mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2025-06-11 20:13:55 +00:00
Fixed incorrect schematic handling code being used when AddBlocks is present. The old code did not properly handle the signed nature of the byte, nor did it properly shift and add the extra 4 bits in AddBlocks.
This commit is contained in:
@ -115,9 +115,9 @@ public class MCEditSchematicFormat extends SchematicFormat {
|
||||
if (schematic.containsKey("AddBlocks")) {
|
||||
byte[] addBlockIds = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue();
|
||||
for (int i = 0, index = 0; i < addBlockIds.length && index < blocks.length; ++i) {
|
||||
blocks[index] = (short) (addBlockIds[i] & 0xF << 8 + rawBlocks[index++]);
|
||||
blocks[index] = (short) (((addBlockIds[i] >> 4) << 8) + (rawBlocks[index++] & 0xFF));
|
||||
if (index < blocks.length) {
|
||||
blocks[index] = (short) (((addBlockIds[i] << 4) & 0xF) << 8 + rawBlocks[index++]);
|
||||
blocks[index] = (short) (((addBlockIds[i] & 0xF) << 8) + (rawBlocks[index++] & 0xFF));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
Reference in New Issue
Block a user