From 6e5034aef47d81a51b53296360e30b5cbcc38d77 Mon Sep 17 00:00:00 2001 From: Vasco Lavos Date: Wed, 5 Feb 2014 22:25:51 +0000 Subject: [PATCH] Added RecipeRuneAltar, this is mostly a copy of RecipePetals, will have to work on it. --- .../botania/api/recipe/RecipeRuneAltar.java | 38 +++++++++++++++++++ 1 file changed, 38 insertions(+) diff --git a/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java b/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java index e07e258b7..0f5df7e14 100644 --- a/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java +++ b/MODSRC/vazkii/botania/api/recipe/RecipeRuneAltar.java @@ -11,6 +11,44 @@ */ package vazkii.botania.api.recipe; +import java.util.ArrayList; +import java.util.List; + +import net.minecraft.inventory.IInventory; +import net.minecraft.item.ItemStack; + public class RecipeRuneAltar { + ItemStack output; + List inputs = new ArrayList(); + int mana; + + public RecipeRuneAltar(ItemStack output, String... inputs) { + this.output = output; + for(String i : inputs) + this.inputs.add(i); + } + + public boolean matches(IInventory inv) { + List colorsMissing = new ArrayList(inputs); + + for(int i = 0; i < inv.getSizeInventory(); i++) { + ItemStack stack = inv.getStackInSlot(i); + if(stack == null) + break; + + int color = stack.getItemDamage(); + + if(!colorsMissing.contains(color)) + return false; + colorsMissing.remove((Integer) color); + } + + return colorsMissing.isEmpty(); + } + + public ItemStack getOutput() { + return output; + } + }