Added optional TE wrench support. (#3145)

This commit is contained in:
fscan
2017-10-08 17:58:57 +02:00
committed by yueh
parent 644194d0d6
commit 8ad8ce68b5
5 changed files with 73 additions and 2 deletions
+1
View File
@@ -23,6 +23,7 @@ jei_version=4.8.0.105
tesla_version=1.0.61 tesla_version=1.0.61
ic2_version=2.8.19-ex112 ic2_version=2.8.19-ex112
top_version=1.12-1.4.18-10 top_version=1.12-1.4.18-10
cofhcore_version=1.12-4.+
######################################################### #########################################################
# Deployment # # Deployment #
+1
View File
@@ -76,6 +76,7 @@ dependencies {
compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}" compileOnly "net.darkhax.tesla:Tesla-1.12:${tesla_version}"
compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api"
compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api" compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api"
compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf"
// at runtime, use the full JEI jar // at runtime, use the full JEI jar
runtime "mezz.jei:jei_${minecraft_version}:${jei_version}" runtime "mezz.jei:jei_${minecraft_version}:${jei_version}"
@@ -20,6 +20,8 @@ package appeng.items.tools;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity; import net.minecraft.tileentity.TileEntity;
@@ -32,6 +34,9 @@ import net.minecraft.util.math.RayTraceResult;
import net.minecraft.util.math.Vec3d; import net.minecraft.util.math.Vec3d;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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.IGuiItem;
import appeng.api.implementations.guiobjects.IGuiItemObject; import appeng.api.implementations.guiobjects.IGuiItemObject;
@@ -54,7 +59,8 @@ import appeng.util.Platform;
// TODO BC Integration // TODO BC Integration
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore ) //@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() public ToolNetworkTool()
@@ -197,6 +203,32 @@ public class ToolNetworkTool extends AEBaseItem implements IGuiItem, IAEWrench /
return true; 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 // TODO: BC WRENCH INTEGRATION
} }
@@ -20,6 +20,8 @@ package appeng.items.tools.quartz;
import net.minecraft.block.Block; import net.minecraft.block.Block;
import net.minecraft.entity.Entity;
import net.minecraft.entity.EntityLivingBase;
import net.minecraft.entity.player.EntityPlayer; import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.item.ItemStack; import net.minecraft.item.ItemStack;
import net.minecraft.util.EnumActionResult; import net.minecraft.util.EnumActionResult;
@@ -28,6 +30,9 @@ import net.minecraft.util.EnumHand;
import net.minecraft.util.math.BlockPos; import net.minecraft.util.math.BlockPos;
import net.minecraft.world.IBlockAccess; import net.minecraft.world.IBlockAccess;
import net.minecraft.world.World; 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.implementations.items.IAEWrench;
import appeng.api.util.DimensionalCoord; import appeng.api.util.DimensionalCoord;
@@ -37,7 +42,8 @@ import appeng.util.Platform;
// TODO BC Integration // TODO BC Integration
//@Interface( iface = "buildcraft.api.tools.IToolWrench", iname = IntegrationType.BuildCraftCore ) //@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() public ToolQuartzWrench()
@@ -81,6 +87,32 @@ public class ToolQuartzWrench extends AEBaseItem implements IAEWrench /* , ITool
return true; 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 // TODO: BC Wrench Integration
/* /*
* @Override * @Override
+5
View File
@@ -673,6 +673,11 @@ public class Platform
* return wrench.canWrench( player, x, y, z ); * 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 ) catch( final Throwable ignore )
{ // explodes without BC { // explodes without BC