13
0
geforkt von Mirrors/Paper

Let TripwireHook be attachable. Addresses BUKKIT-2278

This commit also makes TripwireHook consistent with other attachables
for the facing property.

By: Wesley Wolfe <weswolf@aol.com>
Dieser Commit ist enthalten in:
Bukkit/Spigot 2012-08-17 14:33:23 -05:00
Ursprung 4dc1654ae8
Commit a0438b2a20

Datei anzeigen

@ -6,7 +6,7 @@ import org.bukkit.block.BlockFace;
/** /**
* Represents the tripwire hook * Represents the tripwire hook
*/ */
public class TripwireHook extends MaterialData implements Directional, Redstone { public class TripwireHook extends SimpleAttachableMaterialData implements Redstone {
public TripwireHook() { public TripwireHook() {
super(Material.TRIPWIRE_HOOK); super(Material.TRIPWIRE_HOOK);
@ -68,24 +68,23 @@ public class TripwireHook extends MaterialData implements Directional, Redstone
public void setFacingDirection(BlockFace face) { public void setFacingDirection(BlockFace face) {
int dat = getData() & 0xC; int dat = getData() & 0xC;
switch (face) { switch (face) {
case EAST: case NORTH:
break;
case SOUTH:
dat |= 0x1; dat |= 0x1;
break; break;
case WEST: case EAST:
dat |= 0x2; dat |= 0x2;
break; break;
case NORTH: case SOUTH:
dat |= 0x3; dat |= 0x3;
break; break;
case WEST:
default: default:
break; break;
} }
setData((byte) dat); setData((byte) dat);
} }
public BlockFace getFacing() { public BlockFace getAttachedFace() {
switch (getData() & 0x3) { switch (getData() & 0x3) {
case 0: case 0:
return BlockFace.EAST; return BlockFace.EAST;