like to determine how many more items fit in a slot, it does slot.getMaxStackSize() - stack.getCount()
, then it removes that many items from the package, and tries to add them into the corresponding slot. if there are any left over after the addition, it logs an "oops didn't think this was possible please report this!" message and deletes the leftovers
in 1.20 slot.getMaxStackSize returns 64 so it thinks there is room for 48 more stacks-to-16 than there really is.
in 1.21 it returns 99, so it was thinking there is room for 35 more of any item
however !
the "extract items from a package into a slot" code is triggered in only two ways
- right clicking a package onto an empty slot
- right clicking a completely full package onto a partially-filled slot containing the same item
but it will not remove more than one stack of items at a time from the package (computed via the correct getMaxStackSize function). so if you click items into an empty slot it will always function correctly.
and that is the vast-majority of package right clicks. if you right click a package which is not literally 100% full onto an item, it will instead take items from the slot and add them to the package, which is a different function that's not buggy