mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Improve performance of inserting into inventory wrappers (#4468)
This commit is contained in:
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));
|
||||
|
||||
Reference in new issue
Block a user