Jump to content

[Solved] static WorldSavedData


Flemmli97

Recommended Posts

I have a WorldSavedData which I have a static field for that gets initialized during the WorldEvent.Load. This saves me for example stuff like client-server sync. Is there a downside to this or something else i am missing if i do it this way?

Edited by Flemmli97
Link to comment
Share on other sites

You should almost never make anything in MC static.

This thing that saves you 'client-server sync'... what happens on dedicated servers? or lan play where there are multiple clients?

Things should be logically separated by the sides/world they are in.

Also, what happens when multiple worlds load? you say it gets initalized in WorldEvent.Load? Well you do know that is called for all dimensions right? And it can be called multiple times for the same world as they are loaded/unloaded.

I do Forge for free, however the servers to run it arn't free, so anything is appreciated.
Consider supporting the team onย Patreon

Link to comment
Share on other sites

ok. what about this then? i have a list of blockpos that i update daily (so i dont have to use ticking tiles). its not a woldsaveddata and since the client doesnt know about it it should be fine? (one instance of the list is created for each world(dimension))

Link to comment
Share on other sites

On 09/05/2018 at 8:04 AM, Flemmli97 said:

ok. what about this then? i have a list of blockpos that i update daily (so i dont have to use ticking tiles). its not a woldsaveddata and since the client doesnt know about it it should be fine? (one instance of the list is created for each world(dimension))

it seems you are trying to improve performance. Why don't you make tickable TileEntities with something like

if (getWorld().getWorldTime() % 200 != 0) return;

in their update() methods? them? this makes them only update every 10 seconds (world time is in ticks, 20 ticks per second)

About Me

Spoiler

My Discordย -ย Cadiboo#8887

My Website -ย Cadiboo.github.io

My Mods -ย Cadiboo.github.io/projects

My Tutorials -ย Cadiboo.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

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.