Improve performance of inserting into inventory wrappers (#4468)

This commit is contained in:
Ben Staddon authored and LexManos committed 2017-10-31 10:41:33 -07:00
1 parent 57e6559fa4
commit 7b4040b70b
2 files changed
+8 -2

No files matched your search

@@ -80,6 +80,9 @@ public class InvWrapper implements IItemHandlerModifiable
int m;
if (!stackInSlot.isEmpty())
{
if (stackInSlot.getCount() >= Math.min(stackInSlot.getMaxStackSize(), getSlotLimit(slot)))
return stack;
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
@@ -98,10 +98,13 @@ public class SidedInvWrapper implements IItemHandlerModifiable
int m;
if (!stackInSlot.isEmpty())
{
if (stackInSlot.getCount() >= Math.min(stackInSlot.getMaxStackSize(), getSlotLimit(slot)))
return stack;
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
return stack;
if (!inv.isItemValidForSlot(slot1, stack) || !inv.canInsertItem(slot1, stack, side))
if (!inv.canInsertItem(slot1, stack, side) || !inv.isItemValidForSlot(slot1, stack))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
@@ -137,7 +140,7 @@ public class SidedInvWrapper implements IItemHandlerModifiable
}
else
{
if (!inv.isItemValidForSlot(slot1, stack) || !inv.canInsertItem(slot1, stack, side))
if (!inv.canInsertItem(slot1, stack, side) || !inv.isItemValidForSlot(slot1, stack))
return stack;
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));