From d3974600268a478b24596245834740dbd3d390e0 Mon Sep 17 00:00:00 2001 From: sk89q Date: Fri, 3 Jun 2011 22:51:42 -0700 Subject: [PATCH] Added rotation support to redstone repeaters. --- .../com/sk89q/worldedit/data/BlockData.java | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/main/java/com/sk89q/worldedit/data/BlockData.java b/src/main/java/com/sk89q/worldedit/data/BlockData.java index a1780579b..daf0e4087 100644 --- a/src/main/java/com/sk89q/worldedit/data/BlockData.java +++ b/src/main/java/com/sk89q/worldedit/data/BlockData.java @@ -115,6 +115,16 @@ public final class BlockData { case 2: return 3; case 3: return 0; } + } else if (type == BlockID.REDSTONE_REPEATER_OFF + || type == BlockID.REDSTONE_REPEATER_ON) { + int dir = data & 0x03; + int delay = data - dir; + switch (dir) { + case 0: return 1 | delay; + case 1: return 2 | delay; + case 2: return 3 | delay; + case 3: return 0 | delay; + } } else if (type == BlockID.TRAP_DOOR) { int open = data & 0x4; int withoutOpen = data ^ 0x4; @@ -223,6 +233,16 @@ public final class BlockData { case 3: return 2; case 0: return 3; } + } else if (type == BlockID.REDSTONE_REPEATER_OFF + || type == BlockID.REDSTONE_REPEATER_ON) { + int dir = data & 0x03; + int delay = data ^ 0x03; + switch (dir) { + case 1: return 0 | delay; + case 2: return 1 | delay; + case 3: return 2 | delay; + case 0: return 3 | delay; + } } else if (type == BlockID.TRAP_DOOR) { int open = data & 0x4; int withoutOpen = data ^ 0x4;