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

Public Member Functions

 TrapDoor (final int type)
 
 TrapDoor (final Material type)
 
 TrapDoor (final int type, final byte data)
 
 TrapDoor (final Material type, final byte data)
 
boolean isOpen ()
 
void setOpen (boolean isOpen)
 
boolean isInverted ()
 
void setInverted (boolean inv)
 
BlockFace getAttachedFace ()
 
void setFacingDirection (BlockFace face)
 
String toString ()
 
TrapDoor clone ()
 
- Public Member Functions inherited from org.bukkit.material.SimpleAttachableMaterialData
 SimpleAttachableMaterialData (int type)
 
 SimpleAttachableMaterialData (int type, BlockFace direction)
 
 SimpleAttachableMaterialData (Material type, BlockFace direction)
 
 SimpleAttachableMaterialData (Material type)
 
 SimpleAttachableMaterialData (int type, byte data)
 
 SimpleAttachableMaterialData (Material type, byte data)
 
BlockFace getFacing ()
 
String toString ()
 
SimpleAttachableMaterialData 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

Represents a trap door

Definition at line 9 of file TrapDoor.java.

Constructor & Destructor Documentation

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

Definition at line 19 of file TrapDoor.java.

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

Definition at line 32 of file TrapDoor.java.

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

Definition at line 41 of file TrapDoor.java.

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

Member Function Documentation

BlockFace org.bukkit.material.TrapDoor.getAttachedFace ( )

Gets the face that this block is attached on

Returns
BlockFace attached to

Implements org.bukkit.material.Attachable.

Definition at line 83 of file TrapDoor.java.

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

83  {
84  byte data = (byte) (getData() & 0x3);
85 
86  switch (data) {
87  case 0x0:
88  return BlockFace.SOUTH;
89 
90  case 0x1:
91  return BlockFace.NORTH;
92 
93  case 0x2:
94  return BlockFace.EAST;
95 
96  case 0x3:
97  return BlockFace.WEST;
98  }
99 
100  return null;
101 
102  }
boolean org.bukkit.material.TrapDoor.isInverted ( )

Test if trapdoor is inverted

Returns
true if inverted (top half), false if normal (bottom half)

Definition at line 66 of file TrapDoor.java.

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

66  {
67  return ((getData() & 0x8) != 0);
68  }
boolean org.bukkit.material.TrapDoor.isOpen ( )

Check to see if the door is open.

Returns
true if the door has swung counterclockwise around its hinge.

Implements org.bukkit.material.Openable.

Definition at line 45 of file TrapDoor.java.

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

45  {
46  return ((getData() & 0x4) == 0x4);
47  }
void org.bukkit.material.TrapDoor.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 104 of file TrapDoor.java.

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

104  {
105  byte data = (byte) (getData() & 0xC);
106 
107  switch (face) {
108  case SOUTH:
109  data |= 0x1;
110  break;
111  case WEST:
112  data |= 0x2;
113  break;
114  case EAST:
115  data |= 0x3;
116  break;
117  }
118 
119  setData(data);
120  }
void org.bukkit.material.TrapDoor.setInverted ( boolean  inv)

Set trapdoor inverted state

Parameters
inv- true if inverted (top half), false if normal (bottom half)

Definition at line 75 of file TrapDoor.java.

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

75  {
76  int dat = getData() & 0x7;
77  if (inv) {
78  dat |= 0x8;
79  }
80  setData((byte) dat);
81  }
void org.bukkit.material.TrapDoor.setOpen ( boolean  isOpen)

Configure this door to be either open or closed;

Parameters
isOpenTrue to open the door.

Implements org.bukkit.material.Openable.

Definition at line 49 of file TrapDoor.java.

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

49  {
50  byte data = getData();
51 
52  if (isOpen) {
53  data |= 0x4;
54  } else {
55  data &= ~0x4;
56  }
57 
58  setData(data);
59  }

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