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) {
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;
}

View File

@ -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;
}