Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

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.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.