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

Public Member Functions

 PistonBaseMaterial (final int type)
 
 PistonBaseMaterial (final Material type)
 
 PistonBaseMaterial (final int type, final byte data)
 
 PistonBaseMaterial (final Material type, final byte data)
 
void setFacingDirection (BlockFace face)
 
BlockFace getFacing ()
 
boolean isPowered ()
 
void setPowered (boolean powered)
 
boolean isSticky ()
 
PistonBaseMaterial 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

Material data for the piston base block

Definition at line 9 of file PistonBaseMaterial.java.

Constructor & Destructor Documentation

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

Definition at line 15 of file PistonBaseMaterial.java.

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

Definition at line 28 of file PistonBaseMaterial.java.

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

Definition at line 37 of file PistonBaseMaterial.java.

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

Member Function Documentation

BlockFace org.bukkit.material.PistonBaseMaterial.getFacing ( )

Gets the direction this block is facing

Returns
the direction this block is facing

Implements org.bukkit.material.Directional.

Definition at line 64 of file PistonBaseMaterial.java.

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

64  {
65  byte dir = (byte) (getData() & 7);
66 
67  switch (dir) {
68  case 0:
69  return BlockFace.DOWN;
70  case 1:
71  return BlockFace.UP;
72  case 2:
73  return BlockFace.NORTH;
74  case 3:
75  return BlockFace.SOUTH;
76  case 4:
77  return BlockFace.WEST;
78  case 5:
79  return BlockFace.EAST;
80  default:
81  return BlockFace.SELF;
82  }
83  }
boolean org.bukkit.material.PistonBaseMaterial.isPowered ( )

Gets the current state of this Material, indicating if it's powered or unpowered

Returns
true if powered, otherwise false

Implements org.bukkit.material.Redstone.

Definition at line 85 of file PistonBaseMaterial.java.

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

85  {
86  return (getData() & 0x8) == 0x8;
87  }
boolean org.bukkit.material.PistonBaseMaterial.isSticky ( )

Checks if this piston base is sticky, and returns true if so

Returns
true if this piston is "sticky", or false

Definition at line 103 of file PistonBaseMaterial.java.

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

103  {
104  return this.getItemType() == Material.PISTON_STICKY_BASE;
105  }
void org.bukkit.material.PistonBaseMaterial.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 41 of file PistonBaseMaterial.java.

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

41  {
42  byte data = (byte) (getData() & 0x8);
43 
44  switch (face) {
45  case UP:
46  data |= 1;
47  break;
48  case NORTH:
49  data |= 2;
50  break;
51  case SOUTH:
52  data |= 3;
53  break;
54  case WEST:
55  data |= 4;
56  break;
57  case EAST:
58  data |= 5;
59  break;
60  }
61  setData(data);
62  }
void org.bukkit.material.PistonBaseMaterial.setPowered ( boolean  powered)

Sets the current state of this piston

Parameters
poweredtrue if the piston is extended & powered, or false

Definition at line 94 of file PistonBaseMaterial.java.

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

94  {
95  setData((byte) (powered ? (getData() | 0x8) : (getData() & ~0x8)));
96  }

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