mirror of
https://github.com/GTNewHorizons/GTNHLib.git
synced 2026-11-26 14:53:14 +00:00
Avoid NBT matching (#378)
Co-authored-by: Martin Robertz <[email protected]>
This commit is contained in:
1 parent
1a4615bc19
commit
2b024fade4
1 file changed
+14
-6
@@ -107,18 +107,26 @@ public class StandardInventoryIterator extends AbstractInventoryIterator {
|
||||
|
||||
ItemStack inSlot = getStackInSlot(slotIndex);
|
||||
|
||||
if (!ItemUtil.isStackEmpty(inSlot) && !stack.matches(inSlot)) {
|
||||
return stack.getStackSize();
|
||||
}
|
||||
|
||||
ItemStack partialCopy = stack.toStackFast();
|
||||
|
||||
int maxStack = getSlotStackLimit(slotIndex, partialCopy);
|
||||
|
||||
if (!ItemUtil.isStackEmpty(inSlot)) {
|
||||
if (!forced) {
|
||||
// Skip expensive NBT check if the stack is full.
|
||||
if (inSlot.stackSize >= maxStack || !inSlot.isStackable()) {
|
||||
return stack.getStackSize();
|
||||
}
|
||||
}
|
||||
if (!stack.matches(inSlot)) {
|
||||
return stack.getStackSize();
|
||||
}
|
||||
}
|
||||
|
||||
if (!forced && !canInsert(partialCopy, slotIndex)) {
|
||||
return stack.getStackSize();
|
||||
}
|
||||
|
||||
int maxStack = getSlotStackLimit(slotIndex, partialCopy);
|
||||
|
||||
if (!ItemUtil.isStackEmpty(inSlot)) {
|
||||
int toInsert = forced ? stack.getStackSize() : Math.min(maxStack - inSlot.stackSize, stack.getStackSize());
|
||||
|
||||
|
||||
Reference in new issue
Block a user