Posted March 17, 201510 yr I want to create a WorldSavedData object that records information that may happen as frequently as once every few seconds (let's say an object that records how many times a player has jumped since world creation, for example). I have the class for my WorldSaveData object written, including all of the appropriate methods (e.g. readFromNBT, writeToNBT, and mutator methods for updating the variables in my object). I am able to access the object using the static get method, and have subscribed an event handler for dealing with my event (player jumping, for example). Also, after the event handler has called the mutator method to update the variable, the WorldSavedData is marked as dirty. However, when I try to use the event handler to update my object (the number of times a player has jumped) it doesn't seem to update the correct value. It seems that the variable has not yet been saved to the NBT format and so I'm only able to access the last-saved number of jumps the player has made. Is there a way to force the game to call the writeToNBT method after updating my variable? Is this even desirable? Or is there some other way of achieving my goal that I have overlooked?
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.