More null stack fixes

This commit is contained in:
Nicholas Ignoffo 2017-02-19 16:06:29 -08:00
parent c682571be0
commit 5475549c18
10 changed files with 49 additions and 50 deletions

View file

@ -15,7 +15,7 @@ import net.minecraftforge.oredict.OreDictionary;
public class AlchemyTableRecipe
{
protected ItemStack output = null;
protected ItemStack output = ItemStack.EMPTY;
protected ArrayList<Object> input = new ArrayList<Object>();
@Getter
protected int lpDrained;
@ -97,11 +97,9 @@ public class AlchemyTableRecipe
{
ArrayList<Object> required = new ArrayList<Object>(input);
for (int x = 0; x < checkedList.size(); x++)
for (ItemStack slot : checkedList)
{
ItemStack slot = checkedList.get(x);
if (slot != null)
if (!slot.isEmpty())
{
boolean inRecipe = false;
@ -109,14 +107,12 @@ public class AlchemyTableRecipe
{
boolean match = false;
Object next = aRequired;
if (next instanceof ItemStack)
if (aRequired instanceof ItemStack)
{
match = OreDictionary.itemMatches((ItemStack) next, slot, false);
} else if (next instanceof List)
match = OreDictionary.itemMatches((ItemStack) aRequired, slot, false);
} else if (aRequired instanceof List)
{
Iterator<ItemStack> itr = ((List<ItemStack>) next).iterator();
Iterator<ItemStack> itr = ((List<ItemStack>) aRequired).iterator();
while (itr.hasNext() && !match)
{
match = OreDictionary.itemMatches(itr.next(), slot, false);
@ -126,7 +122,7 @@ public class AlchemyTableRecipe
if (match)
{
inRecipe = true;
required.remove(next);
required.remove(aRequired);
break;
}
}