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

Classes

enum  CocoaPlantSize
 

Public Member Functions

 CocoaPlant (final int type)
 
 CocoaPlant (final int type, final byte data)
 
 CocoaPlant (CocoaPlantSize sz)
 
 CocoaPlant (CocoaPlantSize sz, BlockFace dir)
 
CocoaPlantSize getSize ()
 
void setSize (CocoaPlantSize sz)
 
BlockFace getAttachedFace ()
 
void setFacingDirection (BlockFace face)
 
BlockFace getFacing ()
 
CocoaPlant clone ()
 
String toString ()
 
- 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 the cocoa plant

Definition at line 9 of file CocoaPlant.java.

Constructor & Destructor Documentation

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

Definition at line 26 of file CocoaPlant.java.

26  {
27  super(type);
28  }
org.bukkit.material.CocoaPlant.CocoaPlant ( final int  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 35 of file CocoaPlant.java.

35  {
36  super(type, data);
37  }

Member Function Documentation

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

Gets the face that this block is attached on

Returns
BlockFace attached to

Implements org.bukkit.material.Attachable.

Definition at line 86 of file CocoaPlant.java.

References org.bukkit.material.CocoaPlant.getFacing().

86  {
87  return getFacing().getOppositeFace();
88  }
BlockFace org.bukkit.material.CocoaPlant.getFacing ( )

Gets the direction this block is facing

Returns
the direction this block is facing

Implements org.bukkit.material.Directional.

Definition at line 109 of file CocoaPlant.java.

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

Referenced by org.bukkit.material.CocoaPlant.getAttachedFace().

109  {
110  switch (getData() & 0x3) {
111  case 0:
112  return BlockFace.SOUTH;
113  case 1:
114  return BlockFace.WEST;
115  case 2:
116  return BlockFace.NORTH;
117  case 3:
118  return BlockFace.EAST;
119  }
120  return null;
121  }
CocoaPlantSize org.bukkit.material.CocoaPlant.getSize ( )

Get size of plant

Returns
size

Definition at line 55 of file CocoaPlant.java.

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

55  {
56  switch (getData() & 0xC) {
57  case 0:
58  return CocoaPlantSize.SMALL;
59  case 4:
60  return CocoaPlantSize.MEDIUM;
61  default:
62  return CocoaPlantSize.LARGE;
63  }
64  }
void org.bukkit.material.CocoaPlant.setFacingDirection ( BlockFace  face)

Sets the direction that this block is facing in

Parameters
faceThe facing direction

Implements org.bukkit.material.Directional.

Definition at line 90 of file CocoaPlant.java.

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

90  {
91  int dat = getData() & 0xC;
92  switch (face) {
93  default:
94  case SOUTH:
95  break;
96  case WEST:
97  dat |= 0x1;
98  break;
99  case NORTH:
100  dat |= 0x2;
101  break;
102  case EAST:
103  dat |= 0x3;
104  break;
105  }
106  setData((byte) dat);
107  }
void org.bukkit.material.CocoaPlant.setSize ( CocoaPlantSize  sz)

Set size of plant

Parameters
sz- size of plant

Definition at line 71 of file CocoaPlant.java.

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

71  {
72  int dat = getData() & 0x3;
73  switch (sz) {
74  case SMALL:
75  break;
76  case MEDIUM:
77  dat |= 0x4;
78  break;
79  case LARGE:
80  dat |= 0x8;
81  break;
82  }
83  setData((byte) dat);
84  }

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