From dc3df3edd5843bde0c1335d6a8e460b2c832aa48 Mon Sep 17 00:00:00 2001 From: Foghrye4 Date: Sat, 17 Jun 2017 08:12:18 +0300 Subject: full project files --- ihl/recipes/IronWorkbenchRecipe.java | 214 ----------------------------------- 1 file changed, 214 deletions(-) delete mode 100644 ihl/recipes/IronWorkbenchRecipe.java (limited to 'ihl/recipes/IronWorkbenchRecipe.java') diff --git a/ihl/recipes/IronWorkbenchRecipe.java b/ihl/recipes/IronWorkbenchRecipe.java deleted file mode 100644 index e471811..0000000 --- a/ihl/recipes/IronWorkbenchRecipe.java +++ /dev/null @@ -1,214 +0,0 @@ -package ihl.recipes; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import ic2.api.recipe.IRecipeInput; -import ic2.api.recipe.RecipeInputItemStack; -import ic2.api.recipe.RecipeInputOreDict; -import ihl.interfaces.IWire; -import ihl.utils.IHLUtils; -import net.minecraft.item.ItemStack; - -public class IronWorkbenchRecipe { - public List workspaceElements=new ArrayList(); - public List tools=new ArrayList(); - public List materials=new ArrayList(); - public List outputs = new ArrayList(); - - public IronWorkbenchRecipe(List tools1, List materials1, List output1_1) - { - if(tools1!=null) - { - Iterator iTools1 = tools1.iterator(); - while(iTools1.hasNext()) - { - Object tool = iTools1.next(); - if(tool instanceof ItemStack) - { - ItemStack stack = (ItemStack) tool; - String oreDictName = IHLUtils.getFirstOreDictNameExcludingTagAny(stack); - if(!oreDictName.isEmpty() && oreDictName.length()>3) - { - tools.add(new RecipeInputOreDict(oreDictName)); - } - else - { - tools.add(new RecipeInputItemStack(stack)); - } - } - else - { - tools.add((IRecipeInput) tool); - } - } - } - Iterator iMaterials1 = materials1.iterator(); - while(iMaterials1.hasNext()) - { - Object material = iMaterials1.next(); - if(material instanceof ItemStack) - { - ItemStack stack = (ItemStack) material; - String oreDictName = IHLUtils.getFirstOreDictNameExcludingTagAny(stack); - if(stack.getItem() instanceof IWire) - { - materials.add(new RecipeInputWire(stack)); - } - else if(!oreDictName.isEmpty() && oreDictName.length()>3) - { - materials.add(new RecipeInputOreDict(oreDictName,stack.stackSize)); - } - else - { - materials.add(new RecipeInputItemStack(stack)); - } - } - else - { - materials.add((IRecipeInput) material); - } - - } - Iterator iOutput = output1_1.iterator(); - while(iOutput.hasNext()) - { - ItemStack outputStack = iOutput.next(); - if(outputStack==null) - throw new NullPointerException("Output shall not contain null."); - this.outputs.add(outputStack); - } - if(tools.size()>8 || materials.size()>12) - { - throw new IllegalArgumentException("Iron workbench recipe cannot contain more than 8 tools or more than 12 materials!"); - } - } - - public IronWorkbenchRecipe(List asList, List asList2, List asList3, List workspaceElements1) { - this(asList, asList2, asList3); - if(workspaceElements1!=null) - { - this.workspaceElements.addAll(workspaceElements1); - } - } - - public boolean isTool(ItemStack tool1) - { - if(tools!=null && !tools.isEmpty()) - { - if(tool1==null) - { - return false; - } - Iterator i1 = tools.iterator(); - while(i1.hasNext()) - { - IRecipeInput tool = i1.next(); - if(tool.matches(tool1)) - { - return true; - } - } - } - return false; - } - - public boolean isCanBeCrafted(List tools1, List materials1, List workspaceElements1) - { - if(workspaceElements!=null && !workspaceElements.isEmpty()) - { - if(workspaceElements1==null||workspaceElements1.isEmpty()) - { - return false; - } - Iterator i1 = workspaceElements.iterator(); - while(i1.hasNext()) - { - ItemStack tool = i1.next(); - if(!this.isItemStackInList(tool, workspaceElements1)) - { - return false; - } - } - } - - if(tools!=null && !tools.isEmpty()) - { - if(tools1==null||tools1.isEmpty()) - { - return false; - } - Iterator i1 = tools.iterator(); - while(i1.hasNext()) - { - IRecipeInput tool = i1.next(); - if(!this.isItemStackInList(tool, tools1)) - { - return false; - } - } - } - if(materials!=null && !materials.isEmpty()) - { - Iterator i1 = materials.iterator(); - while(i1.hasNext()) - { - IRecipeInput material = i1.next(); - if(!this.isItemStackInList(material, materials1)) - { - return false; - } - } - } - return true; - } - - private boolean isItemStackInList(IRecipeInput tool, List tools1) { - Iterator it = tools1.iterator(); - while(it.hasNext()) - { - ItemStack tool2 = it.next(); - if(tool.matches(tool2)) - { - if(tool2.getItem() instanceof IWire) - { - if(IHLUtils.getWireLength(tool2)>=tool.getAmount()) - { - return true; - } - } - else if(tool2.stackSize>=tool.getAmount()) - { - return true; - } - } - } - return false; - } - - private boolean isItemStackInList(ItemStack tool, List tools1) - { - Iterator it = tools1.iterator(); - while(it.hasNext()) - { - ItemStack tool2 = it.next(); - if(IHLUtils.isItemStacksIsEqual(tool,tool2,true)) - { - if(tool2.getItem() instanceof IWire) - { - if(IHLUtils.getWireLength(tool2)>=IHLUtils.getWireLength(tool)) - { - return true; - } - } - else if(tool2.stackSize>=tool.stackSize) - { - return true; - } - } - } - return false; - } - -} -- cgit v1.2.3