Skip to content

Commit 87e46f2

Browse files
committed
Allow the crafter to be rotated with a stick, Closes #1
By default also supports wrenches from other mods.
1 parent e013fec commit 87e46f2

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

src/main/java/org/cyclops/structuredcrafting/block/BlockStructuredCrafter.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
import net.minecraft.block.properties.PropertyDirection;
66
import net.minecraft.block.state.IBlockState;
77
import net.minecraft.entity.EntityLivingBase;
8+
import net.minecraft.entity.player.EntityPlayer;
9+
import net.minecraft.init.Items;
810
import net.minecraft.util.BlockPos;
911
import net.minecraft.util.EnumFacing;
1012
import net.minecraft.world.World;
@@ -49,4 +51,12 @@ public IBlockState onBlockPlaced(World worldIn, BlockPos pos, EnumFacing facing,
4951
return this.getDefaultState().withProperty(FACING, facing.getOpposite());
5052
}
5153

54+
@Override
55+
public boolean onBlockActivated(World worldIn, BlockPos pos, IBlockState state, EntityPlayer playerIn, EnumFacing side, float hitX, float hitY, float hitZ) {
56+
if(playerIn != null && playerIn.getHeldItem() != null && playerIn.getHeldItem().getItem() == Items.stick) {
57+
this.rotateBlock(worldIn, pos, side);
58+
}
59+
return super.onBlockActivated(worldIn, pos, state, playerIn, side, hitX, hitY, hitZ);
60+
}
61+
5262
}

0 commit comments

Comments
 (0)