MobSpawnEvent partly-disabling

Discussion in 'Plugin Development' started by arjanforgames, Oct 13, 2013.

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


    Why is this not working?
    I want mobs only spawned by eggs but they wont spawn if I try it with an egg. (only noise for a short period of time)
    1. @EventHandler
    2. public void mobSpawning(CreatureSpawnEvent event){
    3. if(event.getSpawnReason().equals(SpawnReason.EGG)){
    5. }else{
    6. event.setCancelled(true);
    7. }
    8. }
  2. Offline


    maybe debug it by broadcasting the reason?
    or Sytem.out.println(event.getSpawnReason());
  3. Offline


    SpawnReason.EGG means when you throw an egg and a chicken spawns. The one you should use is SpawnReason.SPAWNER_EGG.
    tommycake50 likes this.
Thread Status:
Not open for further replies.

Share This Page