Improve performance of inserting into inventory wrappers (#4468)
This commit is contained in:
parent
57e6559fa4
commit
7b4040b70b
|
@ -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));
|
||||
|
|
Loading…
Reference in New Issue