
[Bug] Item Output Hatches constantly try to output to full Storage Drawer drawers
jchung01 opened this issue ยท 2 comments
(Using latest version r31)
Item output hatches will try to auto-output to full drawers from the Storage Drawers mod in a laggy way due to Storage Drawer's usage of a "virtual" slot. The reason for the lag is that each slot in the hatch will be replaced by itself unchanged due to being allowed to call setStackInSlotStrict
when trying to insert into the virtual slot. This is roughly the explanation:
The performance of the auto-output function of Item Output hatches depends on checking if the inventory's item slot(s) are full. This check does not behave correctly with auto outputting to drawers because these drawers utilize a "virtual" slot at slot 0 that is always empty. When the hatch inserts an item into the virtual slot of a full drawer, the returned notInserted
ItemStack will just be returned unchanged. So even though the drawer/its real slot is "full", the hatch does not know that while checking the virtual slot, iterating through the hatch's slots. This means that the hatch is ticking more than it usually would for auto-outputting to a full inventory with the lag scaling off the number of slots in the hatch that have the item.
I believe one workaround would be to add an extra break
safeguard against inserts that return the ItemStack unchanged in the internal loop by checking notInserted.getCount() == internalStack.getCount()
.
Here's a comparison using LagGoggles of an Item Output Hatch's tick time when auto-outputting to a full drawer (indirect fullness due to virtual slot) vs vanilla inventories (can directly check fullness):
Thanks for the feedback, I will add this judgment to R32.
Also I may plan to rewrite some of the output logic to reduce the performance consumption in some special scenarios.