Package org.bukkit.material
Class Diode
- java.lang.Object
-
- org.bukkit.material.MaterialData
-
- org.bukkit.material.Diode
-
- All Implemented Interfaces:
Cloneable,Directional,Redstone
public class Diode extends MaterialData implements Directional, Redstone
Represents a diode/repeater in the on or off state, with a delay and facing in a specific direction.
-
-
Field Summary
Fields Modifier and Type Field Description protected static intDEFAULT_DELAYprotected static BlockFaceDEFAULT_DIRECTIONprotected static booleanDEFAULT_STATE
-
Constructor Summary
Constructors Constructor Description Diode()Constructs a diode switched on, with a delay of 1 and facing the default direction (north).Diode(BlockFace facingDirection)Constructs a diode switched off, with a delay of 1 and facing the specified direction.Diode(BlockFace facingDirection, int delay)Constructs a diode switched off, with the specified delay and facing the specified direction.Diode(BlockFace facingDirection, int delay, boolean state)Constructs a diode switched on or off, with the specified delay and facing the specified direction.Diode(Material type)Diode(Material type, byte data)Deprecated.Magic value
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Diodeclone()intgetDelay()Gets the delay of the repeater in ticks.BlockFacegetFacing()Gets the direction this diode is facingbooleanisPowered()Checks if the diode is powered.voidsetDelay(int delay)Sets the delay of the repeater.voidsetFacingDirection(BlockFace face)Sets the direction this diode is facing.StringtoString()-
Methods inherited from class org.bukkit.material.MaterialData
equals, getData, getItemType, hashCode, setData, toItemStack, toItemStack
-
-
-
-
Field Detail
-
DEFAULT_DIRECTION
protected static final BlockFace DEFAULT_DIRECTION
-
DEFAULT_DELAY
protected static final int DEFAULT_DELAY
- See Also:
- Constant Field Values
-
DEFAULT_STATE
protected static final boolean DEFAULT_STATE
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
Diode
public Diode()
Constructs a diode switched on, with a delay of 1 and facing the default direction (north). By default this constructor creates a diode that is switched on for backwards compatibility with past implementations.
-
Diode
public Diode(BlockFace facingDirection)
Constructs a diode switched off, with a delay of 1 and facing the specified direction.- Parameters:
facingDirection- the direction the diode is facing- See Also:
BlockFace
-
Diode
public Diode(BlockFace facingDirection, int delay)
Constructs a diode switched off, with the specified delay and facing the specified direction.- Parameters:
facingDirection- the direction the diode is facingdelay- The number of ticks (1-4) before the diode turns on after being powered- See Also:
BlockFace
-
Diode
public Diode(BlockFace facingDirection, int delay, boolean state)
Constructs a diode switched on or off, with the specified delay and facing the specified direction.- Parameters:
facingDirection- the direction the diode is facingdelay- The number of ticks (1-4) before the diode turns on after being poweredstate- True if the diode is in the on state- See Also:
BlockFace
-
Diode
public Diode(Material type)
-
Diode
@Deprecated public Diode(Material type, byte data)
Deprecated.Magic value- Parameters:
type- the typedata- the raw data value
-
-
Method Detail
-
setDelay
public void setDelay(int delay)
Sets the delay of the repeater.- Parameters:
delay- The new delay (1-4)
-
getDelay
public int getDelay()
Gets the delay of the repeater in ticks.- Returns:
- The delay (1-4)
-
setFacingDirection
public void setFacingDirection(BlockFace face)
Sets the direction this diode is facing.- Specified by:
setFacingDirectionin interfaceDirectional- Parameters:
face- The direction to set this diode to- See Also:
BlockFace
-
getFacing
public BlockFace getFacing()
Gets the direction this diode is facing- Specified by:
getFacingin interfaceDirectional- Returns:
- The direction this diode is facing
- See Also:
BlockFace
-
toString
public String toString()
- Overrides:
toStringin classMaterialData
-
clone
public Diode clone()
- Overrides:
clonein classMaterialData
-
-