Fix null Itemstacks in miner and recipes

Fixes #4321 and #4319
Thanks to @allanf181 for finding the recipe bug
This commit is contained in:
Tom Elfring committed 2017-04-17 15:07:14 +02:00
1 parent 20cf847b64
commit 704826f0fd
6 files changed
+34 -32

No files matched your search

@@ -35,11 +35,11 @@ public class RecipeUtils
{
public static boolean areItemsEqualForCrafting(ItemStack target, ItemStack input)
{
if(target == null && input != null || target != null && input == null)
if(target.isEmpty() && !input.isEmpty() || !target.isEmpty() && input.isEmpty())
{
return false;
}
else if(target == null && input == null)
else if(target.isEmpty() && input.isEmpty())
{
return true;
}
@@ -202,7 +202,7 @@ public class RecipeUtils
if(BasicBlockType.get(toReturn) == BasicBlockType.BIN)
{
int foundCount = 0;
ItemStack foundType = null;
ItemStack foundType = ItemStack.EMPTY;
for(int i = 0; i < 9; i++)
{
@@ -217,7 +217,7 @@ public class RecipeUtils
}
}
if(foundCount > 0 && foundType != null)
if(foundCount > 0 && !foundType.isEmpty())
{
InventoryBin binInv = new InventoryBin(toReturn);
binInv.setItemCount(foundCount);