Bukkit-API  1.7.9-R0.2
The inofficial Bukkit-API
ExtendedRails.java
1 package org.bukkit.material;
2 
3 import org.bukkit.Material;
5 
6 /**
7  * This is the superclass for the {@link DetectorRail} and {@link PoweredRail}
8  * classes
9  */
10 public class ExtendedRails extends Rails {
11  /**
12  *
13  * @deprecated Magic value
14  */
15  @Deprecated
16  public ExtendedRails(final int type) {
17  super(type);
18  }
19 
20  public ExtendedRails(final Material type) {
21  super(type);
22  }
23 
24  /**
25  *
26  * @deprecated Magic value
27  */
28  @Deprecated
29  public ExtendedRails(final int type, final byte data) {
30  super(type, data);
31  }
32 
33  /**
34  *
35  * @deprecated Magic value
36  */
37  @Deprecated
38  public ExtendedRails(final Material type, final byte data) {
39  super(type, data);
40  }
41 
42  @Override
43  public boolean isCurve() {
44  return false;
45  }
46 
47  /**
48  *
49  * @deprecated Magic value
50  */
51  @Deprecated
52  @Override
53  protected byte getConvertedData() {
54  return (byte) (getData() & 0x7);
55  }
56 
57  @Override
58  public void setDirection(BlockFace face, boolean isOnSlope) {
59  boolean extraBitSet = (getData() & 0x8) == 0x8;
60 
61  if (face != BlockFace.WEST && face != BlockFace.EAST && face != BlockFace.NORTH && face != BlockFace.SOUTH) {
62  throw new IllegalArgumentException("Detector rails and powered rails cannot be set on a curve!");
63  }
64 
65  super.setDirection(face, isOnSlope);
66  setData((byte) (extraBitSet ? (getData() | 0x8) : (getData() & ~0x8)));
67  }
68 
69  @Override
70  public ExtendedRails clone() {
71  return (ExtendedRails) super.clone();
72  }
73 }
ExtendedRails(final Material type, final byte data)
ExtendedRails(final int type, final byte data)