June 10, 201411 yr Author 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? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 10, 201411 yr 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
June 10, 201411 yr Author 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? http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 10, 201411 yr 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
June 10, 201411 yr Author I thought about any existing entity :-) http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
June 10, 201411 yr 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
June 10, 201411 yr Author Ok. Thanks a lot! http://i.imgur.com/wNvtGZw.png[/img] MODS and MODDING TUTORIALS
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.