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

Public Member Functions

 Vine (int type, byte data)
 
 Vine (byte data)
 
 Vine (BlockFace...faces)
 
 Vine (EnumSet< BlockFace > faces)
 
boolean isOnFace (BlockFace face)
 
void putOnFace (BlockFace face)
 
void removeFromFace (BlockFace face)
 
String toString ()
 
Vine 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 vine

Definition at line 12 of file Vine.java.

Constructor & Destructor Documentation

org.bukkit.material.Vine.Vine ( int  type,
byte  data 
)
Deprecated:
Magic value

Definition at line 28 of file Vine.java.

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

Definition at line 37 of file Vine.java.

37  {
38  super(Material.VINE, data);
39  }

Member Function Documentation

boolean org.bukkit.material.Vine.isOnFace ( BlockFace  face)

Check if the vine is attached to the specified face of an adjacent block. You can check two faces at once by passing e.g. BlockFace#NORTH_EAST.

Parameters
faceThe face to check.
Returns
Whether it is attached to that face.

Definition at line 78 of file Vine.java.

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

78  {
79  switch (face) {
80  case WEST:
81  return (getData() & VINE_WEST) == VINE_WEST;
82  case NORTH:
83  return (getData() & VINE_NORTH) == VINE_NORTH;
84  case SOUTH:
85  return (getData() & VINE_SOUTH) == VINE_SOUTH;
86  case EAST:
87  return (getData() & VINE_EAST) == VINE_EAST;
88  case NORTH_EAST:
89  return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.NORTH);
90  case NORTH_WEST:
91  return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.NORTH);
92  case SOUTH_EAST:
93  return isOnFace(BlockFace.EAST) && isOnFace(BlockFace.SOUTH);
94  case SOUTH_WEST:
95  return isOnFace(BlockFace.WEST) && isOnFace(BlockFace.SOUTH);
96  case UP: // It's impossible to be accurate with this since it's contextual
97  return true;
98  default:
99  return false;
100  }
101  }
boolean isOnFace(BlockFace face)
Definition: Vine.java:78
void org.bukkit.material.Vine.putOnFace ( BlockFace  face)

Attach the vine to the specified face of an adjacent block.

Parameters
faceThe face to attach.

Definition at line 108 of file Vine.java.

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

108  {
109  switch(face) {
110  case WEST:
111  setData((byte) (getData() | VINE_WEST));
112  break;
113  case NORTH:
114  setData((byte) (getData() | VINE_NORTH));
115  break;
116  case SOUTH:
117  setData((byte) (getData() | VINE_SOUTH));
118  break;
119  case EAST:
120  setData((byte) (getData() | VINE_EAST));
121  break;
122  case NORTH_WEST:
123  putOnFace(BlockFace.WEST);
124  putOnFace(BlockFace.NORTH);
125  break;
126  case SOUTH_WEST:
127  putOnFace(BlockFace.WEST);
128  putOnFace(BlockFace.SOUTH);
129  break;
130  case NORTH_EAST:
131  putOnFace(BlockFace.EAST);
132  putOnFace(BlockFace.NORTH);
133  break;
134  case SOUTH_EAST:
135  putOnFace(BlockFace.EAST);
136  putOnFace(BlockFace.SOUTH);
137  break;
138  case UP:
139  break;
140  default:
141  throw new IllegalArgumentException("Vines can't go on face " + face.toString());
142  }
143  }
void putOnFace(BlockFace face)
Definition: Vine.java:108
void org.bukkit.material.Vine.removeFromFace ( BlockFace  face)

Detach the vine from the specified face of an adjacent block.

Parameters
faceThe face to detach.

Definition at line 150 of file Vine.java.

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

150  {
151  switch(face) {
152  case WEST:
153  setData((byte) (getData() & ~VINE_WEST));
154  break;
155  case NORTH:
156  setData((byte) (getData() & ~VINE_NORTH));
157  break;
158  case SOUTH:
159  setData((byte) (getData() & ~VINE_SOUTH));
160  break;
161  case EAST:
162  setData((byte) (getData() & ~VINE_EAST));
163  break;
164  case NORTH_WEST:
165  removeFromFace(BlockFace.WEST);
166  removeFromFace(BlockFace.NORTH);
167  break;
168  case SOUTH_WEST:
169  removeFromFace(BlockFace.WEST);
170  removeFromFace(BlockFace.SOUTH);
171  break;
172  case NORTH_EAST:
173  removeFromFace(BlockFace.EAST);
174  removeFromFace(BlockFace.NORTH);
175  break;
176  case SOUTH_EAST:
177  removeFromFace(BlockFace.EAST);
178  removeFromFace(BlockFace.SOUTH);
179  break;
180  case UP:
181  break;
182  default:
183  throw new IllegalArgumentException("Vines can't go on face " + face.toString());
184  }
185  }
void removeFromFace(BlockFace face)
Definition: Vine.java:150

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