mirror of
https://github.com/MinecraftForge/MinecraftForge.git
synced 2026-11-12 08:17:35 +00:00
Improve performance of inserting into inventory wrappers (#3622)
This commit is contained in:
1 parent
aed00b5dce
commit
bc381b92ea
2 files changed
+12
-6
No files matched your search
@@ -75,9 +75,6 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||
if (stack.isEmpty())
|
||||
return ItemStack.EMPTY;
|
||||
|
||||
if (!getInv().isItemValidForSlot(slot, stack))
|
||||
return stack;
|
||||
|
||||
ItemStack stackInSlot = getInv().getStackInSlot(slot);
|
||||
|
||||
int m;
|
||||
@@ -86,6 +83,9 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
||||
return stack;
|
||||
|
||||
if (!getInv().isItemValidForSlot(slot, stack))
|
||||
return stack;
|
||||
|
||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
|
||||
|
||||
if (stack.getCount() <= m)
|
||||
@@ -121,6 +121,9 @@ public class InvWrapper implements IItemHandlerModifiable
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!getInv().isItemValidForSlot(slot, stack))
|
||||
return stack;
|
||||
|
||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
|
||||
if (m < stack.getCount())
|
||||
{
|
||||
|
||||
@@ -93,9 +93,6 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||
if (slot1 == -1)
|
||||
return stack;
|
||||
|
||||
if (!inv.isItemValidForSlot(slot1, stack) || !inv.canInsertItem(slot1, stack, side))
|
||||
return stack;
|
||||
|
||||
ItemStack stackInSlot = inv.getStackInSlot(slot1);
|
||||
|
||||
int m;
|
||||
@@ -104,6 +101,9 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||
if (!ItemHandlerHelper.canItemStacksStack(stack, stackInSlot))
|
||||
return stack;
|
||||
|
||||
if (!inv.isItemValidForSlot(slot1, stack) || !inv.canInsertItem(slot1, stack, side))
|
||||
return stack;
|
||||
|
||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot)) - stackInSlot.getCount();
|
||||
|
||||
if (stack.getCount() <= m)
|
||||
@@ -137,6 +137,9 @@ public class SidedInvWrapper implements IItemHandlerModifiable
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!inv.isItemValidForSlot(slot1, stack) || !inv.canInsertItem(slot1, stack, side))
|
||||
return stack;
|
||||
|
||||
m = Math.min(stack.getMaxStackSize(), getSlotLimit(slot));
|
||||
if (m < stack.getCount())
|
||||
{
|
||||
|
||||
Reference in new issue
Block a user