Ton of Material extensions handling the meta-data of blocks.
By: sunkid <sunkid@iminurnetz.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
|
||||
package org.bukkit.material;
|
||||
|
||||
import org.bukkit.block.BlockFace;
|
||||
@@ -7,7 +6,11 @@ import org.bukkit.Material;
|
||||
/**
|
||||
* Represents Ladder data
|
||||
*/
|
||||
public class Ladder extends MaterialData implements Attachable {
|
||||
public class Ladder extends SimpleAttachableMaterialData {
|
||||
public Ladder() {
|
||||
super(Material.LADDER);
|
||||
}
|
||||
|
||||
public Ladder(final int type) {
|
||||
super(type);
|
||||
}
|
||||
@@ -26,23 +29,48 @@ public class Ladder extends MaterialData implements Attachable {
|
||||
|
||||
/**
|
||||
* 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;
|
||||
case 0x2:
|
||||
return BlockFace.WEST;
|
||||
case 0x3:
|
||||
return BlockFace.EAST;
|
||||
case 0x4:
|
||||
return BlockFace.SOUTH;
|
||||
case 0x5:
|
||||
return BlockFace.NORTH;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the direction this ladder is facing
|
||||
*/
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
byte data = (byte) 0x0;
|
||||
|
||||
switch (face) {
|
||||
case WEST:
|
||||
data = 0x2;
|
||||
break;
|
||||
case EAST:
|
||||
data = 0x3;
|
||||
break;
|
||||
case SOUTH:
|
||||
data = 0x4;
|
||||
break;
|
||||
case NORTH:
|
||||
data = 0x5;
|
||||
break;
|
||||
}
|
||||
|
||||
setData(data);
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user