EnderIO Wrench Support
This commit is contained in:
parent
1ace2c4e35
commit
96607760e1
2 changed files with 26 additions and 5 deletions
|
@ -4,6 +4,7 @@ import buildcraft.api.tools.IToolWrench;
|
||||||
import cpw.mods.fml.common.Optional;
|
import cpw.mods.fml.common.Optional;
|
||||||
import cpw.mods.fml.relauncher.Side;
|
import cpw.mods.fml.relauncher.Side;
|
||||||
import cpw.mods.fml.relauncher.SideOnly;
|
import cpw.mods.fml.relauncher.SideOnly;
|
||||||
|
import crazypants.enderio.api.tool.ITool;
|
||||||
import forestry.api.arboriculture.IToolGrafter;
|
import forestry.api.arboriculture.IToolGrafter;
|
||||||
import gregtech.api.GregTech_API;
|
import gregtech.api.GregTech_API;
|
||||||
import gregtech.api.enchants.Enchantment_Radioactivity;
|
import gregtech.api.enchants.Enchantment_Radioactivity;
|
||||||
|
@ -54,8 +55,8 @@ import static gregtech.api.enums.GT_Values.MOD_ID_RC;
|
||||||
* This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench:
|
* This is an example on how you can create a Tool ItemStack, in this case a Bismuth Wrench:
|
||||||
* GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, null);
|
* GT_MetaGenerated_Tool.sInstances.get("gt.metatool.01").getToolWithStats(16, 1, Materials.Bismuth, Materials.Bismuth, null);
|
||||||
*/
|
*/
|
||||||
@Optional.InterfaceList(value = {@Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = MOD_ID_FR), @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = MOD_ID_RC), @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft")})
|
@Optional.InterfaceList(value = {@Optional.Interface(iface = "forestry.api.arboriculture.IToolGrafter", modid = MOD_ID_FR), @Optional.Interface(iface = "mods.railcraft.api.core.items.IToolCrowbar", modid = MOD_ID_RC), @Optional.Interface(iface = "buildcraft.api.tools.IToolWrench", modid = "BuildCraft"), @Optional.Interface(iface = "crazypants.enderio.api.tool.ITool", modid = "EnderIO")})
|
||||||
public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements IDamagableItem, IToolGrafter, IToolCrowbar, IToolWrench {
|
public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements IDamagableItem, IToolGrafter, IToolCrowbar, IToolWrench, ITool {
|
||||||
/**
|
/**
|
||||||
* All instances of this Item Class are listed here.
|
* All instances of this Item Class are listed here.
|
||||||
* This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true.
|
* This gets used to register the Renderer to all Items of this Type, if useStandardMetaItemRenderer() returns true.
|
||||||
|
@ -517,7 +518,7 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
|
||||||
if(player.getCurrentEquippedItem()==null)return false;
|
if(player.getCurrentEquippedItem()==null)return false;
|
||||||
if (!isItemStackUsable(player.getCurrentEquippedItem())) return false;
|
if (!isItemStackUsable(player.getCurrentEquippedItem())) return false;
|
||||||
IToolStats tStats = getToolStats(player.getCurrentEquippedItem());
|
IToolStats tStats = getToolStats(player.getCurrentEquippedItem());
|
||||||
return tStats != null && tStats.isCrowbar();
|
return tStats != null && tStats.isWrench();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -528,6 +529,26 @@ public abstract class GT_MetaGenerated_Tool extends GT_MetaBase_Item implements
|
||||||
if (tStats != null) doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack());
|
if (tStats != null) doDamage(player.getCurrentEquippedItem(), tStats.getToolDamagePerEntityAttack());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean canUse(ItemStack stack, EntityPlayer player, int x, int y, int z){
|
||||||
|
return canWrench(player, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void used(ItemStack stack, EntityPlayer player, int x, int y, int z){
|
||||||
|
wrenchUsed(player, x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean shouldHideFacades(ItemStack stack, EntityPlayer player) {
|
||||||
|
if(player==null)return false;
|
||||||
|
if(player.getCurrentEquippedItem()==null)return false;
|
||||||
|
if (!isItemStackUsable(player.getCurrentEquippedItem())) return false;
|
||||||
|
IToolStats tStats = getToolStats(player.getCurrentEquippedItem());
|
||||||
|
return tStats.isWrench();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean canLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) {
|
public boolean canLink(EntityPlayer aPlayer, ItemStack aStack, EntityMinecart cart) {
|
||||||
if (!isItemStackUsable(aStack)) return false;
|
if (!isItemStackUsable(aStack)) return false;
|
||||||
|
|
|
@ -6,12 +6,12 @@ import gregtech.api.items.GT_MetaGenerated_Tool;
|
||||||
import gregtech.api.util.GT_ModHandler;
|
import gregtech.api.util.GT_ModHandler;
|
||||||
import gregtech.api.util.GT_OreDictUnificator;
|
import gregtech.api.util.GT_OreDictUnificator;
|
||||||
import gregtech.common.tools.*;
|
import gregtech.common.tools.*;
|
||||||
|
import net.minecraft.entity.player.EntityPlayer;
|
||||||
import net.minecraft.init.Blocks;
|
import net.minecraft.init.Blocks;
|
||||||
import net.minecraft.init.Items;
|
import net.minecraft.init.Items;
|
||||||
import net.minecraft.item.ItemStack;
|
import net.minecraft.item.ItemStack;
|
||||||
|
|
||||||
public class GT_MetaGenerated_Tool_01
|
public class GT_MetaGenerated_Tool_01 extends GT_MetaGenerated_Tool {
|
||||||
extends GT_MetaGenerated_Tool {
|
|
||||||
public static final short SWORD = 0;
|
public static final short SWORD = 0;
|
||||||
public static final short PICKAXE = 2;
|
public static final short PICKAXE = 2;
|
||||||
public static final short SHOVEL = 4;
|
public static final short SHOVEL = 4;
|
||||||
|
|
Loading…
Reference in a new issue