diff options
Diffstat (limited to 'src/main')
25 files changed, 237 insertions, 237 deletions
diff --git a/src/main/java/org/bukkit/block/BlockFace.java b/src/main/java/org/bukkit/block/BlockFace.java index 43447648..58fb195d 100644 --- a/src/main/java/org/bukkit/block/BlockFace.java +++ b/src/main/java/org/bukkit/block/BlockFace.java @@ -4,10 +4,10 @@ package org.bukkit.block; * Represents the face of a block */ public enum BlockFace { - NORTH(-1, 0, 0), - EAST(0, 0, -1), - SOUTH(1, 0, 0), - WEST(0, 0, 1), + NORTH(0, 0, -1), + EAST(1, 0, 0), + SOUTH(0, 0, 1), + WEST(-1, 0, 0), UP(0, 1, 0), DOWN(0, -1, 0), NORTH_EAST(NORTH, EAST), diff --git a/src/main/java/org/bukkit/material/Bed.java b/src/main/java/org/bukkit/material/Bed.java index 63e92063..77f1e5f3 100644 --- a/src/main/java/org/bukkit/material/Bed.java +++ b/src/main/java/org/bukkit/material/Bed.java @@ -67,19 +67,19 @@ public class Bed extends MaterialData implements Directional { byte data; switch (face) { - case WEST: + case SOUTH: data = 0x0; break; - case NORTH: + case WEST: data = 0x1; break; - case EAST: + case NORTH: data = 0x2; break; - case SOUTH: + case EAST: default: data = 0x3; } @@ -101,17 +101,17 @@ public class Bed extends MaterialData implements Directional { switch (data) { case 0x0: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x1: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x2: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x3: default: - return BlockFace.SOUTH; + return BlockFace.EAST; } } diff --git a/src/main/java/org/bukkit/material/Button.java b/src/main/java/org/bukkit/material/Button.java index d80e11ec..1b72042a 100644 --- a/src/main/java/org/bukkit/material/Button.java +++ b/src/main/java/org/bukkit/material/Button.java @@ -57,16 +57,16 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { switch (data) { case 0x1: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x3: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x4: - return BlockFace.WEST; + return BlockFace.SOUTH; } return null; @@ -79,19 +79,19 @@ public class Button extends SimpleAttachableMaterialData implements Redstone { byte data = (byte) (getData() & 0x8); 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; } diff --git a/src/main/java/org/bukkit/material/CocoaPlant.java b/src/main/java/org/bukkit/material/CocoaPlant.java index ad19e052..9a5413ea 100644 --- a/src/main/java/org/bukkit/material/CocoaPlant.java +++ b/src/main/java/org/bukkit/material/CocoaPlant.java @@ -13,7 +13,7 @@ public class CocoaPlant extends MaterialData implements Directional { MEDIUM, LARGE } - + public CocoaPlant() { super(Material.COCOA); } @@ -51,7 +51,7 @@ public class CocoaPlant extends MaterialData implements Directional { return CocoaPlantSize.LARGE; } } - + /** * Set size of plant * @param sz - size of plant @@ -70,19 +70,19 @@ public class CocoaPlant extends MaterialData implements Directional { } setData((byte) dat); } - + public void setFacingDirection(BlockFace face) { int dat = getData() & 0xC; switch (face) { - case WEST: + case SOUTH: break; - case NORTH: + case WEST: dat |= 0x1; break; - case EAST: + case NORTH: dat |= 0x2; break; - case SOUTH: + case EAST: dat |= 0x3; break; default: @@ -94,17 +94,17 @@ public class CocoaPlant extends MaterialData implements Directional { public BlockFace getFacing() { switch (getData() & 0x3) { case 0: - return BlockFace.WEST; + return BlockFace.SOUTH; case 1: - return BlockFace.NORTH; + return BlockFace.WEST; case 2: - return BlockFace.EAST; + return BlockFace.NORTH; case 3: - return BlockFace.SOUTH; + return BlockFace.EAST; } return null; } - + @Override public CocoaPlant clone() { return (CocoaPlant) super.clone(); diff --git a/src/main/java/org/bukkit/material/Diode.java b/src/main/java/org/bukkit/material/Diode.java index 6c1930c4..54853f18 100644 --- a/src/main/java/org/bukkit/material/Diode.java +++ b/src/main/java/org/bukkit/material/Diode.java @@ -56,19 +56,19 @@ public class Diode extends MaterialData implements Directional { byte data; switch (face) { - case SOUTH: + case EAST: data = 0x1; break; - case WEST: + case SOUTH: data = 0x2; break; - case NORTH: + case WEST: data = 0x3; break; - case EAST: + case NORTH: default: data = 0x0; } @@ -83,16 +83,16 @@ public class Diode extends MaterialData implements Directional { switch (data) { case 0x0: default: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x1: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x3: - return BlockFace.NORTH; + return BlockFace.WEST; } } diff --git a/src/main/java/org/bukkit/material/DirectionalContainer.java b/src/main/java/org/bukkit/material/DirectionalContainer.java index de9bd363..790b6bd3 100644 --- a/src/main/java/org/bukkit/material/DirectionalContainer.java +++ b/src/main/java/org/bukkit/material/DirectionalContainer.java @@ -27,19 +27,19 @@ public class DirectionalContainer extends MaterialData implements Directional { byte data; switch (face) { - case EAST: + case NORTH: data = 0x2; break; - case WEST: + case SOUTH: data = 0x3; break; - case NORTH: + case WEST: data = 0x4; break; - case SOUTH: + case EAST: default: data = 0x5; } @@ -52,17 +52,17 @@ public class DirectionalContainer extends MaterialData implements Directional { switch (data) { case 0x2: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x3: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x4: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x5: default: - return BlockFace.SOUTH; + return BlockFace.EAST; } } diff --git a/src/main/java/org/bukkit/material/Door.java b/src/main/java/org/bukkit/material/Door.java index e992c28e..732f1bd3 100644 --- a/src/main/java/org/bukkit/material/Door.java +++ b/src/main/java/org/bukkit/material/Door.java @@ -81,15 +81,15 @@ public class Door extends MaterialData implements Directional, Openable { public void setFacingDirection(BlockFace face) { byte data = (byte) (getData() & 0x12); switch (face) { - case EAST: + case NORTH: data |= 0x1; break; - case SOUTH: + case EAST: data |= 0x2; break; - case WEST: + case SOUTH: data |= 0x3; break; } @@ -105,16 +105,16 @@ public class Door extends MaterialData implements Directional, Openable { byte data = (byte) (getData() & 0x3); switch (data) { case 0: - return BlockFace.NORTH; + return BlockFace.WEST; case 1: - return BlockFace.EAST; + return BlockFace.NORTH; case 2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 3: - return BlockFace.WEST; + return BlockFace.SOUTH; } return null; // shouldn't happen } diff --git a/src/main/java/org/bukkit/material/ExtendedRails.java b/src/main/java/org/bukkit/material/ExtendedRails.java index 5d3a9d92..e89e82fd 100644 --- a/src/main/java/org/bukkit/material/ExtendedRails.java +++ b/src/main/java/org/bukkit/material/ExtendedRails.java @@ -37,7 +37,7 @@ public class ExtendedRails extends Rails { public void setDirection(BlockFace face, boolean isOnSlope) { boolean extraBitSet = (getData() & 0x8) == 0x8; - if (face != BlockFace.NORTH && face != BlockFace.SOUTH && face != BlockFace.EAST && face != BlockFace.WEST) { + if (face != BlockFace.WEST && face != BlockFace.EAST && face != BlockFace.NORTH && face != BlockFace.SOUTH) { throw new IllegalArgumentException("Detector rails and powered rails cannot be set on a curve!"); } diff --git a/src/main/java/org/bukkit/material/Gate.java b/src/main/java/org/bukkit/material/Gate.java index e80abe7a..8adc1cfb 100644 --- a/src/main/java/org/bukkit/material/Gate.java +++ b/src/main/java/org/bukkit/material/Gate.java @@ -31,16 +31,16 @@ public class Gate extends MaterialData implements Directional, Openable { switch (face) { default: - case SOUTH: + case EAST: data |= GATE_SOUTH; break; - case WEST: + case SOUTH: data |= GATE_WEST; break; - case NORTH: + case WEST: data |= GATE_NORTH; break; - case EAST: + case NORTH: data |= GATE_EAST; break; } @@ -51,16 +51,16 @@ public class Gate extends MaterialData implements Directional, Openable { public BlockFace getFacing() { switch (getData() & DIR_BIT) { case GATE_SOUTH: - return BlockFace.SOUTH; + return BlockFace.EAST; case GATE_WEST: - return BlockFace.WEST; + return BlockFace.SOUTH; case GATE_NORTH: - return BlockFace.NORTH; + return BlockFace.WEST; case GATE_EAST: - return BlockFace.EAST; + return BlockFace.NORTH; } - return BlockFace.SOUTH; + return BlockFace.EAST; } public boolean isOpen() { diff --git a/src/main/java/org/bukkit/material/Ladder.java b/src/main/java/org/bukkit/material/Ladder.java index aea01f8e..31991a67 100644 --- a/src/main/java/org/bukkit/material/Ladder.java +++ b/src/main/java/org/bukkit/material/Ladder.java @@ -37,16 +37,16 @@ public class Ladder extends SimpleAttachableMaterialData { switch (data) { case 0x2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x3: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x4: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x5: - return BlockFace.NORTH; + return BlockFace.WEST; } return null; @@ -59,19 +59,19 @@ public class Ladder extends SimpleAttachableMaterialData { byte data = (byte) 0x0; switch (face) { - case WEST: + case SOUTH: data = 0x2; break; - case EAST: + case NORTH: data = 0x3; break; - case SOUTH: + case EAST: data = 0x4; break; - case NORTH: + case WEST: data = 0x5; break; } diff --git a/src/main/java/org/bukkit/material/Lever.java b/src/main/java/org/bukkit/material/Lever.java index 395b62ce..bc4dd3a1 100644 --- a/src/main/java/org/bukkit/material/Lever.java +++ b/src/main/java/org/bukkit/material/Lever.java @@ -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; + return BlockFace.EAST; case 0x3: - return BlockFace.EAST; + 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; } diff --git a/src/main/java/org/bukkit/material/Mushroom.java b/src/main/java/org/bukkit/material/Mushroom.java index 237a17a5..f651ed84 100644 --- a/src/main/java/org/bukkit/material/Mushroom.java +++ b/src/main/java/org/bukkit/material/Mushroom.java @@ -63,13 +63,13 @@ public class Mushroom extends MaterialData { } switch (face) { - case NORTH: + case WEST: return data < NORTH_LIMIT; - case SOUTH: - return data > SOUTH_LIMIT; case EAST: + return data > SOUTH_LIMIT; + case NORTH: return data % EAST_WEST_LIMIT == EAST_REMAINDER; - case WEST: + case SOUTH: return data % EAST_WEST_LIMIT == WEST_REMAINDER; case UP: return true; @@ -96,7 +96,7 @@ public class Mushroom extends MaterialData { } switch (face) { - case NORTH: + case WEST: if (painted) { data -= NORTH_SOUTH_MOD; } else { @@ -104,7 +104,7 @@ public class Mushroom extends MaterialData { } break; - case SOUTH: + case EAST: if (painted) { data += NORTH_SOUTH_MOD; } else { @@ -112,7 +112,7 @@ public class Mushroom extends MaterialData { } break; - case EAST: + case NORTH: if (painted) { data += EAST_WEST_MOD; } else { @@ -120,7 +120,7 @@ public class Mushroom extends MaterialData { } break; - case WEST: + case SOUTH: if (painted) { data -= EAST_WEST_MOD; } else { @@ -147,22 +147,22 @@ public class Mushroom extends MaterialData { public Set<BlockFace> getPaintedFaces() { EnumSet<BlockFace> faces = EnumSet.noneOf(BlockFace.class); - if (isFacePainted(BlockFace.NORTH)) { - faces.add(BlockFace.NORTH); - } - - if (isFacePainted(BlockFace.EAST)) { - faces.add(BlockFace.EAST); - } - if (isFacePainted(BlockFace.WEST)) { faces.add(BlockFace.WEST); } + if (isFacePainted(BlockFace.NORTH)) { + faces.add(BlockFace.NORTH); + } + if (isFacePainted(BlockFace.SOUTH)) { faces.add(BlockFace.SOUTH); } + if (isFacePainted(BlockFace.EAST)) { + faces.add(BlockFace.EAST); + } + if (isFacePainted(BlockFace.UP)) { faces.add(BlockFace.UP); } diff --git a/src/main/java/org/bukkit/material/PistonBaseMaterial.java b/src/main/java/org/bukkit/material/PistonBaseMaterial.java index 82315530..f5e2fc94 100644 --- a/src/main/java/org/bukkit/material/PistonBaseMaterial.java +++ b/src/main/java/org/bukkit/material/PistonBaseMaterial.java @@ -30,16 +30,16 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red case UP: data |= 1; break; - case EAST: + case NORTH: data |= 2; break; - case WEST: + case SOUTH: data |= 3; break; - case NORTH: + case WEST: data |= 4; break; - case SOUTH: + case EAST: data |= 5; break; } @@ -55,13 +55,13 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red case 1: return BlockFace.UP; case 2: - return BlockFace.EAST; + return BlockFace.NORTH; case 3: - return BlockFace.WEST; + return BlockFace.SOUTH; case 4: - return BlockFace.NORTH; + return BlockFace.WEST; case 5: - return BlockFace.SOUTH; + return BlockFace.EAST; default: return BlockFace.SELF; } diff --git a/src/main/java/org/bukkit/material/PistonExtensionMaterial.java b/src/main/java/org/bukkit/material/PistonExtensionMaterial.java index f513f231..37323a61 100644 --- a/src/main/java/org/bukkit/material/PistonExtensionMaterial.java +++ b/src/main/java/org/bukkit/material/PistonExtensionMaterial.java @@ -30,16 +30,16 @@ public class PistonExtensionMaterial extends MaterialData implements Attachable case UP: data |= 1; break; - case EAST: + case NORTH: data |= 2; break; - case WEST: + case SOUTH: data |= 3; break; - case NORTH: + case WEST: data |= 4; break; - case SOUTH: + case EAST: data |= 5; break; } @@ -55,13 +55,13 @@ public class PistonExtensionMaterial extends MaterialData implements Attachable case 1: return BlockFace.UP; case 2: - return BlockFace.EAST; + return BlockFace.NORTH; case 3: - return BlockFace.WEST; + return BlockFace.SOUTH; case 4: - return BlockFace.NORTH; + return BlockFace.WEST; case 5: - return BlockFace.SOUTH; + return BlockFace.EAST; default: return BlockFace.SELF; } diff --git a/src/main/java/org/bukkit/material/Pumpkin.java b/src/main/java/org/bukkit/material/Pumpkin.java index 4acc6bb0..47837dd1 100644 --- a/src/main/java/org/bukkit/material/Pumpkin.java +++ b/src/main/java/org/bukkit/material/Pumpkin.java @@ -46,19 +46,19 @@ public class Pumpkin extends MaterialData implements Directional { byte data; switch (face) { - case EAST: + case NORTH: data = 0x0; break; - case SOUTH: + case EAST: data = 0x1; break; - case WEST: + case SOUTH: data = 0x2; break; - case NORTH: + case WEST: default: data = 0x3; } @@ -71,17 +71,17 @@ public class Pumpkin extends MaterialData implements Directional { switch (data) { case 0x0: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x1: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x3: default: - return BlockFace.SOUTH; + return BlockFace.EAST; } } diff --git a/src/main/java/org/bukkit/material/Rails.java b/src/main/java/org/bukkit/material/Rails.java index 406675dc..84d2f1f1 100644 --- a/src/main/java/org/bukkit/material/Rails.java +++ b/src/main/java/org/bukkit/material/Rails.java @@ -59,22 +59,22 @@ public class Rails extends MaterialData { switch (d) { case 0x0: default: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x1: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x3: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x4: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x5: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x6: return BlockFace.NORTH_EAST; @@ -116,19 +116,19 @@ public class Rails extends MaterialData { */ public void setDirection(BlockFace face, boolean isOnSlope) { switch (face) { - case SOUTH: + case EAST: setData((byte) (isOnSlope ? 0x2 : 0x1)); break; - case NORTH: + case WEST: setData((byte) (isOnSlope ? 0x3 : 0x1)); break; - case EAST: + case NORTH: setData((byte) (isOnSlope ? 0x4 : 0x0)); break; - case WEST: + case SOUTH: setData((byte) (isOnSlope ? 0x5 : 0x0)); break; diff --git a/src/main/java/org/bukkit/material/Sign.java b/src/main/java/org/bukkit/material/Sign.java index ceb15d87..a83b7cb0 100644 --- a/src/main/java/org/bukkit/material/Sign.java +++ b/src/main/java/org/bukkit/material/Sign.java @@ -48,16 +48,16 @@ public class Sign extends MaterialData implements Attachable { switch (data) { case 0x2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x3: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x4: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x5: - return BlockFace.NORTH; + return BlockFace.WEST; } return null; @@ -77,7 +77,7 @@ public class Sign extends MaterialData implements Attachable { if (!isWallSign()) { switch (data) { case 0x0: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x1: return BlockFace.WEST_NORTH_WEST; @@ -89,7 +89,7 @@ public class Sign extends MaterialData implements Attachable { return BlockFace.NORTH_NORTH_WEST; case 0x4: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x5: return BlockFace.NORTH_NORTH_EAST; @@ -101,7 +101,7 @@ public class Sign extends MaterialData implements Attachable { return BlockFace.EAST_NORTH_EAST; case 0x8: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x9: return BlockFace.EAST_SOUTH_EAST; @@ -113,7 +113,7 @@ public class Sign extends MaterialData implements Attachable { return BlockFace.SOUTH_SOUTH_EAST; case 0xC: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0xD: return BlockFace.SOUTH_SOUTH_WEST; @@ -136,25 +136,25 @@ public class Sign extends MaterialData implements Attachable { if (isWallSign()) { switch (face) { - case EAST: + case NORTH: data = 0x2; break; - case WEST: + case SOUTH: data = 0x3; break; - case NORTH: + case WEST: data = 0x4; break; - case SOUTH: + case EAST: default: data = 0x5; } } else { switch (face) { - case WEST: + case SOUTH: data = 0x0; break; @@ -170,7 +170,7 @@ public class Sign extends MaterialData implements Attachable { data = 0x3; break; - case NORTH: + case WEST: data = 0x4; break; @@ -186,7 +186,7 @@ public class Sign extends MaterialData implements Attachable { data = 0x7; break; - case EAST: + case NORTH: data = 0x8; break; @@ -202,7 +202,7 @@ public class Sign extends MaterialData implements Attachable { data = 0xB; break; - case SOUTH: + case EAST: data = 0xC; break; diff --git a/src/main/java/org/bukkit/material/Skull.java b/src/main/java/org/bukkit/material/Skull.java index 77130fb9..bd2bbf31 100644 --- a/src/main/java/org/bukkit/material/Skull.java +++ b/src/main/java/org/bukkit/material/Skull.java @@ -41,19 +41,19 @@ public class Skull extends MaterialData implements Directional { int data; switch (face) { - case EAST: + case NORTH: data = 0x1; break; - case SOUTH: + case EAST: data = 0x2; break; - case WEST: + case SOUTH: data = 0x3; break; - case NORTH: + case WEST: default: data = 0x4; } @@ -66,17 +66,17 @@ public class Skull extends MaterialData implements Directional { switch (data) { case 0x1: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x3: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x4: default: - return BlockFace.SOUTH; + return BlockFace.EAST; } } diff --git a/src/main/java/org/bukkit/material/Stairs.java b/src/main/java/org/bukkit/material/Stairs.java index 67ff745a..3eb1418c 100644 --- a/src/main/java/org/bukkit/material/Stairs.java +++ b/src/main/java/org/bukkit/material/Stairs.java @@ -33,16 +33,16 @@ public class Stairs extends MaterialData implements Directional { switch (data & 0x3) { case 0x0: default: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x1: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x3: - return BlockFace.EAST; + return BlockFace.NORTH; } } @@ -60,20 +60,20 @@ public class Stairs extends MaterialData implements Directional { byte data; switch (face) { - case NORTH: + case WEST: default: data = 0x0; break; - case SOUTH: + case EAST: data = 0x1; break; - case EAST: + case NORTH: data = 0x2; break; - case WEST: + case SOUTH: data = 0x3; break; } @@ -95,7 +95,7 @@ public class Stairs extends MaterialData implements Directional { public boolean isInverted() { return ((getData() & 0x4) != 0); } - + /** * Set step inverted state * @param inv - true if step is inverted (top half), false if step is normal (bottom half) diff --git a/src/main/java/org/bukkit/material/Torch.java b/src/main/java/org/bukkit/material/Torch.java index 13a9777e..90c18747 100644 --- a/src/main/java/org/bukkit/material/Torch.java +++ b/src/main/java/org/bukkit/material/Torch.java @@ -37,16 +37,16 @@ public class Torch extends SimpleAttachableMaterialData { switch (data) { case 0x1: - return BlockFace.NORTH; + return BlockFace.WEST; case 0x2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x3: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x4: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x5: return BlockFace.DOWN; @@ -59,19 +59,19 @@ public class Torch extends SimpleAttachableMaterialData { byte data; 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; diff --git a/src/main/java/org/bukkit/material/TrapDoor.java b/src/main/java/org/bukkit/material/TrapDoor.java index c280c78f..5041a5c1 100644 --- a/src/main/java/org/bukkit/material/TrapDoor.java +++ b/src/main/java/org/bukkit/material/TrapDoor.java @@ -48,16 +48,16 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable { switch (data) { case 0x0: - return BlockFace.WEST; + return BlockFace.SOUTH; case 0x1: - return BlockFace.EAST; + return BlockFace.NORTH; case 0x2: - return BlockFace.SOUTH; + return BlockFace.EAST; case 0x3: - return BlockFace.NORTH; + return BlockFace.WEST; } return null; @@ -68,13 +68,13 @@ public class TrapDoor extends SimpleAttachableMaterialData implements Openable { byte data = (byte) (getData() & 0x4); switch (face) { - case WEST: + case SOUTH: data |= 0x1; break; - case NORTH: + case WEST: data |= 0x2; break; - case SOUTH: + case EAST: data |= 0x3; break; } diff --git a/src/main/java/org/bukkit/material/Tree.java b/src/main/java/org/bukkit/material/Tree.java index 31548354..86ac0fa2 100644 --- a/src/main/java/org/bukkit/material/Tree.java +++ b/src/main/java/org/bukkit/material/Tree.java @@ -59,8 +59,8 @@ public class Tree extends MaterialData { /** * Get direction of the log - * - * @return BlockFace.TOP for upright (default), BlockFace.EAST (east-west), BlockFace.NORTH (north-sout), BlockFace.SELF (directionless) + * + * @return BlockFace.TOP for upright (default), BlockFace.NORTH (east-west), BlockFace.WEST (north-sout), BlockFace.SELF (directionless) */ public BlockFace getDirection() { switch ((getData() >> 2) & 0x3) { @@ -68,9 +68,9 @@ public class Tree extends MaterialData { default: return BlockFace.UP; case 1: // North-south - return BlockFace.NORTH; + return BlockFace.WEST; case 2: // East-west - return BlockFace.EAST; + return BlockFace.NORTH; case 3: // Directionless (bark on all sides) return BlockFace.SELF; } @@ -87,12 +87,12 @@ public class Tree extends MaterialData { default: dat = 0; break; - case NORTH: - case SOUTH: + case WEST: + case EAST: dat = 1; break; - case EAST: - case WEST: + case NORTH: + case SOUTH: dat = 2; break; case SELF: diff --git a/src/main/java/org/bukkit/material/TripwireHook.java b/src/main/java/org/bukkit/material/TripwireHook.java index 9f8e13d3..bf8066bf 100644 --- a/src/main/java/org/bukkit/material/TripwireHook.java +++ b/src/main/java/org/bukkit/material/TripwireHook.java @@ -68,16 +68,16 @@ public class TripwireHook extends SimpleAttachableMaterialData implements Redsto public void setFacingDirection(BlockFace face) { int dat = getData() & 0xC; switch (face) { - case NORTH: + case WEST: dat |= 0x1; break; - case EAST: + case NORTH: dat |= 0x2; break; - case SOUTH: + case EAST: dat |= 0x3; break; - case WEST: + case SOUTH: default: break; } @@ -87,13 +87,13 @@ public class TripwireHook extends SimpleAttachableMaterialData implements Redsto public BlockFace getAttachedFace() { switch (getData() & 0x3) { case 0: - return BlockFace.EAST; + return BlockFace.NORTH; case 1: - return BlockFace.SOUTH; + return BlockFace.EAST; case 2: - return BlockFace.WEST; + return BlockFace.SOUTH; case 3: - return BlockFace.NORTH; + return BlockFace.WEST; } return null; } diff --git a/src/main/java/org/bukkit/material/Vine.java b/src/main/java/org/bukkit/material/Vine.java index beb92480..722cbc98 100644 --- a/src/main/java/org/bukkit/material/Vine.java +++ b/src/main/java/org/bukkit/material/Vine.java @@ -14,7 +14,7 @@ public class Vine extends MaterialData { private static final int VINE_EAST = 0x8; private static final int VINE_WEST = 0x2; private static final int VINE_SOUTH = 0x1; - EnumSet<BlockFace> possibleFaces = EnumSet.of(BlockFace.NORTH, BlockFace.EAST, BlockFace.WEST, BlockFace.SOUTH); + EnumSet<BlockFace> possibleFaces = EnumSet.of(BlockFace.WEST, BlockFace.NORTH, BlockFace.SOUTH, BlockFace.EAST); public Vine() { super(Material.VINE); @@ -38,19 +38,19 @@ public class Vine extends MaterialData { byte data = 0; - if (faces.contains(BlockFace.NORTH)) { + if (faces.contains(BlockFace.WEST)) { data |= VINE_NORTH; } - if (faces.contains(BlockFace.EAST)) { + if (faces.contains(BlockFace.NORTH)) { data |= VINE_EAST; } - if (faces.contains(BlockFace.WEST)) { + if (faces.contains(BlockFace.SOUTH)) { data |= VINE_WEST; } - if (faces.contains(BlockFace.SOUTH)) { + if (faces.contains(BlockFace.EAST)) { data |= VINE_SOUTH; } @@ -66,22 +66,22 @@ public class Vine extends MaterialData { */ public boolean isOnFace(BlockFace face) { switch (face) { - case NORTH: + case WEST: return (getData() & VINE_NORTH) > 0; - case EAST: + case NORTH: return (getData() & VINE_EAST) > 0; - case WEST: - return (getData() & VINE_WEST) > 0; case SOUTH: + return (getData() & VINE_WEST) > 0; + case EAST: return (getData() & VINE_SOUTH) > 0; case NORTH_EAST: - return isOnFace(BlockFace.NORTH) && isOnFace(BlockFace.EAST); + return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.NORTH); case NORTH_WEST: - return isOnFace(BlockFace.NORTH) && isOnFace(BlockFace.WEST); + return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.SOUTH); case SOUTH_EAST: - return isOnFace(BlockFace.SOUTH) && isOnFace(BlockFace.EAST); + return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.NORTH); case SOUTH_WEST: - return isOnFace(BlockFace.SOUTH) && isOnFace(BlockFace.WEST); + return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.SOUTH); case UP: // It's impossible to be accurate with this since it's contextual return true; default: @@ -96,33 +96,33 @@ public class Vine extends MaterialData { */ public void putOnFace(BlockFace face) { switch(face) { - case NORTH: + case WEST: setData((byte) (getData() | VINE_NORTH)); break; - case EAST: + case NORTH: setData((byte) (getData() | VINE_EAST)); break; - case WEST: + case SOUTH: setData((byte) (getData() | VINE_WEST)); break; - case SOUTH: + case EAST: setData((byte) (getData() | VINE_SOUTH)); break; case NORTH_EAST: + putOnFace(BlockFace.WEST); putOnFace(BlockFace.NORTH); - putOnFace(BlockFace.EAST); break; case NORTH_WEST: - putOnFace(BlockFace.NORTH); putOnFace(BlockFace.WEST); + putOnFace(BlockFace.SOUTH); break; case SOUTH_EAST: - putOnFace(BlockFace.SOUTH); putOnFace(BlockFace.EAST); + putOnFace(BlockFace.NORTH); break; case SOUTH_WEST: + putOnFace(BlockFace.EAST); putOnFace(BlockFace.SOUTH); - putOnFace(BlockFace.WEST); break; case UP: break; @@ -138,33 +138,33 @@ public class Vine extends MaterialData { */ public void removeFromFace(BlockFace face) { switch(face) { - case NORTH: + case WEST: setData((byte) (getData() &~ VINE_NORTH)); break; - case EAST: + case NORTH: setData((byte) (getData() &~ VINE_EAST)); break; - case WEST: + case SOUTH: setData((byte) (getData() &~ VINE_WEST)); break; - case SOUTH: + case EAST: setData((byte) (getData() &~ VINE_SOUTH)); break; case NORTH_EAST: + removeFromFace(BlockFace.WEST); removeFromFace(BlockFace.NORTH); - removeFromFace(BlockFace.EAST); break; case NORTH_WEST: - removeFromFace(BlockFace.NORTH); removeFromFace(BlockFace.WEST); + removeFromFace(BlockFace.SOUTH); break; case SOUTH_EAST: - removeFromFace(BlockFace.SOUTH); removeFromFace(BlockFace.EAST); + removeFromFace(BlockFace.NORTH); break; case SOUTH_WEST: + removeFromFace(BlockFace.EAST); removeFromFace(BlockFace.SOUTH); - removeFromFace(BlockFace.WEST); break; case UP: break; diff --git a/src/main/java/org/bukkit/util/BlockIterator.java b/src/main/java/org/bukkit/util/BlockIterator.java index 672cc0f1..d6ff0142 100644 --- a/src/main/java/org/bukkit/util/BlockIterator.java +++ b/src/main/java/org/bukkit/util/BlockIterator.java @@ -179,7 +179,7 @@ public class BlockIterator implements Iterator<Block> { } private BlockFace getXFace(Vector direction) { - return ((direction.getX() > 0) ? BlockFace.SOUTH : BlockFace.NORTH); + return ((direction.getX() > 0) ? BlockFace.EAST : BlockFace.WEST); } private BlockFace getYFace(Vector direction) { @@ -187,7 +187,7 @@ public class BlockIterator implements Iterator<Block> { } private BlockFace getZFace(Vector direction) { - return ((direction.getZ() > 0) ? BlockFace.WEST : BlockFace.EAST); + return ((direction.getZ() > 0) ? BlockFace.SOUTH : BlockFace.NORTH); } private double getXLength(Vector direction) { |