addItemCorrectly

fun Inventory.addItemCorrectly(itemStack: ItemStack, blockedSlots: BooleanArray = BooleanArray(size)): Int

Adds an ItemStack to an Inventory while respecting both the max stack size of the inventory and the max stack size of the item type.

Unlike Bukkit's addItem method, the ItemStack provided as the method parameter will not be modified.

Return

The amount of items that did not fit.