Solved Questions about entity spawn being cancelled and translucent entity

Discussion in 'Spigot Plugin Development' started by inrh, Feb 5, 2020.

  1. I am currently developing imiPet, a free pet plugin.
    I have no problem testing, but some users have these bugs:

    1.entity spawn being cancelled
    Actually, entity use the wolf type, Users say that wolf eggs can spawn,
    But it disappears after the entity is spawn,
    I suspect that for some reason preventing spawning (such as the Residence plugin preventing animal spawning)
    So, I want to know what scheme can force the spawn of the entity, and will not be prevented from spawning.

    2.translucent entity
    Picture says it all(Picture from a user).
    [​IMG]

    I'm troubled by this, and I can't find the cause and solution.
    Thank you.
     
    #1 inrh, Feb 5, 2020
    Last edited: Feb 5, 2020
  2. You should ask him, how to replicate thee bug and show us your code.
     
  3. 1) use @EventHandler(ignoreCancelled = true) next to your entity spawn event. Therefore, even if the event is cancelled, your code will still run.
    2) Gonna need more info to help you with that. Maybe try showing some code related to your issue.
     
    • Like Like x 1
  4. 1.;)Thank you very much!
    2.I don't know why he can see the semi-stealth entity.
    But I didn't see it.
     
  5. If you can't see it, let the user know that you can't recreate the issue, and ask for more information. Server Version, Plugins, Current Gamemode, etc.
     
  6. I seem to be prematurely happy, and users have reported BUG: Although the entity will not disappear, the entity will be deleted after a while.
    I suspect it is a plugin like clear, how can this prevent it from being cleared?
     
  7. l
    Maybe try listening for EntityDeathEvent, and see if it is one of your armor stands. If it is, cancel the event.
     
  8. Is there no other way?
     
  9. I believe that is the only way.
     
  10. Unfortunately, EntityDeathEvent does not have a setCancelled method
     
  11. When it gets despawned just spawn in an exact copy of it
     
  12. Seems like your translucent mobs is how invisible entities render in spectator
     
  13. I found the right way:
    world.addEntity (entity, CreatureSpawnEvent.SpawnReason.CUSTOM);