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

Started by Mecho on

Topic category: Help with Minecraft modding (Java Edition)

Active 2 months ago
Joined Feb 2023
Points:
248

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 31
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