Jump to content

[1.7.10] Entities "unload", entityID and "uniqueness", lifespan and all?


Recommended Posts

Posted

For a while now I've been making some huge changes when it comes to combat in MC. It's time to apply those onto mobs (till now they are all running on Players only).

 

While with players it's pretty simple: player loads, gets effects (like buffs or e.g burn effect) and in case of logout it can all be saved to HDD (I'm using json - better than NBT, because u can edit it like txt), I can't get around working on implementation of whole system for normal entities.

 

What I need are answers.

Situation: World is created, spawn "manager" spawns entities (mobs), now:

 

* Let's have zombie - after player loads some chunk, then leaves it and chunk is unloaded - what happens to the zombie? I belive it is saved somehow (in world ofc.) BUT:

- The "unique" entityID is for loaded entities only (am i right here?), that means there is no injective situation (one-to-one), so how can I track this zombie being loaded again? (you give this zombie effect, shut down MC, start it back and I want to know which zombie it was).

 

* Is it just my delusion or once the mob is spawned it is sometimes not saved? (or never?)

- I never ever wondered about this until now, but - when mob is spawned, and you leave that "loaded" area and later come back - it isn't there. When the mob is saved and when not? Maybe never?

 

* Following question before, assuming that they are not always saved - if something like that happens (mob spawns, I go back far away, and then come back to location where that mob was) what is the maximum range when the entity is not unloaded? Let's say you back 100 away and come back - it is, but if you go 500 and go back it won't be there.

 

* How is night affecting night mobs - are they all just destroyed? What about data saved for them? It all must be somehow being processed, what are key points in entities lifespan (creation, life, death, saving to HDD, nbt)? Where to find those?

 

Hope I can get as much as possible from you guys, any help regarding entity handling is appreciated, links and stuff.

 

Thanks.

1.7.10 is no longer supported by forge, you are on your own.

Posted

Well, you can rather easily do this with NBT, if you aren't opposed to NBT altogether.  Just use Entity.writeEntityToNBT and Entity.readEntityFromNBT, editing the tag in between.

You Only Live Once, So Win At Golf.

Sorry for my English, I'm American.

Posted

@diesieben07

Always can count on you. Thanks pal.

@JavaMatrix

And yup, I'll use that. No need to use my own mob-effect mapping.

 

I don't think there is anything more here, so let's say it's resolved.

1.7.10 is no longer supported by forge, you are on your own.

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.