Added Ladder MaterialData

By: Dinnerbone <dinnerbone@dinnerbone.com>
This commit is contained in:
Bukkit/Spigot 2011-01-15 20:45:24 +00:00
parent 3d5303ef55
commit c8183cbb22
2 changed files with 49 additions and 1 deletions

View file

@ -67,7 +67,7 @@ public enum Material {
BURNING_FURNACE(62),
SIGN_POST(63),
WOODEN_DOOR(64),
LADDER(65),
LADDER(65, Ladder.class),
RAILS(66),
COBBLESTONE_STAIRS(67),
WALL_SIGN(68),

View file

@ -0,0 +1,48 @@
package org.bukkit.material;
import org.bukkit.BlockFace;
import org.bukkit.Material;
/**
* Represents Ladder data
*/
public class Ladder extends MaterialData implements Attachable {
public Ladder(final int type) {
super(type);
}
public Ladder(final Material type) {
super(type);
}
public Ladder(final int type, final byte data) {
super(type, data);
}
public Ladder(final Material type, final byte data) {
super(type, data);
}
/**
* Gets the face that this block is attached on
*
* @return BlockFace attached to
*/
public BlockFace getAttachedFace() {
byte data = getData();
switch (data) {
case 0x2:
return BlockFace.WEST;
case 0x3:
return BlockFace.EAST;
case 0x4:
return BlockFace.SOUTH;
case 0x5:
return BlockFace.NORTH;
}
return null;
}
}