add Or Drop
fun ItemStack.addOrDrop(inventory: Inventory, dropOverflow: Boolean = true, location: Location = inventory.findLocation(), naturally: Boolean = true, consumer: (Item) -> Unit = {}): DropResult
Attempts to add all items to the inventory and drops the remaining items to the world.
Receiver
Inventory to add the items to
Return
The result of the operation
Parameters
inventory
Inventory to add the items to
location
Location where the items should be dropped. Default is the location, or if there is none, the location of the holder
naturally
Whether the items should be dropped naturally or not
consumer
Consumer for the spawned items
fun Inventory.addOrDrop(itemStack: ItemStack, dropOverflow: Boolean = true, location: Location = this.findLocation(), naturally: Boolean = true, consumer: (Item) -> Unit = {}): DropResult
Attempts to add all items to the inventory and drops the remaining items to the world.
Receiver
Inventory to add the items to
Return
The result of the operation
Parameters
item Stack
Items to add to the inventory
location
Location where the items should be dropped. Default is the location, or if there is none, the location of the holder
naturally
Whether the items should be dropped naturally or not
consumer
Consumer for the spawned items