From 51b20025daab7168d5c2aa853ba3f3ab4e6eb7b2 Mon Sep 17 00:00:00 2001 From: DarkGuardsman Date: Wed, 23 Oct 2013 09:57:00 -0400 Subject: [PATCH] Added wrench support --- .../common/machine/BlockTurntable.java | 47 +++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/src/minecraft/dark/assembly/common/machine/BlockTurntable.java b/src/minecraft/dark/assembly/common/machine/BlockTurntable.java index 566237943..3a4a6fc96 100644 --- a/src/minecraft/dark/assembly/common/machine/BlockTurntable.java +++ b/src/minecraft/dark/assembly/common/machine/BlockTurntable.java @@ -193,6 +193,53 @@ public class BlockTurntable extends BlockAssembly } } + @Override + public boolean onSneakMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + if (world.isRemote) + { + return true; + } + world.setBlockMetadataWithNotify(x, y, z, side, 3); + return true; + } + + @Override + public boolean onMachineActivated(World world, int x, int y, int z, EntityPlayer entityPlayer, int side, float hitX, float hitY, float hitZ) + { + if (world.isRemote) + { + return true; + } + ForgeDirection currentDirection = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z)); + if (currentDirection == ForgeDirection.NORTH) + { + currentDirection = ForgeDirection.UP; + } + else if (currentDirection == ForgeDirection.UP) + { + currentDirection = ForgeDirection.DOWN; + } + else if (currentDirection == ForgeDirection.DOWN) + { + currentDirection = ForgeDirection.EAST; + } + else if (currentDirection == ForgeDirection.EAST) + { + currentDirection = ForgeDirection.SOUTH; + } + else if (currentDirection == ForgeDirection.SOUTH) + { + currentDirection = ForgeDirection.WEST; + } + else if (currentDirection == ForgeDirection.WEST) + { + currentDirection = ForgeDirection.NORTH; + } + world.setBlockMetadataWithNotify(x, y, z, currentDirection.ordinal(), 3); + return true; + } + @Override public TileEntity createNewTileEntity(World world) {