Started by
ильяlitkak
on
Topic category: Help with Minecraft modding (Java Edition)
and yes, I want to create a backpack, but not which is like an object, but which is like an armor that you put on and open the GUI through the key binding and so that the things inside are preserved, otherwise I open the sword there and it disappears. I know why this happens because every time a new GUI is opened the procedure does not remember that it should be the same GUI if you can help then help
Theres no way to open a bound gui without opening it directly through the item or block, meaning no way to save the items inside. Unless you want to manually save the items using nbt data. For that you would need an nbt for each inventory slot in the gui, or maybe a long string could work. Then on closing the gui, or on tick when gui is open, you would check each slot and register the item within and save that item to a specific nbt. Idk if you would save it as a string or a number, but then you use that to refill the gui slots when opened again. There may also be an easier way using code.