mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-11-02 10:57:11 +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:
parent
18c793683b
commit
6be8c8b55c
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user