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/recipes/RecipeInputDetonator.java | 73 +++++++++++++++++++++++++++++++++++ 1 file changed, 73 insertions(+) create mode 100644 ihl/recipes/RecipeInputDetonator.java (limited to 'ihl/recipes/RecipeInputDetonator.java') diff --git a/ihl/recipes/RecipeInputDetonator.java b/ihl/recipes/RecipeInputDetonator.java new file mode 100644 index 0000000..efef075 --- /dev/null +++ b/ihl/recipes/RecipeInputDetonator.java @@ -0,0 +1,73 @@ +package ihl.recipes; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +import ic2.api.recipe.IRecipeInput; +import ihl.utils.IHLUtils; +import net.minecraft.item.ItemStack; + +public class RecipeInputDetonator implements IRecipeInput +{ + public final ItemStack input; + public final int detonator_delay; + + public RecipeInputDetonator(String string, int detonator_delay) + { + this(IHLUtils.getItemStackWithTag(string, "detonator_delay", detonator_delay)); + } + + public RecipeInputDetonator(ItemStack itemStack) + { + input=itemStack; + detonator_delay=itemStack.stackTagCompound.getInteger("detonator_delay"); + } + + @Override + public boolean matches(ItemStack subject) + { + return subject.getItem() == this.input.getItem() && (subject.getItemDamage() == this.input.getItemDamage() || this.input.getItemDamage() == 32767); + } + + @Override + public int getAmount() + { + return 1; + } + + @Override + public List getInputs() + { + return Arrays.asList(new ItemStack[] {this.input}); + } + + @Override + public String toString() + { + ItemStack stack = this.input.copy(); + return "RInputDice<" + stack + ">"; + } + + public List transformOutput(ItemStack matchedItemStack, List outputs) + { + List newOutputs = new ArrayList(); + int misTS = matchedItemStack.stackTagCompound.getInteger("detonator_delay"); + ItemStack material; + for(ItemStack material1:outputs) + { + if(IHLUtils.getFirstOreDictName(material1) == "blockExplosive") + { + material=material1.copy(); + material.stackTagCompound.setInteger("detonator_delay", misTS); + newOutputs.add(material); + } + else + { + newOutputs.add(material1); + } + } + return newOutputs; + } +} + -- cgit v1.2.3