Completely changing mob spawn conditions.

Discussion in 'Plugin Development' started by WinSock, Feb 19, 2011.

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

    WinSock

    Ok yes i know there is a hook for CREATURE_SPAWN but that only gets called after the server decides that it wants to spawn a monster / it is valid. What i would like to do is to change / modify on the fly several aspects of the mob spawning conditions like:
    • Spawn rate
    • Required light level
    • Distance from player to spawn
    • Altitude
    • What blocks it can spawn on
    You can do some checks with CREATURE_SPAWN, but the server first checks it's own rules. I know it has to be somewhere in the minecraft server source but i cannot read though the obfuscation. Does anyone have insight on how to change the rules not just add more after it decides to spawn?
     
  2. Offline

    Edward Hand

    If you were hoping to be able to just change a few variables I'm afraid you're out of luck. I found the class for controlling mob spawn conditions. Its net.minecraft.server.SpawnerCreature. I can see the checks for space, material, and player proximity in there and they're all hard-coded in - no way to change the parameters without modifying the class directly.

    Your only alternative would be to manually write a whole new set of mob spawning rules and procedures into a class in your plugin and somehow block spawns from minecrafts spawner class and only allow spawned mobs from your own spawner class.

    That's just asking for trouble though.

    (obviously anything that involves not spawning mobs where minecraft usually would is doable with bukkit as is though.)
     
  3. Offline

    WinSock

    I cannot find that class anywhere i look. I see its reference in World.java(line 1489) but besides that i see no other reference.
     
  4. Offline

    Edward Hand

    Yes. That is the only place it is called as far as I can see. That function call initiates all the mob spawning stuff. The three parameters are world, spawn-monsters and spawn-animals respectively.
     
  5. Offline

    WinSock

    What is the file named that it is contained in? Because i'm going to try to make my own CreatureSpawn class(Yes the impossible)
     
  6. Offline

    Edward Hand

    net.minecraft.server.SpawnerCreature
    Here is the entirely unhelpful javadoc page, just to prove it does exist: http://javadoc.lukegb.com/BukkitJD/net/minecraft/server/SpawnerCreature.html
    Best of luck!
    ;)
    --- merged: Feb 20, 2011 12:32 AM ---
    Oh, but you wont find it on github though. You'll need to decompile the crafbukkit jar to get at it. That might be why you cant find it. I should have realised.
     
  7. Offline

    WinSock

    ok so whats the obfuscated name?
     
Thread Status:
Not open for further replies.

Share This Page