package org.cyclops.integrateddynamics.item;

import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;
import org.cyclops.cyclopscore.config.configurable.ConfigurableItem;
import org.cyclops.cyclopscore.config.extendedconfig.ExtendedConfig;
import org.cyclops.integrateddynamics.core.item.IWrench;

/**
 * The default wrench for this mod.
 * @author rubensworks
 */
public class ItemWrench extends ConfigurableItem implements IWrench {

    private static ItemWrench _instance = null;

    /**
     * Get the unique instance.
     * @return The instance.
     */
    public static ItemWrench getInstance() {
        return _instance;
    }

    /**
     * Make a new item instance.
     *
     * @param eConfig Config for this blockState.
     */
    public ItemWrench(ExtendedConfig eConfig) {
        super(eConfig);
    }

    @Override
    public boolean doesSneakBypassUse(World world, BlockPos pos, EntityPlayer player) {
        return true;
    }

    @Override
    public boolean canUse(EntityPlayer player, BlockPos pos) {
        return true;
    }

    @Override
    public void beforeUse(EntityPlayer player, BlockPos pos) {

    }

    @Override
    public void afterUse(EntityPlayer player, BlockPos pos) {

    }
}

@@ -39,16 +39,50 @@
 .item;%0A%0A
+import net.minecraft.block.Block;%0A
 import n
@@ -147,21 +147,96 @@
 aft.
-util.BlockPos
+item.ItemStack;%0Aimport net.minecraft.util.BlockPos;%0Aimport net.minecraft.util.EnumFacing
 ;%0Aim
@@ -1392,11 +1392,513 @@
 %7B%0A%0A    %7D
+%0A%0A    @Override%0A    public boolean onItemUseFirst(ItemStack stack, EntityPlayer player, World world, BlockPos pos, EnumFacing side,%0A                                  float hitX, float hitY, float hitZ) %7B%0A        Block block = world.getBlockState(pos).getBlock();%0A        if(block == null %7C%7C player.isSneaking()) %7B%0A            return false;%0A        %7D else if(block.rotateBlock(world, pos, side)) %7B%0A            player.swingItem();%0A            return !world.isRemote;%0A        %7D%0A        return false;%0A    %7D
 %0A%7D%0A

Add rotation support for the wrench