compare stack tags as well as item id
This commit is contained in:
parent
1523b402b3
commit
93f5c8a797
2 changed files with 13 additions and 9 deletions
|
@ -126,7 +126,7 @@ public class TransporterManager
|
|||
testInv[i] = toInsert;
|
||||
return;
|
||||
}
|
||||
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
{
|
||||
|
@ -182,7 +182,7 @@ public class TransporterManager
|
|||
testInv[slotID] = toInsert;
|
||||
return;
|
||||
}
|
||||
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
{
|
||||
|
@ -282,7 +282,7 @@ public class TransporterManager
|
|||
{
|
||||
return null;
|
||||
}
|
||||
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
{
|
||||
|
@ -325,7 +325,7 @@ public class TransporterManager
|
|||
{
|
||||
return null;
|
||||
}
|
||||
else if(inSlot.isItemEqual(toInsert) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
else if(InventoryUtils.areItemsStackable(toInsert, inSlot) && inSlot.stackSize < inSlot.getMaxStackSize())
|
||||
{
|
||||
if(inSlot.stackSize + toInsert.stackSize <= inSlot.getMaxStackSize())
|
||||
{
|
||||
|
|
|
@ -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,6 +169,10 @@ public final class InventoryUtils
|
|||
return toInsert;
|
||||
}
|
||||
|
||||
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())
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue