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,15 +105,18 @@ public class DirtyChestMenu extends ChestMenu {
|
|||||||
if (stack == null) {
|
if (stack == null) {
|
||||||
replaceExistingItem(slot, item);
|
replaceExistingItem(slot, item);
|
||||||
return null;
|
return null;
|
||||||
} else if (stack.getAmount() < stack.getMaxStackSize()) {
|
} else {
|
||||||
if (wrapper == null) {
|
int maxStackSize = Math.min(stack.getMaxStackSize(), toInventory().getMaxStackSize());
|
||||||
wrapper = new ItemStackWrapper(item);
|
if (stack.getAmount() < maxStackSize) {
|
||||||
}
|
if (wrapper == null) {
|
||||||
|
wrapper = new ItemStackWrapper(item);
|
||||||
|
}
|
||||||
|
|
||||||
if (ItemUtils.canStack(wrapper, stack)) {
|
if (ItemUtils.canStack(wrapper, stack)) {
|
||||||
amount -= (stack.getMaxStackSize() - stack.getAmount());
|
amount -= (maxStackSize - stack.getAmount());
|
||||||
stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), stack.getMaxStackSize()));
|
stack.setAmount(Math.min(stack.getAmount() + item.getAmount(), maxStackSize));
|
||||||
item.setAmount(amount);
|
item.setAmount(amount);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user