From 7a2afd120610081a2a6cd4bbc4afaeaf4230d570 Mon Sep 17 00:00:00 2001 From: Bukkit/Spigot Date: Thu, 14 Jul 2011 14:33:39 -0400 Subject: [PATCH] Fixed setFacingDirection and removed redundant interface. Thanks DiddiZ! By: EvilSeph --- .../bukkit/material/PistonBaseMaterial.java | 23 ++++++++--------- .../material/PistonExtensionMaterial.java | 25 +++++++++---------- 2 files changed, 23 insertions(+), 25 deletions(-) diff --git a/paper-api/src/main/java/org/bukkit/material/PistonBaseMaterial.java b/paper-api/src/main/java/org/bukkit/material/PistonBaseMaterial.java index 922bb68626..4a219bb451 100644 --- a/paper-api/src/main/java/org/bukkit/material/PistonBaseMaterial.java +++ b/paper-api/src/main/java/org/bukkit/material/PistonBaseMaterial.java @@ -25,26 +25,25 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red } public void setFacingDirection(BlockFace face) { - byte data = (byte)(getData() ^ 7); + byte data = (byte)(getData() & 0x8); switch (face) { case UP: data |= 1; break; - case NORTH: + case EAST: data |= 2; break; - case EAST: + case WEST: data |= 3; break; - case SOUTH: + case NORTH: data |= 4; break; - case WEST: + case SOUTH: data |= 5; break; } - setData(data); } @@ -57,13 +56,13 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red case 1: return BlockFace.UP; case 2: - return BlockFace.NORTH; - case 3: - return BlockFace.SOUTH; - case 4: - return BlockFace.WEST; - case 5: return BlockFace.EAST; + case 3: + return BlockFace.WEST; + case 4: + return BlockFace.NORTH; + case 5: + return BlockFace.SOUTH; default: return BlockFace.SELF; } diff --git a/paper-api/src/main/java/org/bukkit/material/PistonExtensionMaterial.java b/paper-api/src/main/java/org/bukkit/material/PistonExtensionMaterial.java index 6ab45216fe..2d727a94b6 100644 --- a/paper-api/src/main/java/org/bukkit/material/PistonExtensionMaterial.java +++ b/paper-api/src/main/java/org/bukkit/material/PistonExtensionMaterial.java @@ -7,7 +7,7 @@ import org.bukkit.block.BlockFace; /** * Material data for the piston extension block */ -public class PistonExtensionMaterial extends MaterialData implements Directional, Attachable { +public class PistonExtensionMaterial extends MaterialData implements Attachable { public PistonExtensionMaterial(final int type) { super(type); } @@ -25,26 +25,25 @@ public class PistonExtensionMaterial extends MaterialData implements Directional } public void setFacingDirection(BlockFace face) { - byte data = (byte)(getData() ^ 7); + byte data = (byte)(getData() & 0x8); switch (face) { case UP: data |= 1; break; - case NORTH: + case EAST: data |= 2; break; - case EAST: + case WEST: data |= 3; break; - case SOUTH: + case NORTH: data |= 4; break; - case WEST: + case SOUTH: data |= 5; break; } - setData(data); } @@ -57,13 +56,13 @@ public class PistonExtensionMaterial extends MaterialData implements Directional case 1: return BlockFace.UP; case 2: - return BlockFace.NORTH; - case 3: - return BlockFace.SOUTH; - case 4: - return BlockFace.WEST; - case 5: return BlockFace.EAST; + case 3: + return BlockFace.WEST; + case 4: + return BlockFace.NORTH; + case 5: + return BlockFace.SOUTH; default: return BlockFace.SELF; }