1
mirror of https://github.com/StarWishsama/Slimefun4.git synced 2024-09-19 19:25:48 +00:00

[CI skip] Small performance optimization

This commit is contained in:
TheBusyBiscuit 2021-03-26 20:56:15 +01:00
parent f4bded9491
commit dba628f99c

View File

@ -292,6 +292,11 @@ final class CargoUtils {
int maxStackSize = itemInSlot.getType().getMaxStackSize();
int currentAmount = itemInSlot.getAmount();
if (!smartFill && currentAmount == maxStackSize) {
// Skip full stacks - Performance optimization for non-smartfill nodes
continue;
}
if (SlimefunUtils.isItemSimilar(itemInSlot, wrapper, true, false)) {
if (currentAmount < maxStackSize) {
int amount = currentAmount + stack.getAmount();
@ -339,11 +344,17 @@ final class CargoUtils {
inv.setItem(slot, stack);
return null;
} else {
int currentAmount = itemInSlot.getAmount();
int maxStackSize = itemInSlot.getType().getMaxStackSize();
if (!smartFill && currentAmount == maxStackSize) {
// Skip full stacks - Performance optimization for non-smartfill nodes
continue;
}
if (SlimefunUtils.isItemSimilar(itemInSlot, wrapper, true, false)) {
if (itemInSlot.getAmount() < maxStackSize) {
int amount = itemInSlot.getAmount() + stack.getAmount();
if (currentAmount < maxStackSize) {
int amount = currentAmount + stack.getAmount();
if (amount > maxStackSize) {
stack.setAmount(amount - maxStackSize);