rotate block

This commit is contained in:
Raoul Van den Berge
2015-12-20 14:07:57 +01:00
parent d3bba8d1f1
commit 12885c24a1

View File

@@ -30,6 +30,29 @@ public abstract class BlockBase extends Block {
return "block." + StorageCraft.ID + ":" + name;
}
@Override
public boolean rotateBlock(World world, int x, int y, int z, ForgeDirection axis) {
TileEntity tile = world.getTileEntity(x, y, z);
if (tile instanceof TileBase) {
ForgeDirection dir = ((TileBase) tile).getDirection();
int newDir = dir.ordinal() + 1;
if (newDir > ForgeDirection.VALID_DIRECTIONS.length - 1) {
newDir = 0;
}
((TileBase) tile).setDirection(ForgeDirection.getOrientation(newDir));
world.markBlockForUpdate(x, y, z);
return true;
}
return false;
}
@Override
public void onBlockPlacedBy(World world, int x, int y, int z, EntityLivingBase entityLiving, ItemStack itemStack) {
super.onBlockPlacedBy(world, x, y, z, entityLiving, itemStack);