From e207ccebe8baad919cb947602562a22d2074b7e4 Mon Sep 17 00:00:00 2001 From: sk89q Date: Tue, 1 Jul 2014 15:16:27 -0700 Subject: [PATCH] Fixed activated hoppers rotating incorrectly. Fixes WORLDEDIT-3138. --- .../com/sk89q/worldedit/blocks/BlockData.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/com/sk89q/worldedit/blocks/BlockData.java b/src/main/java/com/sk89q/worldedit/blocks/BlockData.java index fed187ed9..3d78435a1 100644 --- a/src/main/java/com/sk89q/worldedit/blocks/BlockData.java +++ b/src/main/java/com/sk89q/worldedit/blocks/BlockData.java @@ -124,7 +124,7 @@ public final class BlockData { /* FALL-THROUGH */ case BlockID.COCOA_PLANT: - case BlockID.TRIPWIRE_HOOK: + case BlockID.TRIPWIRE_HOOK: { int extra = data & ~0x3; int withoutFlags = data & 0x3; switch (withoutFlags) { @@ -134,7 +134,7 @@ public final class BlockData { case 3: return 0 | extra; } break; - + } case BlockID.SIGN_POST: return (data + 4) % 16; @@ -145,15 +145,17 @@ public final class BlockData { case BlockID.BURNING_FURNACE: case BlockID.ENDER_CHEST: case BlockID.TRAPPED_CHEST: - case BlockID.HOPPER: - switch (data) { - case 2: return 5; - case 3: return 4; - case 4: return 2; - case 5: return 3; + case BlockID.HOPPER: { + int extra = data & 0x8; + int withoutFlags = data & ~0x8; + switch (withoutFlags) { + case 2: return 5 | extra; + case 3: return 4 | extra; + case 4: return 2 | extra; + case 5: return 3 | extra; } break; - + } case BlockID.DISPENSER: case BlockID.DROPPER: int dispPower = data & 0x8;