Started by
Computer Chip
on
Topic category: Help with Minecraft modding (Java Edition)
I'm making a new GUI that has no block or item connected to it, just a keybind. Essentially just a second inventory for the player to have but with only two slots. Every time I place an item in either of the slots, as soon as I close it and reopen it, the item has disappeared into thin air. I was curious to know if anyone has a solution because all the other tutorials I have found have proven to be either outdated or have an item or block as a source for the inventory. Is there a way to add an inventory to an independent GUI?
Not bounding a GUI to something is simply making it a screen. In your case, as you only have 2 slots, you can save both slots inside 2 player global vars when the GUI is closed and when you re-open it, you set the itemstack back inside both slots.