diff --git a/paper-api/src/main/java/org/bukkit/material/TripwireHook.java b/paper-api/src/main/java/org/bukkit/material/TripwireHook.java index 58b8711bc0..9f8e13d318 100644 --- a/paper-api/src/main/java/org/bukkit/material/TripwireHook.java +++ b/paper-api/src/main/java/org/bukkit/material/TripwireHook.java @@ -6,8 +6,8 @@ import org.bukkit.block.BlockFace; /** * Represents the tripwire hook */ -public class TripwireHook extends MaterialData implements Directional, Redstone { - +public class TripwireHook extends SimpleAttachableMaterialData implements Redstone { + public TripwireHook() { super(Material.TRIPWIRE_HOOK); } @@ -19,12 +19,12 @@ public class TripwireHook extends MaterialData implements Directional, Redstone public TripwireHook(final int type, final byte data) { super(type, data); } - + public TripwireHook(BlockFace dir) { this(); setFacingDirection(dir); } - + /** * Test if tripwire is connected * @return true if connected, false if not @@ -32,7 +32,7 @@ public class TripwireHook extends MaterialData implements Directional, Redstone public boolean isConnected() { return (getData() & 0x4) != 0; } - + /** * Set tripwire connection state * @param connected - true if connected, false if not @@ -52,7 +52,7 @@ public class TripwireHook extends MaterialData implements Directional, Redstone public boolean isActivated() { return (getData() & 0x8) != 0; } - + /** * Set hook activated state * @param act - true if activated, false if not @@ -64,41 +64,40 @@ public class TripwireHook extends MaterialData implements Directional, Redstone } setData((byte) dat); } - + public void setFacingDirection(BlockFace face) { int dat = getData() & 0xC; switch (face) { - case EAST: - break; - case SOUTH: - dat |= 0x1; - break; - case WEST: - dat |= 0x2; - break; - case NORTH: - dat |= 0x3; - break; - default: - break; + case NORTH: + dat |= 0x1; + break; + case EAST: + dat |= 0x2; + break; + case SOUTH: + dat |= 0x3; + break; + case WEST: + default: + break; } setData((byte) dat); } - public BlockFace getFacing() { + public BlockFace getAttachedFace() { switch (getData() & 0x3) { - case 0: - return BlockFace.EAST; - case 1: - return BlockFace.SOUTH; - case 2: - return BlockFace.WEST; - case 3: - return BlockFace.NORTH; + case 0: + return BlockFace.EAST; + case 1: + return BlockFace.SOUTH; + case 2: + return BlockFace.WEST; + case 3: + return BlockFace.NORTH; } return null; } - + public boolean isPowered() { return isActivated(); }