Add rotation for sides

This commit is contained in:
DarkGuardsman 2013-10-23 09:47:02 -04:00
parent 99b53635f1
commit 08bd443857

View file

@ -121,6 +121,8 @@ public class BlockTurntable extends BlockAssembly
{
currentDirection = ((IRotatableBlock) Block.blocksList[blockID]).getDirection(world, position.intX(), position.intY(), position.intZ());
}
if (direction != null)
{
if (direction == ForgeDirection.UP || direction == ForgeDirection.DOWN)
{
if (currentDirection == ForgeDirection.NORTH)
@ -142,11 +144,41 @@ public class BlockTurntable extends BlockAssembly
}
else if (direction == ForgeDirection.EAST || direction == ForgeDirection.WEST)
{
if (currentDirection == ForgeDirection.NORTH)
{
currentDirection = ForgeDirection.UP;
}
else if (currentDirection == ForgeDirection.UP)
{
currentDirection = ForgeDirection.SOUTH;
}
else if (currentDirection == ForgeDirection.SOUTH)
{
currentDirection = ForgeDirection.DOWN;
}
else if (currentDirection == ForgeDirection.DOWN)
{
currentDirection = ForgeDirection.NORTH;
}
}
else if (direction == ForgeDirection.NORTH || direction == ForgeDirection.SOUTH)
{
if (currentDirection == ForgeDirection.EAST)
{
currentDirection = ForgeDirection.UP;
}
else if (currentDirection == ForgeDirection.UP)
{
currentDirection = ForgeDirection.WEST;
}
else if (currentDirection == ForgeDirection.WEST)
{
currentDirection = ForgeDirection.DOWN;
}
else if (currentDirection == ForgeDirection.DOWN)
{
currentDirection = ForgeDirection.EAST;
}
}
world.markBlockForUpdate(position.intX(), position.intY(), position.intZ());
world.playSoundEffect(x + 0.5D, y + 0.5D, z + 0.5D, "tile.piston.in", 0.5F, world.rand.nextFloat() * 0.15F + 0.6F);
@ -160,6 +192,7 @@ public class BlockTurntable extends BlockAssembly
((IRotatableBlock) Block.blocksList[blockID]).setDirection(world, position.intX(), position.intY(), position.intZ(), currentDirection);
}
}
}
catch (Exception e)
{
System.out.println("Failed to rotate:");