2013-12-27 23:59:59 +01:00
|
|
|
package appeng.items.tools.quartz;
|
|
|
|
|
|
|
|
import java.util.EnumSet;
|
|
|
|
|
|
|
|
import net.minecraft.block.Block;
|
|
|
|
import net.minecraft.entity.player.EntityPlayer;
|
|
|
|
import net.minecraft.item.ItemStack;
|
|
|
|
import net.minecraft.world.World;
|
2014-02-09 02:34:52 +01:00
|
|
|
import net.minecraftforge.common.util.ForgeDirection;
|
2014-01-23 20:02:48 +01:00
|
|
|
import appeng.api.implementations.items.IAEWrench;
|
2013-12-27 23:59:59 +01:00
|
|
|
import appeng.core.features.AEFeature;
|
|
|
|
import appeng.items.AEBaseItem;
|
2014-04-06 08:55:24 +02:00
|
|
|
import appeng.transformer.annotations.integration.Interface;
|
2014-04-01 05:24:28 +02:00
|
|
|
import appeng.util.Platform;
|
2013-12-27 23:59:59 +01:00
|
|
|
import buildcraft.api.tools.IToolWrench;
|
|
|
|
|
2014-04-06 08:55:24 +02:00
|
|
|
@Interface(iface = "buildcraft.api.tools.IToolWrench", iname = "BC")
|
2013-12-27 23:59:59 +01:00
|
|
|
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolWrench
|
|
|
|
{
|
|
|
|
|
|
|
|
public ToolQuartzWrench(AEFeature type) {
|
|
|
|
super( ToolQuartzWrench.class, type.name() );
|
|
|
|
setfeature( EnumSet.of( type, AEFeature.QuartzWrench ) );
|
|
|
|
setMaxStackSize( 1 );
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-01-23 17:28:12 +01:00
|
|
|
public boolean onItemUseFirst(ItemStack is, EntityPlayer player, World world, int x, int y, int z, int side, float hitX, float hitY, float hitZ)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-02-09 02:34:52 +01:00
|
|
|
Block b = world.getBlock( x, y, z );
|
|
|
|
if ( b != null && !player.isSneaking() )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-04-01 05:24:28 +02:00
|
|
|
ForgeDirection mySide = ForgeDirection.getOrientation( side );
|
|
|
|
if ( b.rotateBlock( world, x, y, z, mySide ) )
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
2014-04-01 05:24:28 +02:00
|
|
|
b.onNeighborBlockChange( world, x, y, z, Platform.air );
|
2014-02-09 02:34:52 +01:00
|
|
|
player.swingItem();
|
|
|
|
return !world.isRemote;
|
2013-12-27 23:59:59 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
2014-02-09 02:34:52 +01:00
|
|
|
// public boolean shouldPassSneakingClickToBlock(World w, int x, int y, int z)
|
|
|
|
public boolean doesSneakBypassUse(World world, int x, int y, int z, EntityPlayer player)
|
2013-12-27 23:59:59 +01:00
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canWrench(ItemStack is, EntityPlayer player, int x, int y, int z)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public boolean canWrench(EntityPlayer player, int x, int y, int z)
|
|
|
|
{
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void wrenchUsed(EntityPlayer player, int x, int y, int z)
|
|
|
|
{
|
|
|
|
player.swingItem();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|