Crash when using Crafting Station with Storage Drawers.
Darkere opened this issue ยท 7 comments
Crashlog and video can be found here: EnigmaticaModpacks/Enigmatica4#240
craftingstation-2.1.3c.jar
StorageDrawers-1.14.4-6.0.5.jar
forge-28.1.109
I guess I don't understand based on this and the linked stack trace. Where does the SlotItemHandler come from, and where did it get an instance of a drawer IItemHandler? Within my own code base, I do not subclass or invoke SlotItemHandler anywhere.
Drawer tiles don't implement IInventory and they can't be wrapped like normal MC inventories (they are not traditionally slot-based so there is also no valid interpretation for IItemHandlerModifiable).
I'm not familiar with the crafting station mod, but if it's interacting with nearby inventories, SD can only be interacted with via IItemHandler directly or its own IItemRepository.
what the crafting station does is take side inventories and wrap their slots so that they can be interacted with from the container, hence where the drawer iitemhandler comes from.
The problem here and what is causing the crash is the default implementation of putStack in SlotItemHandler has a cast to IItemHandlerModifiable which is meant to be overridden for IItemHandlers that are NOT IItemHandlerModifiable. The issue here is when the station tries to call putStack to handle the slot's actions but it's not an IItemHandlerModifiable so it get's a crash instead.
I can't override putStack in SlotItemHandler because I don't extend or use SlotItemHandler anywhere.
The issue is that when you look for adjacent tile inventories, you are only checking for the existence of an IItemHandler, and then applying a slot wrapper around it (you're creating the SlotItemHandler instances yourself). You need to do the check yourself to make sure the handler you found is an IItemHandlerModifiable (or subclass SlotItemHandler yourself to perform that same check). As it stands, I would expect this to crash for any side inventory that does not implement its handler as modifiable.
Unless you update your inventory handling to deal with IItemHandlers on a more generic basis (which includes accepting or returning stacks in excess of 64), you'll need to blacklist SD's blocks. They are not compatible with a basic slot overlay. Though the modifiable test would also be enough to blacklist it.
yeah, I'm just going to blacklist non IItemHandlerModifiables from being picked up as a side inventory as slotless iitemhandlers don't play nice with the station at all.