#How can I add to an inventory above in the empty slot?
1 messages · Page 1 of 1 (latest)
insertItem returns an ItemStack containing the remaining items, so you can just loop through all the inventory slots until the stack is empty
let stack = Item.of('64x minecraft:cobblestone')
for(let i=0; i<event.block.inventory.slots; i++) {
stack = event.block.inventory.insertItem(i, stack, false)
if (stack.empty) return;
}