Solved Natural Ender Dragons

Discussion in 'Plugin Development' started by ColonelHedgehog, Oct 29, 2014.

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

    ColonelHedgehog

    Hi,

    I was wondering if there was a way to naturally spawn Ender Dragons the way ordinary mobs spawn. My hope is to accomplish this without timers and without using random integers as the player moves about.

    I know the answer is probably right in front of me, but could anyone point me in the right direction?
     
  2. Offline

    MineStein

    Code:java
    1. EnderDragon dragon = World#spawn(Location, EnderDragon.class);
     
  3. Offline

    teej107

    CreatureSpawnEvent. Just "hijack" a creature's spawn by cancelling the event and spawning the enderdragon. I would imagine spawning an EnderDragon would trigger a CreatureSpawn event so make sure you don't create an endless recursive loop with the spawning of the EnderDragon. There also was some thread I saw in the resources section about the dangers of cancelling a spawn event and the garbage collector however I've failed to find it.http://forums.bukkit.org/threads/important-information-regarding-cancelling-creature-spawns.147007/
     
  4. Offline

    ColonelHedgehog


    Hi,

    Yeah, I don't see how the recursive loop could be a problem (I could just check if it was an Ender Dragon and cancel it based on that).

    The thing is, if I had to go the cancel-the-spawn-event route, then that'd mean spawning the ender dragon on the ground and having it stuck, or worse, destroy the area.
     
  5. Offline

    teej107

  6. Offline

    ColonelHedgehog

    I was kind of hoping for something a little less hackish. You see, my map is very large and open, with floating islands scattered about. I'd like to make it so the Ender Dragons just start chasing you and stuff while you're exploring the nothingness.
     
  7. Offline

    teej107

    Well if you don't want to use Minecraft's natural spawning, then you would have to create your own. I think using MC natural spawns would be best though. It would be as simple as when a creature spawns, generate a random number, comparing it, and then spawn the dragon at the same X and Z values with Y higher up.
    If you want it to happen when players explore, you could spawn the dragon when chunks load.
     
  8. Offline

    ColonelHedgehog

    Ah, chunk loading. Capital idea. Thank you! :)
     
Thread Status:
Not open for further replies.

Share This Page