Solved Can't use isDead on a mob that spawns in with no players nearby

Discussion in 'Spigot Plugin Development' started by Xsm0deus, Jun 6, 2018.

  1. So I have a wither that spawns in, in an arena automatically. If there are no players in the arena when it spawns it, it messes it up and doesn't let me use isDead() on it to check if it's dead or not. I already have the chunks load in where the Wither Spawns in (because before it wasn't spawning in at all) and that fixed the spawning issue but now I have this problem.

    Update: This also applies whenever the mob goes in an unloaded chunk
    #1 Xsm0deus, Jun 6, 2018
    Last edited: Jun 6, 2018
  2. What do you mean by that? Maybe you can elaborate on what you are trying to do and what you expect from isDead().
    If the wither behaves like any other entity, then isDead() should return true if the chunk with the wither in it gets unloaded (because entities get marked as dead once removed from the world, which happens on chunk unloads as well). If you want to know if the wither is still 'alive' without there being players nearby, either manually load the chunk the wither was last in, or keep track yourself whether the wither has actually died.
  3. isDead doesn't work if the mob goes in an unloaded chunk, I found another solution anyway.