use of WayofTime.bloodmagic.alchemyArray.AlchemyArrayEffectCrafting in project BloodMagic by WayofTime.
the class AlchemyArrayRecipeRegistry method getRecipeForOutputStack.
/**
* @param stack of the recipe
* @return an array of two ItemStacks - first index is the input stack,
* second is the catalyst stack. Returns {null, null} if no recipe
* is valid.
*/
public static ItemStack[] getRecipeForOutputStack(ItemStack stack) {
for (Entry<List<ItemStack>, AlchemyArrayRecipe> entry : recipes.entrySet()) {
AlchemyArrayRecipe recipe = entry.getValue();
if (recipe != null && entry.getKey().size() > 0) {
for (Entry<ItemStackWrapper, AlchemyArrayEffect> effectEntry : recipe.catalystMap.entrySet()) {
if (effectEntry.getValue() instanceof AlchemyArrayEffectCrafting) {
AlchemyArrayEffectCrafting craftingEffect = (AlchemyArrayEffectCrafting) effectEntry.getValue();
ItemStack resultStack = craftingEffect.outputStack;
if (!resultStack.isEmpty()) {
if (resultStack.getItem() == stack.getItem() && resultStack.getItemDamage() == stack.getItemDamage()) {
return new ItemStack[] { entry.getKey().get(0), effectEntry.getKey().toStack() };
}
}
}
}
}
}
return new ItemStack[] { null, null };
}
Aggregations