[BREAKING] Update BlockFace directions. Fixes BUKKIT-1567, BUKKIT-3069
If you use BlockFace in any way, to compensate the directionals being incorrect, you can still have backwards compatibility if you add in the handling in your plugin: boolean legacyBlockFace = BlockFace.NORTH().getModX() == -1; (and then handle it accordingly) If you didn't special case your directions to fix what's being fixed here... Hurray! Your plugin should now work. By: feildmaster <admin@feildmaster.com>
This commit is contained in:
@@ -13,7 +13,7 @@ public class CocoaPlant extends MaterialData implements Directional {
|
||||
MEDIUM,
|
||||
LARGE
|
||||
}
|
||||
|
||||
|
||||
public CocoaPlant() {
|
||||
super(Material.COCOA);
|
||||
}
|
||||
@@ -51,7 +51,7 @@ public class CocoaPlant extends MaterialData implements Directional {
|
||||
return CocoaPlantSize.LARGE;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Set size of plant
|
||||
* @param sz - size of plant
|
||||
@@ -70,19 +70,19 @@ public class CocoaPlant extends MaterialData implements Directional {
|
||||
}
|
||||
setData((byte) dat);
|
||||
}
|
||||
|
||||
|
||||
public void setFacingDirection(BlockFace face) {
|
||||
int dat = getData() & 0xC;
|
||||
switch (face) {
|
||||
case WEST:
|
||||
case SOUTH:
|
||||
break;
|
||||
case NORTH:
|
||||
case WEST:
|
||||
dat |= 0x1;
|
||||
break;
|
||||
case EAST:
|
||||
case NORTH:
|
||||
dat |= 0x2;
|
||||
break;
|
||||
case SOUTH:
|
||||
case EAST:
|
||||
dat |= 0x3;
|
||||
break;
|
||||
default:
|
||||
@@ -94,17 +94,17 @@ public class CocoaPlant extends MaterialData implements Directional {
|
||||
public BlockFace getFacing() {
|
||||
switch (getData() & 0x3) {
|
||||
case 0:
|
||||
return BlockFace.WEST;
|
||||
case 1:
|
||||
return BlockFace.NORTH;
|
||||
case 2:
|
||||
return BlockFace.EAST;
|
||||
case 3:
|
||||
return BlockFace.SOUTH;
|
||||
case 1:
|
||||
return BlockFace.WEST;
|
||||
case 2:
|
||||
return BlockFace.NORTH;
|
||||
case 3:
|
||||
return BlockFace.EAST;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public CocoaPlant clone() {
|
||||
return (CocoaPlant) super.clone();
|
||||
|
||||
Reference in New Issue
Block a user