From a3cd58fda13c0893a3a5762666fc17f040823004 Mon Sep 17 00:00:00 2001 From: TomyLobo Date: Fri, 23 Sep 2011 13:43:05 +0200 Subject: [PATCH] Added flip code for vines, fence gates and mushroom caps. --- .../com/sk89q/worldedit/data/BlockData.java | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/data/BlockData.java b/src/main/java/com/sk89q/worldedit/data/BlockData.java index ae7e30746..2cc21c871 100644 --- a/src/main/java/com/sk89q/worldedit/data/BlockData.java +++ b/src/main/java/com/sk89q/worldedit/data/BlockData.java @@ -483,6 +483,72 @@ public final class BlockData { return data ^ flipX; } break; + + case BlockID.RED_MUSHROOM_CAP: + case BlockID.BROWN_MUSHROOM_CAP: + switch (data) { + case 1: + case 4: + case 7: + data += 2*flipX; + break; + + case 3: + case 6: + case 9: + data -= 2*flipX; + break; + } + + switch (data) { + case 1: + case 2: + case 3: + data += 6*flipZ; + break; + + case 7: + case 8: + case 9: + data -= 6*flipZ; + break; + } + + break; + + case BlockID.VINE: + final int bit1, bit2; + switch (direction) { + case NORTH_SOUTH: + bit1 = 0x2; + bit2 = 0x8; + break; + + case WEST_EAST: + bit1 = 0x1; + bit2 = 0x4; + break; + + default: + return data; + } + int newData = data & ~(bit1 | bit2); + if ((data & bit1) != 0) newData |= bit2; + if ((data & bit2) != 0) newData |= bit1; + + return newData; + + case BlockID.FENCE_GATE: + switch (data & 0x3) { + case 0: + case 2: + return data ^ 2*flipZ; + + case 1: + case 3: + return data ^ 2*flipX; + } + break; } return data;