Linking the interface to the player

Started by gusmanoff on

Topic category: Help with modding (Java Edition)

Last seen on 11:28, 18. Jun 2024
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Linking the interface to the player

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

Last seen on 12:08, 16. Jun 2024
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Interfaces are inherently…
Fri, 06/14/2024 - 23:21

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.

Last seen on 11:28, 18. Jun 2024
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Yes, but which variables…
Sat, 06/15/2024 - 09:31

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!

Last seen on 12:08, 16. Jun 2024
Joined Mar 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
In the workspace, before you…
Sat, 06/15/2024 - 11:44

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."

Last seen on 11:28, 18. Jun 2024
Joined Apr 2022
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
It's all clear, I didn't…
Sat, 06/15/2024 - 12:08

It's all clear, I didn't quite understand how to link the interface to the player.

Last seen on 21:42, 17. Jun 2024
Joined Jul 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
I'm also curious to how to…
Sun, 06/16/2024 - 14:54

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.