Custom naturally entity spawning in world

Discussion in 'Plugin Development' started by The_Spaceman, Dec 1, 2018.

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

    The_Spaceman

    Is there a way to create your own entity spawning in a world, like that Iron golems spawn as much as sheeps?
     
  2. @The_Spaceman

    The easiest way of accomplishing this would be to use the EntitySpawnEvent to listen for other entities that spawn, in some cases cancel the event and spawn an iron golem. This way is both very clean and very dirty at the same time. It would keep the amount of entities that spawn in the world the same.

    The harder way is using Bukkit.getScheduler().scheduleSyncRepeatingTask to register a Runnable that gets executed every tick. In the run method, you find a random position that is currently loaded and spawn an iron golem there. This way is also a bit dirty, but in a different way. If you do this, the amount of entities that spawn in the world will increase.

    Maybe, there is a really clean way of doing this, but I don't know how to do that if that happens to be possible.
     
Thread Status:
Not open for further replies.

Share This Page