I want the items in the box to be stacked automatically.
I'm there for a few hours and don't know how I could do it anymore.
Here what I have currently written:
ItemStack stack = null;
int itemPos = 0;
for (int c = 0; c
if (stack == null) {
if (chestData.getSnapshotInventory (). GetItem (c) .getAmount ()! = chestData.getSnapshotInventory (). GetItem (c) .getMaxStackSize ()) {
stack = chestData.getSnapshotInventory (). GetItem (c);
stack.setAmount (chestData.getSnapshotInventory (). GetItem (c) .getAmount ());
itemPos = c;
}
} else if (stack.equals (chestData.getSnapshotInventory (). GetItem (c {
if (stack.getAmount () + chestData.getSnapshotInventory (). GetItem (c) .getAmount ()> = stack.getMaxStackSize ()) {
int distance = stack.getMaxStackSize () - stack.getAmount ();
chestData.getSnapshotInventory (). SetItem (itemPos, stack);
stack.setAmount (stack.getMaxStackSize ());
chestData.getSnapshotInventory (). GetItem (c) .setAmount (chestData.getSnapshotInventory (). GetItem (c) .getAmount () - distance);
} else {
stack.setAmount (stack.getAmount () + chestData.getSnapshotInventory (). GetItem (c) .getAmount ());
chestData.getSnapshotInventory (). GetItem (itemPos) .setAmount (stack.getAmount ());
}
}
}
}
Maybe this will help you:
https://hub.spigotmc.org/...Stack.html
(XD or otherwise simply: Shift> * Item-Click * or * Item-Double-Click *, but hopefully that already knows Haha)
Thank you, but that doesn't really help me. I want to stack the items via a plugin, so if there are 2x 32Items just stack 64 at once, thanks anyway.
Ah ok
So an Auto Stack PLUGIN?
https://www.spigotmc.org/...ite.13220/
still found that XD
No either, only potions are stacked here, but I want everything to be stacked.