Skip to content

Commit

Permalink
Fixed bed rotation.
Browse files Browse the repository at this point in the history
  • Loading branch information
TomyLobo committed Oct 20, 2013
1 parent 9220831 commit c750cc6
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/main/java/com/sk89q/worldedit/blocks/BlockData.java
Expand Up @@ -225,6 +225,8 @@ public static int rotate90(int type, int data) {
else if (data == 8) return 4;
else return 0; // sanitize extraneous data values since hay blocks are weird

case BlockID.BED:
return data & ~0x3 | (data + 1) & 0x3;
}

return data;
Expand Down Expand Up @@ -429,6 +431,8 @@ public static int rotate90Reverse(int type, int data) {
else if (data == 8) return 4;
else return 0;

case BlockID.BED:
return data & ~0x3 | (data - 1) & 0x3;
}

return data;
Expand Down Expand Up @@ -707,6 +711,16 @@ public static int flip(int type, int data, FlipDirection direction) {
}
break;

case BlockID.BED:
switch (data & 0x3) {
case 0:
case 2:
return data ^ flipZ << 1;
case 1:
case 3:
return data ^ flipX << 1;
}
break;
}

return data;
Expand Down

0 comments on commit c750cc6

Please sign in to comment.