Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.material.Diode Class Reference
Inheritance diagram for org.bukkit.material.Diode:
org.bukkit.material.MaterialData org.bukkit.material.Directional

Public Member Functions

 Diode (int type)
 
 Diode (Material type)
 
 Diode (int type, byte data)
 
 Diode (Material type, byte data)
 
void setDelay (int delay)
 
int getDelay ()
 
void setFacingDirection (BlockFace face)
 
BlockFace getFacing ()
 
String toString ()
 
Diode clone ()
 
- Public Member Functions inherited from org.bukkit.material.MaterialData
 MaterialData (final int type)
 
 MaterialData (final Material type)
 
 MaterialData (final int type, final byte data)
 
 MaterialData (final Material type, final byte data)
 
byte getData ()
 
void setData (byte data)
 
Material getItemType ()
 
int getItemTypeId ()
 
ItemStack toItemStack ()
 
ItemStack toItemStack (int amount)
 
String toString ()
 
int hashCode ()
 
boolean equals (Object obj)
 
MaterialData clone ()
 

Detailed Description

Definition at line 6 of file Diode.java.

Constructor & Destructor Documentation

org.bukkit.material.Diode.Diode ( int  type)
Deprecated:
Magic value

Definition at line 16 of file Diode.java.

16  {
17  super(type);
18  }
org.bukkit.material.Diode.Diode ( int  type,
byte  data 
)
Deprecated:
Magic value

Definition at line 29 of file Diode.java.

29  {
30  super(type, data);
31  }
org.bukkit.material.Diode.Diode ( Material  type,
byte  data 
)
Deprecated:
Magic value

Definition at line 38 of file Diode.java.

38  {
39  super(type, data);
40  }

Member Function Documentation

int org.bukkit.material.Diode.getDelay ( )

Gets the delay of the repeater in ticks

Returns
The delay (1-4)

Definition at line 65 of file Diode.java.

References org.bukkit.material.MaterialData.getData().

Referenced by org.bukkit.material.Diode.setFacingDirection().

65  {
66  return (getData() >> 2) + 1;
67  }
BlockFace org.bukkit.material.Diode.getFacing ( )

Gets the direction this block is facing

Returns
the direction this block is facing

Implements org.bukkit.material.Directional.

Definition at line 95 of file Diode.java.

References org.bukkit.material.MaterialData.getData().

95  {
96  byte data = (byte) (getData() & 0x3);
97 
98  switch (data) {
99  case 0x0:
100  default:
101  return BlockFace.NORTH;
102 
103  case 0x1:
104  return BlockFace.EAST;
105 
106  case 0x2:
107  return BlockFace.SOUTH;
108 
109  case 0x3:
110  return BlockFace.WEST;
111  }
112  }
void org.bukkit.material.Diode.setDelay ( int  delay)

Sets the delay of the repeater

Parameters
delayThe new delay (1-4)

Definition at line 48 of file Diode.java.

References org.bukkit.material.MaterialData.getData(), and org.bukkit.material.MaterialData.setData().

Referenced by org.bukkit.material.Diode.setFacingDirection().

48  {
49  if (delay > 4) {
50  delay = 4;
51  }
52  if (delay < 1) {
53  delay = 1;
54  }
55  byte newData = (byte) (getData() & 0x3);
56 
57  setData((byte) (newData | ((delay - 1) << 2)));
58  }
void org.bukkit.material.Diode.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 69 of file Diode.java.

References org.bukkit.material.Diode.getDelay(), org.bukkit.material.MaterialData.setData(), and org.bukkit.material.Diode.setDelay().

69  {
70  int delay = getDelay();
71  byte data;
72 
73  switch (face) {
74  case EAST:
75  data = 0x1;
76  break;
77 
78  case SOUTH:
79  data = 0x2;
80  break;
81 
82  case WEST:
83  data = 0x3;
84  break;
85 
86  case NORTH:
87  default:
88  data = 0x0;
89  }
90 
91  setData(data);
92  setDelay(delay);
93  }
void setDelay(int delay)
Definition: Diode.java:48

The documentation for this class was generated from the following file: