Started by
gusmanoff
on
Topic category: Help with Minecraft modding (Java Edition)
Hello everyone I created an interface and assigned a button, there are 11 cells in this interface, the problem is that if I put objects there and close the interface, these objects will not be there when I open them. How can this problem be solved? I understand that minecraft actually reads each interface opening as a new one, independent of the previous one. But how to assign nbt to a player or interface, I don't understand
Interfaces are inherently temporary. The way you can make it constant is by storing the states in global player variables if you press the buttons, and calling them when the GUI opens.
Yes, but which variables should I use? And how to work with these variables in procedures? I will be glad if you explain it to me briefly Thank you in advance!
In the workspace, before you open an element, there's a tab on the left that's called "Variables," which are for global variables. Global means they're accessible by all procedures. For each button, you create a logic type variable and name it appropriately.
The scope depends on if you want the button to stay as it is even if the player dies, or resets at death. If you want it to reset, you set the scope to "PLAYER_LIFETIME," and if you want it to stay, you set it to "PLAYER_PERSISTENT."
It's all clear, I didn't quite understand how to link the interface to the player.
I'm also curious to how to achieve this. I cannot get global player persistent itemstack variables to place items in an items GUI when the item is new and I open the GUI, it just shows empty itemstack. If you learn any more updates are appreciated.
I wanted to make something like a second inventory but didn't know how. Can you please tell me and others here how to link it to a player in procedure?