EMI

EMI

1M Downloads

[bug] 'Fill Recipe' Button Not Respecting Slot Max Count

fzzyhmstrs opened this issue ยท 7 comments

commented

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:
image

But when I use the shift click, EMI transfers 8x melon slices into the middle slot in the below example:
image

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:
image
(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.

commented

Is the intended behavior after the update to simply not fill the restricted slot at all? (Pic below after shift-clicking the recipe in 0.3.1)

image

commented

Nope, this isn't intended, rats, can I see your code?

commented

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...

https://github.com/fzzyhmstrs/ai/blob/3e5842428bf292af033cbd852073ba9770ea2908/src/main/kotlin/me/fzzyhmstrs/amethyst_imbuement/screen/ImbuingTableScreenHandler.kt#L104

commented

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

commented

Oh inventory max count and how it plagues us forever. I'll get this fixed.

commented

Fixed in 0.3.1

commented

Fixed (properly, hopefully) in 0.3.2