Fixed setFacingDirection and removed redundant interface. Thanks DiddiZ!

By: EvilSeph <evilseph@gmail.com>
This commit is contained in:
Bukkit/Spigot 2011-07-14 14:33:39 -04:00
parent 0c05778bc3
commit 7a2afd1206
2 changed files with 23 additions and 25 deletions

View File

@ -25,26 +25,25 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red
} }
public void setFacingDirection(BlockFace face) { public void setFacingDirection(BlockFace face) {
byte data = (byte)(getData() ^ 7); byte data = (byte)(getData() & 0x8);
switch (face) { switch (face) {
case UP: case UP:
data |= 1; data |= 1;
break; break;
case NORTH: case EAST:
data |= 2; data |= 2;
break; break;
case EAST: case WEST:
data |= 3; data |= 3;
break; break;
case SOUTH: case NORTH:
data |= 4; data |= 4;
break; break;
case WEST: case SOUTH:
data |= 5; data |= 5;
break; break;
} }
setData(data); setData(data);
} }
@ -57,13 +56,13 @@ public class PistonBaseMaterial extends MaterialData implements Directional, Red
case 1: case 1:
return BlockFace.UP; return BlockFace.UP;
case 2: case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST; return BlockFace.EAST;
case 3:
return BlockFace.WEST;
case 4:
return BlockFace.NORTH;
case 5:
return BlockFace.SOUTH;
default: default:
return BlockFace.SELF; return BlockFace.SELF;
} }

View File

@ -7,7 +7,7 @@ import org.bukkit.block.BlockFace;
/** /**
* Material data for the piston extension block * 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) { public PistonExtensionMaterial(final int type) {
super(type); super(type);
} }
@ -25,26 +25,25 @@ public class PistonExtensionMaterial extends MaterialData implements Directional
} }
public void setFacingDirection(BlockFace face) { public void setFacingDirection(BlockFace face) {
byte data = (byte)(getData() ^ 7); byte data = (byte)(getData() & 0x8);
switch (face) { switch (face) {
case UP: case UP:
data |= 1; data |= 1;
break; break;
case NORTH: case EAST:
data |= 2; data |= 2;
break; break;
case EAST: case WEST:
data |= 3; data |= 3;
break; break;
case SOUTH: case NORTH:
data |= 4; data |= 4;
break; break;
case WEST: case SOUTH:
data |= 5; data |= 5;
break; break;
} }
setData(data); setData(data);
} }
@ -57,13 +56,13 @@ public class PistonExtensionMaterial extends MaterialData implements Directional
case 1: case 1:
return BlockFace.UP; return BlockFace.UP;
case 2: case 2:
return BlockFace.NORTH;
case 3:
return BlockFace.SOUTH;
case 4:
return BlockFace.WEST;
case 5:
return BlockFace.EAST; return BlockFace.EAST;
case 3:
return BlockFace.WEST;
case 4:
return BlockFace.NORTH;
case 5:
return BlockFace.SOUTH;
default: default:
return BlockFace.SELF; return BlockFace.SELF;
} }