BastouP Posted May 29, 2020 Share Posted May 29, 2020 (edited) Hey everyone ! I can't find a way to create a container with an ItemStackHandler, the only thins I find are with Inventories. Does someone know how to do it or is there a good tutorial/explaination somewhere ? Thanks ^^ Edited May 30, 2020 by BastouP Quote Link to comment Share on other sites More sharing options...
Choonster Posted May 29, 2020 Share Posted May 29, 2020 Use SlotItemHandler. Quote Please don't PM me to ask for help. Asking your question in a public thread preserves it for people who are having the same problem in the future. Link to comment Share on other sites More sharing options...
TheGreyGhost Posted May 30, 2020 Share Posted May 30, 2020 (edited) 16 hours ago, BastouP said: Hey everyone ! I can't find a way to create a container with an ItemStackHandler, the only thins I find are with Inventories. Does someone know how to do it or is there a good tutorial/explaination somewhere ? Thanks ^^ Howdy You could get some clues from the Botania mod, it uses ItemStackHandlers and Capabilities instead of IInventory eg ItemFlowerBag. https://github.com/Vazkii/Botania/blob/master/src/main/java/vazkii/botania/common/item/ItemFlowerBag.java The only potential problem with SlotItemHandler and ItemStackhandler instead of IInventory is that IInventory is also used by vanilla to tell the source container (typically TileEntity) that the GUI has modified the slot contents (marked it as "dirty"). But SlotItemHandler and ItemStackhandler don't do that. There are some knowledgeable folks on this forum who think that it doesn't matter because the source container is marked as dirty in other ways; they might be right although I'm not convinced yet. I haven't tested it empirically yet (on my to-do list). Up until now I've played it safe and wrapped the ItemStackHandler in an IInventory. If you decide to test it yourself, please let me know... -TGG Edited May 30, 2020 by TheGreyGhost 1 Quote Link to comment Share on other sites More sharing options...
BastouP Posted May 30, 2020 Author Share Posted May 30, 2020 Hey ! I managed to make it work ! There was just ( again ) an event problem which made my GUI not registering. Now it seems to be working, I'll let you know if I encounter any problem. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.