Skip to content

Commit

Permalink
Added rotation support to redstone repeaters.
Browse files Browse the repository at this point in the history
  • Loading branch information
sk89q committed Jun 4, 2011
1 parent e62015c commit d397460
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/main/java/com/sk89q/worldedit/data/BlockData.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,16 @@ public static int rotate90(int type, int data) {
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;
Expand Down Expand Up @@ -223,6 +233,16 @@ public static int rotate90Reverse(int type, int data) {
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;
Expand Down

0 comments on commit d397460

Please sign in to comment.