Store ItemStackWrappers instead of just ItemStacks (#844)

* Store ItemStackWrappers instead of just ItemStacks
Allows proper usage of getRecipeForInput()

* Refactoring and helper methods
This commit is contained in:
Arcaratus 2016-07-08 18:13:46 -04:00 committed by Nick Ignoffo
parent 46a35ac1fb
commit c34bd48aa5
5 changed files with 51 additions and 15 deletions

View file

@ -1,5 +1,6 @@
package WayofTime.bloodmagic.compat.guideapi.page;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import WayofTime.bloodmagic.util.helper.TextHelper;
import amerifrance.guideapi.api.impl.Book;
@ -29,7 +30,7 @@ public class PageAltarRecipe extends Page
public PageAltarRecipe(AltarRecipeRegistry.AltarRecipe recipe)
{
this.input = recipe.getInput();
this.input = ItemStackWrapper.toStackList(recipe.getInput());
this.output = recipe.getOutput();
this.tier = recipe.getMinTier().toInt();
this.bloodRequired = recipe.getSyphon();

View file

@ -7,27 +7,27 @@ import java.util.Map;
import javax.annotation.Nonnull;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import net.minecraft.item.ItemStack;
import WayofTime.bloodmagic.api.orb.IBloodOrb;
import WayofTime.bloodmagic.api.registry.AltarRecipeRegistry;
import net.minecraftforge.common.ForgeModContainer;
import net.minecraftforge.fluids.UniversalBucket;
public class AltarRecipeMaker
{
@Nonnull
public static List<AltarRecipeJEI> getRecipes()
{
Map<List<ItemStack>, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
Map<List<ItemStackWrapper>, AltarRecipeRegistry.AltarRecipe> altarMap = AltarRecipeRegistry.getRecipes();
ArrayList<AltarRecipeJEI> recipes = new ArrayList<AltarRecipeJEI>();
for (Map.Entry<List<ItemStack>, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet())
for (Map.Entry<List<ItemStackWrapper>, AltarRecipeRegistry.AltarRecipe> itemStackAltarRecipeEntry : altarMap.entrySet())
{
// Make sure input is not a Blood Orb. If it is, the recipe is for a filling orb, and we don't want that.
if (!(itemStackAltarRecipeEntry.getKey().get(0).getItem() instanceof IBloodOrb))
if (!(itemStackAltarRecipeEntry.getKey().get(0).toStack().getItem() instanceof IBloodOrb))
{
List<ItemStack> input = itemStackAltarRecipeEntry.getValue().getInput();
List<ItemStack> input = ItemStackWrapper.toStackList(itemStackAltarRecipeEntry.getValue().getInput());
ItemStack output = itemStackAltarRecipeEntry.getValue().getOutput();
int requiredTier = itemStackAltarRecipeEntry.getValue().getMinTier().toInt();
int requiredLP = itemStackAltarRecipeEntry.getValue().getSyphon();