Jump to content

Recommended Posts

Posted

OK, I now created (a little bit different from what you said) a scheduler which calls every tick every object in the active task list. With a task object you can do anything you want, so I can use it also for other things.

 

But now I have the same problem I mentioned above: I want to save the running tasks. I can save a presistant UUID for an Entity, but I don't know how load a Entity from its UUID. Anyone who knows this?

Posted

Are you talking about the player again?

 

You can write some code to save that list to file and then load again, but why.

 

As you cycle through the players, if they meet the criteria, add a value to their NBT data  (player.getEntityData or something like that) for your mod.  If they don't meet the criteria remove the tag and take them off your list.

 

If you really want the first, i can give you an example, but the NBT is the way to go.

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

Well actually I don't want to do this only for player but for any Entity, but I don't think this changes much.

What I don't understand is how to get the player(or entity) you marked before via NBT. Im thinking about a kind of a waiting loop (via the onEntityJoinWorldEvent) where the task for the player waits until the player comes online and then starts executing again. Is this something like you thought about?

Posted

For the player, just check when you cycle through player list if thye have the tag and then add them to the arraylist if they are not there yet.

 

For Entities, what entities?  custom ones or current ones?

Long time Bukkit & Forge Programmer

Happy to try and help

Posted

You could do the same NBT data look for entity.

 

Probably only interested in ones that are a certain distance from players.  Rather than keeping a list, might be easier to search for all most within 50 blocks of the player and applying if their NBT data has the tag.

Long time Bukkit & Forge Programmer

Happy to try and help

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.