Inventory Tweaks [1.12 only]

Inventory Tweaks [1.12 only]

127M Downloads

Don't empty slot when needed item is not available

bendem opened this issue ยท 3 comments

commented

It would be great to have an option like the locked or the frozenones to avoid emptying slots when the item which should replace the one in the sloot is not available...

commented

Unfortunately the sorting doesn't know if a matching item exists in general -- it only knows if the item it is currently moving matches or doesn't match specific slots.

commented

Hm... I should look further the code to see if i can think in a way of doing it, but I've trouble to really understand what's going on in the sorting handler... I'll look into that when I'll have figured out how it works.

commented

The sorter is very... 'dumb' to use a simple word. It just goes through every possible pair of slots (twice), swapping the items in them if it determines that is a better match than where they were. (Checking the rules first, then the generic ordering from isOrderedBefore)

Look at move() and canSwapSlots() in the sorting handler class. The config stuff for the payer inventory ultimately comes from ConfigInventoryRuleset which does all that parsing.