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

Public Member Functions

 Tree (TreeSpecies species)
 
 Tree (TreeSpecies species, BlockFace dir)
 
 Tree (final int type)
 
 Tree (final Material type)
 
 Tree (final int type, final byte data)
 
 Tree (final Material type, final byte data)
 
TreeSpecies getSpecies ()
 
void setSpecies (TreeSpecies species)
 
BlockFace getDirection ()
 
void setDirection (BlockFace dir)
 
String toString ()
 
Tree 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 the different types of Trees.

Definition at line 10 of file Tree.java.

Constructor & Destructor Documentation

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

Definition at line 31 of file Tree.java.

31  {
32  super(type);
33  }
org.bukkit.material.Tree.Tree ( final int  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 44 of file Tree.java.

44  {
45  super(type, data);
46  }
org.bukkit.material.Tree.Tree ( final Material  type,
final byte  data 
)
Deprecated:
Magic value

Definition at line 53 of file Tree.java.

53  {
54  super(type, data);
55  }

Member Function Documentation

BlockFace org.bukkit.material.Tree.getDirection ( )

Get direction of the log

Returns
one of:
  • BlockFace.TOP for upright (default)
  • BlockFace.NORTH (east-west)
  • BlockFace.WEST (north-south)
  • BlockFace.SELF (directionless)

Definition at line 86 of file Tree.java.

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

86  {
87  switch ((getData() >> 2) & 0x3) {
88  case 0: // Up-down
89  default:
90  return BlockFace.UP;
91  case 1: // North-south
92  return BlockFace.WEST;
93  case 2: // East-west
94  return BlockFace.NORTH;
95  case 3: // Directionless (bark on all sides)
96  return BlockFace.SELF;
97  }
98  }
TreeSpecies org.bukkit.material.Tree.getSpecies ( )

Gets the current species of this tree

Returns
TreeSpecies of this tree

Definition at line 62 of file Tree.java.

References org.bukkit.TreeSpecies.getByData(), and org.bukkit.material.MaterialData.getData().

62  {
63  return TreeSpecies.getByData((byte) (getData() & 0x3));
64  }
void org.bukkit.material.Tree.setDirection ( BlockFace  dir)

Set direction of the log

Parameters
dir- direction of end of log (BlockFace.SELF for no direction)

Definition at line 104 of file Tree.java.

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

104  {
105  int dat;
106  switch (dir) {
107  case UP:
108  case DOWN:
109  default:
110  dat = 0;
111  break;
112  case WEST:
113  case EAST:
114  dat = 1;
115  break;
116  case NORTH:
117  case SOUTH:
118  dat = 2;
119  break;
120  case SELF:
121  dat = 3;
122  break;
123  }
124  setData((byte) ((getData() & 0x3) | (dat << 2)));
125  }
void org.bukkit.material.Tree.setSpecies ( TreeSpecies  species)

Sets the species of this tree

Parameters
speciesNew species of this tree

Definition at line 71 of file Tree.java.

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

71  {
72  setData((byte) ((getData() & 0xC) | species.getData()));
73  }

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