Spawning mobs when they are disabled in server.properties

Discussion in 'Plugin Development' started by oliverw92, Feb 15, 2011.

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

    oliverw92

    Hey all,

    I'm working on a plugin that replaces Minecraft's built in spawning algorithm with one that is 100% adaptable. I have my algorithm mostly working now but i have hit a wall.

    To spawn a mob at the moment there is no built in Bukkit method or class to use, so i'm using a combination of Craft* mob classes and net.minecraft.server.Entity* classes. I can get the mobs to spawn if animals and monsters are turned on, but as soon as i turn it off the minecraft server despawns them as soon as i create them.

    I've been trawling the Javadocs and i've found it all comes down to this function in net.minecraft.server.World where minecraft actually attatches the mob to the world:

    Code:
    00765     public boolean a(Entity entity) {
    00766         int i = MathHelper.b(entity.locX / 16.0D);
    00767         int j = MathHelper.b(entity.locZ / 16.0D);
    00768         boolean flag = false;
    00769
    00770         if (entity instanceof EntityHuman) {
    00771             flag = true;
    00772         }
    00773
    00774         if (!flag && !this.f(i, j)) {
    00775             return false;
    00776         } else {
    00777             if (entity instanceof EntityHuman) {
    00778                 EntityHuman entityhuman = (EntityHuman) entity;
    00779
    00780                 this.d.add(entityhuman);
    00781                 System.out.println("Player count: " + this.d.size());
    00782             }
    00783
    00784             this.c(i, j).a(entity);
    00785             this.b.add(entity);
    00786             this.b(entity);
    00787             return true;
    00788         }
    00789     }
    
    One of the functions 'c' or 'b' in the World class must have something in it that checks the server.properties file. Does anyone have any idea how I could get around this?

    I should also point out that I'm using Rhino and JavaScript for this plugin - personal preferance :)
     
Thread Status:
Not open for further replies.

Share This Page