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'm looking for a way how to save nbt data to the dimension/player/all worlds?

 

So far I found out that entity has getEntityData, but it cannot be used to save data for a player (after death it disappears).

 

I saw that in changlog it is mentioned (per-dimension), but is there any documentation for forge (not javadoc, I can browse through classes in my IDE, but without knowledge of class/method names it's useless)? Tutorials on forge wiki do not cover much :/

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

  • Author

Thank you for fast answer. My mod isn't a core one, is there any other way of storing save-specific or dimension-specific data?

mnn.getNativeLang() != English

If I helped you please click on the "thank you" button.

My method of storing persistent data for worlds, while not being a coremod, is to sideline a data file into the world-save folder, and to use onWorldSave and onWorldLoad events to trigger loading/saving of the data.  I use basically an NBT tag to store it in, and CompressedStreamTools to write it into a file.  A little code for a timestamp (don't want to re-load old data when a new dimension is loaded/reloaded) ,and clearing cache on logout, and you've got a persistent-data system running alongside MC that will load world-specific data.

 

It is kind of ugly, and relies on that file not being separated from the world directory, but it has worked very well for me so far.  Many other mods to the same (or very similar)--e.g. Greg-tech stores IDSU values in such a file, NEI stores world-inventory-saves into such a file--WRCBE stores world-specific frequency info in much the same manner. 

 

For examples of how these work, ChickenBones does release source for his mods, which should show you how/when to load the data.

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.