From 2db8e30b1d2151fdde5d08a6c06aef55f0c397d2 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Fri, 27 Jan 2017 11:32:28 +0300 Subject: License, readme and stuff --- ihl/flexible_cable/InvSlotTool.java | 76 +++++++++++++++---------------------- 1 file changed, 30 insertions(+), 46 deletions(-) (limited to 'ihl/flexible_cable/InvSlotTool.java') diff --git a/ihl/flexible_cable/InvSlotTool.java b/ihl/flexible_cable/InvSlotTool.java index b3a3855..0ffbcd9 100644 --- a/ihl/flexible_cable/InvSlotTool.java +++ b/ihl/flexible_cable/InvSlotTool.java @@ -9,77 +9,61 @@ import ic2.core.IC2; import ic2.core.Ic2Items; import ic2.core.item.ItemUpgradeModule; import ihl.interfaces.IWire; +import ihl.recipes.IronWorkbenchRecipe; import ihl.utils.IHLUtils; public class InvSlotTool extends IronWorkbenchInvSlot { - public InvSlotTool(IronWorkbenchTileEntity base1, String name1, - int oldStartIndex1, Access access1, int count) { + public InvSlotTool(IronWorkbenchTileEntity base1, String name1, int oldStartIndex1, Access access1, int count) { super(base1, name1, oldStartIndex1, access1, count); // TODO Auto-generated constructor stub } - public void damage(List tools) - { - if(tools!=null && !tools.isEmpty()) - { - for(int i=0;i tools) { + if (tools != null && !tools.isEmpty()) { + for (int i = 0; i < this.size(); i++) { ItemStack is = this.get(i); - Iterator i1 = tools.iterator(); - while(i1.hasNext()) - { + Iterator i1 = tools.iterator(); + while (i1.hasNext()) { IRecipeInput is1 = i1.next(); - if(is!=null && (is1.matches(is))) - { - if(!is.attemptDamageItem(1, IC2.random)) - { - if(is.stackTagCompound!=null && is.stackTagCompound.hasKey("GT.ToolStats")) - { + if (is != null && (is1.matches(is))) { + if (!is.attemptDamageItem(1, IC2.random)) { + if (is.stackTagCompound != null && is.stackTagCompound.hasKey("GT.ToolStats")) { IHLUtils.damageItemViaNBTTag(is, 1); } } - if(is.stackSize<=0) - { - this.put(i,null); + if (is.stackSize <= 0) { + this.put(i, null); } } } } } } - + @Override - public void put(int index, ItemStack content) - { + public void put(int index, ItemStack content) { super.put(index, content); - if(IC2.platform.isSimulating() && ((IronWorkbenchTileEntity)this.base).container!=null) - { - ((IronWorkbenchTileEntity)this.base).resetOutput(); - ((IronWorkbenchTileEntity)this.base).container.detectAndSendChanges(); + if (IC2.platform.isSimulating() && ((IronWorkbenchTileEntity) this.base).container != null) { + ((IronWorkbenchTileEntity) this.base).resetOutput(); + ((IronWorkbenchTileEntity) this.base).container.detectAndSendChanges(); } - } - + } + @Override - public boolean accepts(ItemStack itemStack) - { - if (itemStack != null && (itemStack.getItem() instanceof ItemUpgradeModule || itemStack.getItem() instanceof IWire|| itemStack.getItem()==Ic2Items.rubber.getItem())) - { - return false; - } - else - { - return true; - } - } + public boolean accepts(ItemStack itemStack) { + for (IronWorkbenchRecipe recipe : IronWorkbenchTileEntity.recipes) { + if (recipe.isTool(itemStack)) { + return true; + } + } + return false; + } - public boolean contain(ItemStack is1) - { - for(int i=0;i