Added optional TE wrench support. (#3145)
This commit is contained in:
@@ -20,6 +20,8 @@ package appeng.items.tools;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.tileentity.TileEntity;
|
||||
@@ -32,6 +34,9 @@ import net.minecraft.util.math.RayTraceResult;
|
||||
import net.minecraft.util.math.Vec3d;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
|
||||
import appeng.api.implementations.guiobjects.IGuiItem;
|
||||
import appeng.api.implementations.guiobjects.IGuiItemObject;
|
||||
@@ -54,7 +59,8 @@ import appeng.util.Platform;
|
||||
|
||||
// TODO BC Integration
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore )
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /* , IToolWrench */
|
||||
@Interface( iface = "cofh.api.item.IToolHammer", modid = "cofhcore" )
|
||||
public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench, IToolHammer /* , IToolWrench */
|
||||
{
|
||||
|
||||
public ToolNetworkTool()
|
||||
@@ -197,6 +203,32 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
|
||||
return true;
|
||||
}
|
||||
|
||||
// IToolHammer - start
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
// IToolHammer - end
|
||||
|
||||
// TODO: BC WRENCH INTEGRATION
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,8 @@ package appeng.items.tools.quartz;
|
||||
|
||||
|
||||
import net.minecraft.block.Block;
|
||||
import net.minecraft.entity.Entity;
|
||||
import net.minecraft.entity.EntityLivingBase;
|
||||
import net.minecraft.entity.player.EntityPlayer;
|
||||
import net.minecraft.item.ItemStack;
|
||||
import net.minecraft.util.EnumActionResult;
|
||||
@@ -28,6 +30,9 @@ import net.minecraft.util.EnumHand;
|
||||
import net.minecraft.util.math.BlockPos;
|
||||
import net.minecraft.world.IBlockAccess;
|
||||
import net.minecraft.world.World;
|
||||
import net.minecraftforge.fml.common.Optional.Interface;
|
||||
|
||||
import cofh.api.item.IToolHammer;
|
||||
|
||||
import appeng.api.implementations.items.IAEWrench;
|
||||
import appeng.api.util.DimensionalCoord;
|
||||
@@ -37,7 +42,8 @@ import appeng.util.Platform;
|
||||
|
||||
// TODO BC Integration
|
||||
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore )
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , IToolWrench */
|
||||
@Interface( iface = "cofh.api.item.IToolHammer", modid = "cofhcore" )
|
||||
public class ToolQuartzWrench extends AEBaseItem implements IAEWrench, IToolHammer /* , IToolWrench */
|
||||
{
|
||||
|
||||
public ToolQuartzWrench()
|
||||
@@ -81,6 +87,32 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
|
||||
return true;
|
||||
}
|
||||
|
||||
// IToolHammer - start
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isUsable( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, BlockPos pos )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void toolUsed( ItemStack item, EntityLivingBase user, Entity entity )
|
||||
{
|
||||
user.swingArm( user.getActiveHand() );
|
||||
}
|
||||
// IToolHammer - end
|
||||
|
||||
// TODO: BC Wrench Integration
|
||||
/*
|
||||
* @Override
|
||||
|
||||
@@ -673,6 +673,11 @@ public class Platform
|
||||
* return wrench.canWrench( player, x, y, z );
|
||||
* }
|
||||
*/
|
||||
|
||||
if( eq.getItem() instanceof cofh.api.item.IToolHammer )
|
||||
{
|
||||
return ( (cofh.api.item.IToolHammer) eq.getItem() ).isUsable( eq, player, pos );
|
||||
}
|
||||
}
|
||||
catch( final Throwable ignore )
|
||||
{ // explodes without BC
|
||||
|
||||
Reference in New Issue
Block a user