From 1dd6faf7862c9461e87731dd5e9134ce33b8372d Mon Sep 17 00:00:00 2001 From: wizjany Date: Fri, 17 Jul 2015 07:51:41 -0400 Subject: [PATCH] Actually for real fix unit tests. I promise this time. Seriously though, who makes unit tests depend on some old, hardcoded file that isn't even updated anymore. --- .../com/sk89q/worldedit/blocks/BlockData.java | 27 ++++++++++++++----- 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java index 1084fdb95..006de9041 100644 --- a/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java +++ b/worldedit-core/src/main/java/com/sk89q/worldedit/blocks/BlockData.java @@ -207,6 +207,7 @@ public final class BlockData { break; case BlockID.TRAP_DOOR: + case BlockID.IRON_TRAP_DOOR: int withoutOrientation = data & ~0x3; int orientation = data & 0x3; switch (orientation) { @@ -241,8 +242,8 @@ public final class BlockData { return ((data + 1) & 0x3) | (data & ~0x3); case BlockID.ANVIL: - int damage = data & 0x4; - switch (data & ~0x4) { + int damage = data & ~0x3; + switch (data & 0x3) { case 0: return 3 | damage; case 2: return 1 | damage; case 1: return 0 | damage; @@ -445,6 +446,7 @@ public final class BlockData { break; case BlockID.TRAP_DOOR: + case BlockID.IRON_TRAP_DOOR: int withoutOrientation = data & ~0x3; int orientation = data & 0x3; switch (orientation) { @@ -478,12 +480,12 @@ public final class BlockData { return ((data + 3) & 0x3) | (data & ~0x3); case BlockID.ANVIL: - int damage = data & 0x4; - switch (data & ~0x4) { + int damage = data & ~0x3; + switch (data & 0x3) { case 0: return 1 | damage; case 2: return 3 | damage; - case 1: return 0 | damage; - case 3: return 2 | damage; + case 1: return 2 | damage; + case 3: return 0 | damage; } break; @@ -721,6 +723,7 @@ public final class BlockData { break; case BlockID.TRAP_DOOR: + case BlockID.IRON_TRAP_DOOR: switch (data & 0x3) { case 0: case 1: @@ -824,6 +827,18 @@ public final class BlockData { return data ^ flipX; } break; + + case BlockID.ANVIL: + switch (data & 0x3) { + case 0: + case 2: + return data ^ flipZ << 1; + case 1: + case 3: + return data ^ flipX << 1; + } + break; + } return data;