From 6be8c8b55c79657a210a82e2a40a8c44d57ec30a Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 24 Aug 2012 13:40:26 -0700 Subject: [PATCH] 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. --- .../com/sk89q/worldedit/schematic/MCEditSchematicFormat.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java b/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java index 2fb408bd9..36c16d9be 100644 --- a/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java +++ b/src/main/java/com/sk89q/worldedit/schematic/MCEditSchematicFormat.java @@ -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 {