[bug] 'Fill Recipe' Button Not Respecting Slot Max Count
fzzyhmstrs opened this issue ยท 7 comments
When a crafting block has a handler for auto-moving ingredients and you shift-click the [+] button, EMI will move items into slots beyond the slots stated maximum count via getMaxItemCount
. As an example, I am integrating EMI into my mod, and the Imbuing Table crafting grid has a central slot with a maximum allowable item count of 1:
But when I use the shift click, EMI transfers 8x melon slices into the middle slot in the below example:
With this behavior, if the user were to press the craft button for "4x Imbued Quartz", 7 of the melon slices are going to be overwritten, as the middle slot is both an input and an output (because it is an enhanced enchanting table), like so:
(I'm in creative mode, so the other 12 ingredients didn't decrement on purpose)
Possible Solution:
If EMI is using setStack
in the Slot
, instead using insertStack
may resolve this. insertStack
automatically splits the inserted stack based on the allowable count, and returns the remainder that couldn't fit.
Definitely. What part of the code are you looking for? Below is my init in the screenhandler; it uses a fairly typical addSlot
implementation. ImbuingSlot
is just a tweak of vanilla slots that lets me shunt setStack to the inventory itself rather than having to pass through the slot (does nothing but avoid a redundant markDirty()
call). I only use that functionality with REI because it was causing a massive blast of "onContentChanged" every time you transferred something...
I found where I went wrong with this, it's good that it's not filling the restricted slot, but I missed a line that did restriction properly, should be in the next update