Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
org.bukkit.material.Rails Class Reference
Inheritance diagram for org.bukkit.material.Rails:
org.bukkit.material.MaterialData org.bukkit.material.ExtendedRails org.bukkit.material.DetectorRail org.bukkit.material.PoweredRail

Public Member Functions

 Rails (final int type)
 
 Rails (final Material type)
 
 Rails (final int type, final byte data)
 
 Rails (final Material type, final byte data)
 
boolean isOnSlope ()
 
boolean isCurve ()
 
BlockFace getDirection ()
 
String toString ()
 
void setDirection (BlockFace face, boolean isOnSlope)
 
Rails 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 ()
 

Protected Member Functions

byte getConvertedData ()
 

Detailed Description

Represents minecart rails.

Definition at line 9 of file Rails.java.

Constructor & Destructor Documentation

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

Definition at line 20 of file Rails.java.

20  {
21  super(type);
22  }
org.bukkit.material.Rails.Rails ( final int  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 33 of file Rails.java.

33  {
34  super(type, data);
35  }
org.bukkit.material.Rails.Rails ( final Material  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 42 of file Rails.java.

42  {
43  super(type, data);
44  }

Member Function Documentation

byte org.bukkit.material.Rails.getConvertedData ( )
protected

Return the data without the extended properties used by PoweredRail and DetectorRail. Overridden in ExtendedRails

Returns
the data without the extended part
Deprecated:
Magic value

Definition at line 122 of file Rails.java.

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

Referenced by org.bukkit.material.Rails.getDirection(), org.bukkit.material.Rails.isCurve(), and org.bukkit.material.Rails.isOnSlope().

122  {
123  return getData();
124  }
BlockFace org.bukkit.material.Rails.getDirection ( )
Returns
the direction these tracks are set

Note that tracks are bidirectional and that the direction returned is the ascending direction if the track is set on a slope. If it is set as a curve, the corner of the track is returned.

Definition at line 71 of file Rails.java.

References org.bukkit.material.Rails.getConvertedData().

71  {
72  byte d = getConvertedData();
73 
74  switch (d) {
75  case 0x0:
76  default:
77  return BlockFace.SOUTH;
78 
79  case 0x1:
80  return BlockFace.EAST;
81 
82  case 0x2:
83  return BlockFace.EAST;
84 
85  case 0x3:
86  return BlockFace.WEST;
87 
88  case 0x4:
89  return BlockFace.NORTH;
90 
91  case 0x5:
92  return BlockFace.SOUTH;
93 
94  case 0x6:
95  return BlockFace.NORTH_WEST;
96 
97  case 0x7:
98  return BlockFace.NORTH_EAST;
99 
100  case 0x8:
101  return BlockFace.SOUTH_EAST;
102 
103  case 0x9:
104  return BlockFace.SOUTH_WEST;
105  }
106  }
boolean org.bukkit.material.Rails.isCurve ( )
Returns
the whether this track is set as a curve

Definition at line 58 of file Rails.java.

References org.bukkit.material.Rails.getConvertedData().

58  {
59  byte d = getConvertedData();
60 
61  return (d == 0x6 || d == 0x7 || d == 0x8 || d == 0x9);
62  }
boolean org.bukkit.material.Rails.isOnSlope ( )
Returns
the whether this track is set on a slope

Definition at line 49 of file Rails.java.

References org.bukkit.material.Rails.getConvertedData().

49  {
50  byte d = getConvertedData();
51 
52  return (d == 0x2 || d == 0x3 || d == 0x4 || d == 0x5);
53  }
void org.bukkit.material.Rails.setDirection ( BlockFace  face,
boolean  isOnSlope 
)

Set the direction of these tracks

Note that tracks are bidirectional and that the direction returned is the ascending direction if the track is set on a slope. If it is set as a curve, the corner of the track should be supplied.

Parameters
facethe direction the track should be facing
isOnSlopewhether or not the track should be on a slope

Definition at line 136 of file Rails.java.

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

136  {
137  switch (face) {
138  case EAST:
139  setData((byte) (isOnSlope ? 0x2 : 0x1));
140  break;
141 
142  case WEST:
143  setData((byte) (isOnSlope ? 0x3 : 0x1));
144  break;
145 
146  case NORTH:
147  setData((byte) (isOnSlope ? 0x4 : 0x0));
148  break;
149 
150  case SOUTH:
151  setData((byte) (isOnSlope ? 0x5 : 0x0));
152  break;
153 
154  case NORTH_WEST:
155  setData((byte) 0x6);
156  break;
157 
158  case NORTH_EAST:
159  setData((byte) 0x7);
160  break;
161 
162  case SOUTH_EAST:
163  setData((byte) 0x8);
164  break;
165 
166  case SOUTH_WEST:
167  setData((byte) 0x9);
168  break;
169  }
170  }

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