Started by
Kylebutter123
on
Topic category: Help with Minecraft modding (Java Edition)
I think i wrote the NBT read and write code correctly so the variable saves when i save and quit the world and rejoin..
But if i close the client and reopen it it resets the variable entirely. I saw that the code was resetting the variable back to 0 each time but i have no idea how to remove that.
Any help with this problem now?
Edited by Kylebutter123 on Fri, 08/09/2019 - 17:56
This happens because you are using GLOBAL_SESSION which is only persistent per session.
I tried using the other variable scopes but now it doesnt save at all when i exit and rejoin my world.
Which procedure trigger do you use to set the values of these variables?
On block right click which adds 1 to the variable each time i right click the block
Where do you read the value of this variable after you set it? By where, I mean how is the procedure which reads this value triggered?
i have a gui that also opens when I right click the block which helps me track how much i right clicked the block.
And you show the value in GUI label or where?
i show to value of the variaible on the top of the gui
GUI works on the client side, while global map and world variables work on server side. I will make a wiki page explaining this soon. What you need to do is set global map/world variable in the procedure like you do now, but then copy the value of global map variable by getting its value and set global session variable to its value. Global session variables work on the client side too and can be then used in GUIs for display.
This worked extremely well! Thanks Klemen
You are welcome!