Get size for specified mob in CreatureSpawnEvent?

Discussion in 'Plugin Development' started by BioBG, Mar 27, 2016.

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


    Hello Guys!
    How can i get how may mobs are spawned in area from specified type and make changes only one or few of them ?

    example: get how many horses are spawned and make one skeleton, one zombies, rest normal
  2. Offline


    • On CreatureSpawnEvent
    • First, set up either a "chance" value to see how many of the entity will be modified, or set up a counter for how many out of 'x' entities will be modified.
    • Use Entity#getNearbyEntities(radius,radius,radius) to get all of the nearby entities in the area.
    • Loop through all the entities in that collections.
    • If that entity is the one you're testing for.
    • If the "chance" value or the counter is set to a value meaning it should be modified.
    • //modify the entity
Thread Status:
Not open for further replies.

Share This Page