diff options
author | Travis Watkins <amaranth@ubuntu.com> | 2013-04-12 16:20:50 -0500 |
---|---|---|
committer | Travis Watkins <amaranth@ubuntu.com> | 2013-04-12 16:20:50 -0500 |
commit | 7d8585ee47fe531356a484ec256320144edaa717 (patch) | |
tree | 27951cdc3532230e266bad8b65196b056a3f2bc8 /src/main | |
parent | d5b5f84f0c9684e6729bdac28384614a6bab75b6 (diff) | |
download | bukkit-7d8585ee47fe531356a484ec256320144edaa717.tar bukkit-7d8585ee47fe531356a484ec256320144edaa717.tar.gz bukkit-7d8585ee47fe531356a484ec256320144edaa717.tar.lz bukkit-7d8585ee47fe531356a484ec256320144edaa717.tar.xz bukkit-7d8585ee47fe531356a484ec256320144edaa717.zip |
Correct 1.5 material data. Fixes BUKKIT-4004, BUKKIT-3785
Diffstat (limited to 'src/main')
-rw-r--r-- | src/main/java/org/bukkit/Material.java | 4 | ||||
-rw-r--r-- | src/main/java/org/bukkit/material/Dispenser.java | 57 |
2 files changed, 59 insertions, 2 deletions
diff --git a/src/main/java/org/bukkit/Material.java b/src/main/java/org/bukkit/Material.java index b2d13ec7..6fb6bb4a 100644 --- a/src/main/java/org/bukkit/Material.java +++ b/src/main/java/org/bukkit/Material.java @@ -220,8 +220,8 @@ public enum Material { HOPPER(154), QUARTZ_BLOCK(155), QUARTZ_STAIRS(156, Stairs.class), - ACTIVATOR_RAIL(157), - DROPPER(158, DirectionalContainer.class), + ACTIVATOR_RAIL(157, PoweredRail.class), + DROPPER(158, Dispenser.class), // ----- Item Separator ----- IRON_SPADE(256, 1, 250), IRON_PICKAXE(257, 1, 250), diff --git a/src/main/java/org/bukkit/material/Dispenser.java b/src/main/java/org/bukkit/material/Dispenser.java index 4168d88a..34228827 100644 --- a/src/main/java/org/bukkit/material/Dispenser.java +++ b/src/main/java/org/bukkit/material/Dispenser.java @@ -33,6 +33,63 @@ public class Dispenser extends FurnaceAndDispenser { super(type, data); } + public void setFacingDirection(BlockFace face) { + byte data; + + switch (face) { + case DOWN: + data = 0x0; + break; + + case UP: + data = 0x1; + break; + + case NORTH: + data = 0x2; + break; + + case SOUTH: + data = 0x3; + break; + + case WEST: + data = 0x4; + break; + + case EAST: + default: + data = 0x5; + } + + setData(data); + } + + public BlockFace getFacing() { + int data = getData() & 0x7; + + switch (data) { + case 0x0: + return BlockFace.DOWN; + + case 0x1: + return BlockFace.UP; + + case 0x2: + return BlockFace.NORTH; + + case 0x3: + return BlockFace.SOUTH; + + case 0x4: + return BlockFace.WEST; + + case 0x5: + default: + return BlockFace.EAST; + } + } + @Override public Dispenser clone() { return (Dispenser) super.clone(); |