Use a wrapper instead of ItemStacks for Altar recipes

This commit is contained in:
Nick 2015-11-03 10:00:40 -08:00
parent e12c78877e
commit 798d4b926c
5 changed files with 66 additions and 17 deletions

View file

@ -2,6 +2,7 @@ package WayofTime.bloodmagic.tile;
import WayofTime.bloodmagic.altar.BloodAltar;
import WayofTime.bloodmagic.api.BloodMagicAPI;
import WayofTime.bloodmagic.api.ItemStackWrapper;
import WayofTime.bloodmagic.api.NBTHolder;
import WayofTime.bloodmagic.api.altar.AltarRecipe;
import WayofTime.bloodmagic.api.altar.AltarUpgrade;
@ -71,7 +72,7 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
setInputFluid(fluidIn);
}
altarTier = Enums.getIfPresent(EnumAltarTier.class, tagCompound.getString(NBTHolder.NBT_ALTAR_TIER)).get();
altarTier = Enums.getIfPresent(EnumAltarTier.class, tagCompound.getString(NBTHolder.NBT_ALTAR_TIER)).or(EnumAltarTier.ONE);
isActive = tagCompound.getBoolean(NBTHolder.NBT_ALTAR_ACTIVE);
liquidRequired = tagCompound.getInteger(NBTHolder.NBT_ALTAR_LIQUID_REQ);
canBeFilled = tagCompound.getBoolean(NBTHolder.NBT_ALTAR_FILLABLE);
@ -164,8 +165,8 @@ public class TileAltar extends TileInventory implements IBloodAltar, IUpdatePlay
if (getStackInSlot(0) != null) {
// Do recipes
if (AltarRecipeRegistry.getRecipes().containsKey(getStackInSlot(0))) {
AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(getStackInSlot(0));
if (AltarRecipeRegistry.getRecipes().containsKey(ItemStackWrapper.getHolder(getStackInSlot(0)))) {
AltarRecipe recipe = AltarRecipeRegistry.getRecipeForInput(ItemStackWrapper.getHolder(getStackInSlot(0)));
if (altarTier.ordinal() >= recipe.getMinTier().ordinal()) {
this.liquidRequired = recipe.getSyphon();

View file

@ -1,6 +1,5 @@
package WayofTime.bloodmagic.tile;
import net.minecraft.entity.item.EntityItem;
import net.minecraft.entity.player.EntityPlayer;
import net.minecraft.inventory.IInventory;
import net.minecraft.inventory.InventoryHelper;