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.

Dieser Commit ist enthalten in:
sk89q 2012-08-24 13:40:26 -07:00
Ursprung 18c793683b
Commit 6be8c8b55c

Datei anzeigen

@ -115,9 +115,9 @@ public class MCEditSchematicFormat extends SchematicFormat {
if (schematic.containsKey("AddBlocks")) { if (schematic.containsKey("AddBlocks")) {
byte[] addBlockIds = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue(); byte[] addBlockIds = getChildTag(schematic, "AddBlocks", ByteArrayTag.class).getValue();
for (int i = 0, index = 0; i < addBlockIds.length && index < blocks.length; ++i) { 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) { 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 { } else {