How do you make custom variables on a block binded GUI?

Started by Mecho on

Topic category: Help with modding (Java Edition)

Last seen on 06:38, 6. May 2024
Joined Feb 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do you make custom variables on a block binded GUI?

So basically, I have a block entity which is an oven and a GUI which has been binded to the block. However, I'm trying to create a hidden variable "charge", represented by a battery in the bottom left corner. The battery is split up into 5 levels of charge, but the hidden variable should range from 1-100%.

 

I can easily create the battery,  but what I need is a hidden variable which should be unique to the block and able to be called from any component on the gui.

 

I've already tried adding nbt tags to the block, but I ran into a problem when the GUI could not provide the x, y and z of the block I'm attempting to open the GUI with