ID of an entity changes over time?

Discussion in 'Plugin Development' started by Lodran, Apr 9, 2011.

Thread Status:
Not open for further replies.
  1. Offline

    Lodran

    In creaturebox, I track a spawner's entities from life to death, by recording its entity id when I spawn it, and waiting to see a creature with that entity ID disappear from the world's getLivingEntities() array.

    I'm finding that my spawners sometime continue spawning creatures even though they shouldn't be.

    As an experiment, I made a wolf spawner and set it's limit to 4 wolves. I tamed all 4 wolves that it spawned, and parked the tame wolves away from the spawner (in a nearby chunk).

    The spawner stopped making wolves, as I expected, so I went elsewhere for awhile (long enough for both chunks to be unloaded).

    When I came back to check on things, I found that the spawner had created 4 more wolves (believing that the 4 original wolves had died), but the 4 tamed wolves were still parked where I left them.

    So, my question is, do entity IDs change when a chunk is unloaded and reloaded? If they do, is there any reasonable way to track entities?
     
  2. Offline

    SpaceManiac

    I don't think the entity IDs change - just when an entity isn't inside a loaded chunk, getLivingEntities doesn't return it.
     
Thread Status:
Not open for further replies.

Share This Page