mirror of
https://github.com/StarWishsama/Slimefun4.git
synced 2024-09-19 19:25:48 +00:00
Merge pull request #2755 from kii-chan-reloaded/master
Check inv maxStackSize
This commit is contained in:
commit
30202d3f51
@ -105,18 +105,21 @@ public class DirtyChestMenu extends ChestMenu {
|
||||
if (stack == null) {
|
||||
replaceExistingItem(slot, item);
|
||||
return null;
|
||||
} else if (stack.getAmount() < stack.getMaxStackSize()) {
|
||||
} else {
|
||||
int maxStackSize = Math.min(stack.getMaxStackSize(), toInventory().getMaxStackSize());
|
||||
if (stack.getAmount() < maxStackSize) {
|
||||
if (wrapper == null) {
|
||||
wrapper = new ItemStackWrapper(item);
|
||||
}
|
||||
|
||||
if (ItemUtils.canStack(wrapper, stack)) {
|
||||
amount -= (stack.getMaxStackSize() - stack.getAmount());
|
||||
stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), stack.getMaxStackSize()));
|
||||
amount -= (maxStackSize - stack.getAmount());
|
||||
stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), maxStackSize));
|
||||
item.setAmount(amount);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (amount > 0) {
|
||||
return new CustomItem(item, amount);
|
||||
|
Loading…
Reference in New Issue
Block a user