cpw / inventorysorter

Inventory Sorter
60 stars 47 forks source link

Sorting ignores item stack size restrictions on slots. #172

Open alcatrazEscapee opened 1 year ago

alcatrazEscapee commented 1 year ago

As an example, using the TerraFirmaCraft mod, which has a stack-size 16 slot in small vessels, inventory sorter will sort items into these slots ignoring the stack size restriction of the slot (as opposed to the stack).

With a quick look, I believe this is due to not properly checking stack limits here:

https://github.com/cpw/inventorysorter/blob/44601da8044fb492d4387e15a0513d1a3f728ae8/src/main/java/cpw/mods/inventorysorter/SortingHandler.java#L153

It is not sufficient to check ItemStack.getMaxStackSize(), you should be taking the minimum of that and Slot.getMaxStackSize() (or, use the method Slot.getMaxStackSize(ItemStack).)