| 4 | import org.bukkit.block.BlockFace; |
| 5 | |
| 6 | public class Diode extends MaterialData implements Directional { |
| 7 | public Diode() { |
| 8 | super(Material.DIODE_BLOCK_ON); |
| 9 | } |
| 10 | |
| 11 | public Diode(int type) { |
| 12 | super(type); |
| 13 | } |
| 14 | |
| 15 | public Diode(Material type) { |
| 16 | super(type); |
| 17 | } |
| 18 | |
| 19 | public Diode(int type, byte data) { |
| 20 | super(type, data); |
| 21 | } |
| 22 | |
| 23 | public Diode(Material type, byte data) { |
| 24 | super(type, data); |
| 25 | } |
| 26 | |
| 27 | /** |
| 28 | * Sets the delay of the repeater |
| 29 | * |
| 30 | * @param delay |
| 31 | * The new delay (1-4) |
| 32 | */ |
| 33 | public void setDelay(int delay) { |
| 34 | if (delay > 4) { |
| 35 | delay = 4; |
| 36 | } |
| 37 | if (delay < 1) { |
| 38 | delay = 1; |
| 39 | } |
| 40 | byte newData = (byte) (getData() & 0x3); |
| 41 | |
| 42 | setData((byte) (newData | ((delay - 1) << 2))); |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * Gets the delay of the repeater in ticks |
| 47 | * |
| 48 | * @return The delay (1-4) |
| 49 | */ |
| 50 | public int getDelay() { |
| 51 | return (getData() >> 2) + 1; |
| 52 | } |
| 53 | |
| 54 | public void setFacingDirection(BlockFace face) { |
| 55 | int delay = getDelay(); |
| 56 | byte data; |
| 57 | |
| 58 | switch (face) { |
| 59 | case SOUTH: |
| 60 | data = 0x1; |
| 61 | break; |
| 62 | |
| 63 | case WEST: |
nothing calls this directly
no outgoing calls
no test coverage detected