[BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069

If you use BlockFace in any way, to compensate the directionals being incorrect, you can still have backwards compatibility if you add in the handling in your plugin:
boolean legacyBlockFace = BlockFace.NORTH().getModX() == -1; (and then handle it accordingly)

If you didn't special case your directions to fix what's being fixed here... Hurray! Your plugin should now work.

By: feildmaster <admin@feildmaster.com>
This commit is contained in:
Bukkit/Spigot
2012-12-01 00:21:22 -06:00
parent 9e0336d03c
commit 711f3f1007
25 changed files with 272 additions and 272 deletions

View File

@@ -56,25 +56,25 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
switch (data) {
case 0x1:
return BlockFace.NORTH;
return BlockFace.WEST;
case 0x2:
return BlockFace.SOUTH;
case 0x3:
return BlockFace.EAST;
case 0x3:
return BlockFace.NORTH;
case 0x4:
return BlockFace.WEST;
return BlockFace.SOUTH;
case 0x5:
case 0x6:
return BlockFace.DOWN;
case 0x0:
case 0x7:
return BlockFace.UP;
}
return null;
@@ -86,46 +86,46 @@ public class Lever extends SimpleAttachableMaterialData implements Redstone {
public void setFacingDirection(BlockFace face) {
byte data = (byte) (getData() & 0x8);
BlockFace attach = getAttachedFace();
if (attach == BlockFace.DOWN) {
switch (face) {
case WEST:
case EAST:
case SOUTH:
case NORTH:
data |= 0x5;
break;
case SOUTH:
case NORTH:
case EAST:
case WEST:
data |= 0x6;
break;
}
} else if (attach == BlockFace.UP) {
switch (face) {
case WEST:
case EAST:
case SOUTH:
case NORTH:
data |= 0x7;
break;
case SOUTH:
case NORTH:
case EAST:
case WEST:
data |= 0x0;
break;
}
} else {
switch (face) {
case SOUTH:
case EAST:
data |= 0x1;
break;
case NORTH:
case WEST:
data |= 0x2;
break;
case WEST:
case SOUTH:
data |= 0x3;
break;
case EAST:
case NORTH:
data |= 0x4;
break;
}