711f3f1007
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>
79 lines
1.5 KiB
Java
79 lines
1.5 KiB
Java
package org.bukkit.material;
|
|
|
|
import org.bukkit.Material;
|
|
import org.bukkit.block.BlockFace;
|
|
|
|
/**
|
|
* Represents a furnace or a dispenser.
|
|
*/
|
|
public class DirectionalContainer extends MaterialData implements Directional {
|
|
public DirectionalContainer(final int type) {
|
|
super(type);
|
|
}
|
|
|
|
public DirectionalContainer(final Material type) {
|
|
super(type);
|
|
}
|
|
|
|
public DirectionalContainer(final int type, final byte data) {
|
|
super(type, data);
|
|
}
|
|
|
|
public DirectionalContainer(final Material type, final byte data) {
|
|
super(type, data);
|
|
}
|
|
|
|
public void setFacingDirection(BlockFace face) {
|
|
byte data;
|
|
|
|
switch (face) {
|
|
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() {
|
|
byte data = getData();
|
|
|
|
switch (data) {
|
|
case 0x2:
|
|
return BlockFace.NORTH;
|
|
|
|
case 0x3:
|
|
return BlockFace.SOUTH;
|
|
|
|
case 0x4:
|
|
return BlockFace.WEST;
|
|
|
|
case 0x5:
|
|
default:
|
|
return BlockFace.EAST;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public String toString() {
|
|
return super.toString() + " facing " + getFacing();
|
|
}
|
|
|
|
@Override
|
|
public DirectionalContainer clone() {
|
|
return (DirectionalContainer) super.clone();
|
|
}
|
|
}
|