Way of telling if an Entity was spawned from a spawner?

Discussion in 'Plugin Development' started by JustinsCool15, Aug 5, 2014.

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

    JustinsCool15

    Is there anyway of (efficiently) telling if an Entity was spawned from a mob spawner?
    Thanks in advance.
     
  2. Offline

    NathanWolf

    I'm not sure if there is a way to find out after the fact, but you could catch the CreatureSpawnEvent, and then throw the SpawnReason on some Metadata attached to the Entity.

    Then you'd be able to tell what spawned an Entity by looking at your Metadata.
     
  3. Offline

    FabeGabeMC

  4. Offline

    Louisfx

    JustinsCool15 Try this:
    Code:java
    1. public void onEntitySpawn(CreatureSpawnEvent e){
    2. if(e.getSpawnReason().equals(SpawnReason.SPaWNER)){
    3. //your code....
    4. }
    5. }
     
Thread Status:
Not open for further replies.

Share This Page