Where is the Breeding Event

Discussion in 'Plugin Development' started by Diemex, Feb 22, 2013.

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

    Diemex

    I would like to change the way breeding works. I tried to look for a breedingEvent, but it seems like the EntitymakeLoveEvent doesn't exist anymore.
    I can cancel the spawning of animals by doing something like this:
    Code:java
    1.  
    2. @EventHandler
    3. public void onEntitySpawn(CreatureSpawnEvent event)
    4. {
    5. if (event.getSpawnReason().equals(SpawnReason.BREEDING))
    6. {
    7. event.setCancelled(true);
    8. Entity animal = event.getLocation().getWorld().spawn(event.getLocation(), event.getEntity().getClass());
    9. if (util.isAnimal(animal))
    10. {
    11. //cast to an animal
    12. animal.setBaby();
    13. }
    14. }
    15. ]

    But that doesn't cancel the actual event, e.g the exp you get from breeding...
    I tried to find out if I could display the hearts on animals, but it seems like that's not possible atm. If so I could set breed animals to no be breedable and display the hearts on an animal once you right click with wheat. Then just spawn my animal similar to the above code. http://forums.bukkit.org/threads/putting-an-animal-into-breeding-mode.116154/

    I basically just need to cancel/change the exp you get from breeding. The actual changes I plan to do to breeding I can perform using the CreatureSpawnEvent.

    Ps: Stop deleting the formatting of my code every time I edit my post.
     
  2. Offline

    Nitnelave

    PlayerInteractEntityEvent might be what you're looking for. You can detect if the interaction will lead to breeding, and implement your own actions.
     
Thread Status:
Not open for further replies.

Share This Page