diff options
| author | Foghrye4 <foghrye4@gmail.com> | 2017-08-10 18:52:45 +0300 |
|---|---|---|
| committer | Foghrye4 <foghrye4@gmail.com> | 2017-08-10 18:52:45 +0300 |
| commit | 0427ab89f1753a44b30cbc35ce021cbbdc845109 (patch) | |
| tree | abe418ff5ec174e712fe8dedd434548a945b15a3 /src/main/java/ihl/recipes/RecipeInputDetonator.java | |
| parent | 877312184c472d9845e5ef1008bc538f4634059f (diff) | |
fix missing source folder
Diffstat (limited to 'src/main/java/ihl/recipes/RecipeInputDetonator.java')
| -rw-r--r-- | src/main/java/ihl/recipes/RecipeInputDetonator.java | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/main/java/ihl/recipes/RecipeInputDetonator.java b/src/main/java/ihl/recipes/RecipeInputDetonator.java new file mode 100644 index 0000000..15030fd --- /dev/null +++ b/src/main/java/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<ItemStack> getInputs()
+ {
+ return Arrays.asList(new ItemStack[] {this.input});
+ }
+
+ @Override
+ public String toString()
+ {
+ ItemStack stack = this.input.copy();
+ return "RInputDice<" + stack + ">";
+ }
+
+ public List<ItemStack> transformOutput(ItemStack matchedItemStack, List<ItemStack> outputs)
+ {
+ List<ItemStack> newOutputs = new ArrayList<ItemStack>();
+ 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;
+ }
+}
+
|
