compare stack tags as well as item id

This commit is contained in:
Porter Westling committed 2014-09-22 15:05:16 -07:00
1 parent 1523b402b3
commit 93f5c8a797
2 files changed
+13 -9

No files matched your search

@@ -82,7 +82,7 @@ public final class InventoryUtils
inventory.setInventorySlotContents(i, toInsert);
return null;
}
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
{
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
{
@@ -138,7 +138,7 @@ public final class InventoryUtils
inventory.setInventorySlotContents(slotID, toInsert);
return null;
}
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
else if(areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
{
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
{
@@ -169,7 +169,11 @@ public final class InventoryUtils
return toInsert;
}
public static InvStack takeTopItem(IInventory inventory, int side)
public static boolean areItemsStackable(ItemStack toInsert, ItemStack inSlot) {
return inSlot.isItemEqual(toInsert) && ItemStack.areItemStackTagsEqual(inSlot, toInsert);
}
public static InvStack takeTopItem(IInventory inventory, int side)
{
inventory = checkChestInv(inventory);
@@ -381,7 +385,7 @@ public final class InventoryUtils
{
return true;
}
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
{
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
{
@@ -427,7 +431,7 @@ public final class InventoryUtils
{
return true;
}
else if(inSlot.isItemEqual(itemStack) && inSlot.stackSize < inSlot.getMaxStackSize())
else if(areItemsStackable(itemStack, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
{
if(inSlot.stackSize + itemStack.stackSize <= inSlot.getMaxStackSize())
{