Updated the Alchemy Table recipe system so that it can provide better custom recipes

This commit is contained in:
WayofTime 2016-05-04 16:44:32 -04:00
parent a5dee50984
commit 86efa8b1a3
12 changed files with 212 additions and 218 deletions

View file

@ -1,5 +1,9 @@
package WayofTime.bloodmagic.api.recipe;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import lombok.Getter;
import net.minecraft.block.Block;
import net.minecraft.item.Item;
@ -8,10 +12,6 @@ import net.minecraft.util.math.BlockPos;
import net.minecraft.world.World;
import net.minecraftforge.oredict.OreDictionary;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class AlchemyTableRecipe
{
protected ItemStack output = null;
@ -144,4 +144,38 @@ public class AlchemyTableRecipe
{
return this.input;
}
public ItemStack[] getRemainingItems(ItemStack[] inventory)
{
ItemStack[] ret = inventory.clone();
for (int i = 0; i < ret.length; i++)
{
ret[i] = getContainerItem(inventory[i]);
}
return ret;
}
protected ItemStack getContainerItem(ItemStack stack)
{
if (stack == null)
{
return null;
}
ItemStack copyStack = stack.copy();
if (copyStack.getItem().hasContainerItem(stack))
{
return copyStack.getItem().getContainerItem(copyStack);
}
copyStack.stackSize--;
if (copyStack.stackSize <= 0)
{
return null;
}
return copyStack;
}
}