Solved Entity Despawn Event!

Discussion in 'Plugin Development' started by ThaH3lper, Oct 9, 2012.


Do you want EntityDespawnEvent

  1. Yes!

  2. Nope

    0 vote(s)
Thread Status:
Not open for further replies.
  1. Offline


    I work with a plugin that handels alot of entitys etc... However I need to know when they despawn so I can save them, But there is no way to do this :( Is it hard for bukkit to add a EntityDespawnEvent?
  2. Offline


  3. Offline


    Do you mean when they die of old age? You can probably use EntityDeathEvent for that.

    Or do you mean when they're unloaded from memory and saved to the map? If so, use ChunkUnloadEvent and enumerate every entity in that chunk. That should give you every "despawned" entity.
  4. Offline


    But doesn't the mobs despawn when player gets too far away... Or is it only the chunk that is calculated? Are you suere it works to 100%?
  5. ThaH3lper AFAIK Entities are saved with the chunk. So if a player moves to far away the chunk unloads with all entities in it, but if a player comes back nearby the chunk loads again with all saved entities.
  6. Offline


    AFAIK Entities? Will it have same ID? and monsters despawns when chunk unloads and loads...
  7. Offline


    "As far as I know"

    and you need to specify what you want here. Are you talking about passive/tameable mobs, or are you talking about monster mobs? What is your goal here, so we can respond with useful information?
  8. Look for yourself what is saved and whatnot: (keep in mind that some entities may overwrite this function...)
    monsters are entities, aren't they? Did you never get to some place in the world and wondered why there are monsters burning at the afternoon? It's because the chunk unloaded at night but reloaded at day...
  9. Offline


    Hmm.. it looks like it saves but they don't have sme ID :/ However, I made my own "despawn" so I know exactly when a mob despawns etc...
  10. ThaH3lper Did you try to use the UUID instead of the ID? Keeping every chunk a mob is in loaded may be a bad idea... ^^
  11. Offline


    No, When there is no player within 40blocks then force despawn mob and save it, then if player comes 30blocks close to it spawn mob again :)
Thread Status:
Not open for further replies.

Share This Page