Jump to content

How do objects like "PathNavigate" and many others persist across saves?


Recommended Posts

Posted

I'd like to understand more about how minecraft saves data.  I know there is NBT reads and writes but I don't think that is used for everything is it?  Let me use an example for my question.  On EntityLiving is this member:

 

protected PathNavigate navigator;

 

It holds a variable that I know persists across saves and reloads of the game:

protected Path currentPath;

 

So how is this data saved?  I don't see any NBT read/write code for it.  Does it do something like serialize and write the whole Entity object out to file? 

 

Any help to understand this would be great.

 

Posted
  On 10/11/2018 at 12:04 AM, MrChoke said:

I know there is NBT reads and writes but I don't think that is used for everything is it?

Expand  

It is used to save everything, what logical thought process would lead a developer to create two different types of saving methods for one game?

 

  On 10/11/2018 at 12:04 AM, MrChoke said:

It holds a variable that I know persists across saves and reloads of the game:

Expand  

How do you know said variable persists?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted
  On 10/13/2018 at 9:36 PM, MrChoke said:

So yes I agree, it must only be NBT reds/writes that get things saved.  Turns out that path var and many other things actually get re-initialized from scratch when a world is loaded.

 

So if I want to save my own data to the a save, I guess I use what is explained here:

https://mcforge.readthedocs.io/en/latest/datastorage/worldsaveddata/

 

Expand  

Or capabilities

About Me

  Reveal hidden contents

Versions below 1.14.4 are no longer supported on this forum. Use the latest version to receive support.

When asking support remember to include all relevant log files (logs are found in .minecraft/logs/), code if applicable and screenshots if possible.

Only download mods from trusted sites like CurseForge (minecraft.curseforge.com). A list of bad sites can be found here, with more information available at stopmodreposts.org

Edit your own signature at www.minecraftforge.net/forum/settings/signature/ (Make sure to check its compatibility with the Dark Theme)

Posted
  On 10/14/2018 at 1:25 AM, Cadiboo said:

Or capabilities

Expand  

Capabilities just wrap around World Saved Data. However it may need to be an entity capability if it is something like the provided example.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

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...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Announcements



×
×
  • Create New...

Important Information

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