Jump to content

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


MrChoke

Recommended Posts

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.

 

Link to comment
Share on other sites

37 minutes ago, MrChoke said:

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

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?

 

39 minutes ago, MrChoke said:

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

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.

Link to comment
Share on other sites

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/

 

Link to comment
Share on other sites

3 hours ago, 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/

 

Or capabilities

About Me

Spoiler

My Discord - Cadiboo#8887

My WebsiteCadiboo.github.io

My ModsCadiboo.github.io/projects

My TutorialsCadiboo.github.io/tutorials

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)

Link to comment
Share on other sites

4 minutes ago, Cadiboo said:

Or capabilities

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.

Link to comment
Share on other sites

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.



×
×
  • Create New...

Important Information

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