Fix MaterialData directions being incorrect. Fixes BUKKIT-3160

Prior to 49690f9, BlockFaces were mostly correct in their respective
MaterialData classes. However, a lot of things were not updated since
implementation and broke without being addressed.

This fixes any discrepancies with Block data.

By: feildmaster <admin@feildmaster.com>
This commit is contained in:
Bukkit/Spigot
2012-12-15 23:25:19 -06:00
parent fb2cf30fbe
commit 87f538df31
9 changed files with 130 additions and 103 deletions

View File

@@ -6,7 +6,7 @@ import org.bukkit.block.BlockFace;
/**
* Represents the cocoa plant
*/
public class CocoaPlant extends MaterialData implements Directional {
public class CocoaPlant extends MaterialData implements Directional, Attachable {
public enum CocoaPlantSize {
SMALL,
@@ -71,9 +71,14 @@ public class CocoaPlant extends MaterialData implements Directional {
setData((byte) dat);
}
public BlockFace getAttachedFace() {
return getFacing().getOppositeFace();
}
public void setFacingDirection(BlockFace face) {
int dat = getData() & 0xC;
switch (face) {
default:
case SOUTH:
break;
case WEST:
@@ -85,8 +90,6 @@ public class CocoaPlant extends MaterialData implements Directional {
case EAST:
dat |= 0x3;
break;
default:
break;
}
setData((byte) dat);
}