Bypass Lighting Level when spawning mobs

Discussion in 'Plugin Development' started by javaguy78, Sep 22, 2012.

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

    javaguy78

    So, I am working on my Zombie SMP Plugin (DayZ/MineZ clone) and I've got zombies running faster and doing more damage. it's great. BUT the one thing I can't do is allow them to spawn in the day.

    I even went as far as to write my own spawning algorithm which does this:

    Code:
                        net.minecraft.server.World mcWorld = ((CraftWorld) world).getHandle();
                        FasterZombie toSpawn = new FasterZombie(mcWorld);
                        toSpawn.setPosition(spawnLocation.getX(), spawnLocation.getY(), spawnLocation.getZ());
                        mcWorld.addEntity(toSpawn);
    but, even though I am simply adding an entity to the world, the FasterZombie (who extends EntityZombie) won't spawn unless it meets all of the requirements for a zombie to spawn (light level < 8, players not too close, etc). I'm trying to find a way to bypass all of that crap so I can just add zombies to the world without worrying if someone is too close or if the sun is shining.

    I tried overriding canSpawn:

    Code:
    @Override
    public boolean canSpawn() {
        return true;
    }
    I tried overriding o() in EntityCreature:


    Code:
    @Override
    public boolean o() {
        return true;
    }
    I can't, for the life of me, cause zombies to spawn without it doing all of it's stupid checks. Somehow, the ZombieSpawnEgg is able to add an entity to the world without all the checks, so why can't my code?

    If anyone knows how to get zombies to spawn in the day or in light levels higher than 8, please let me know.

    Also, I've already searched and found a bunch of threads where people ask the same thing, I've decompiled Bukkit and Minecraft to find out what's going on. So please don't simply point me to the Bloodmoon modify-your-entities tutorial. I've read it 17 times. I just need a way to add a creature to the world like the spawn egg, without having to use the spawn egg.
     
  2. Offline

    valon750

    javaguy78
    I'll be following this post, as I too am working on a project involving custom entities, and wish to have them spawn from spawners.
     
  3. Offline

    Geekxboy

    Its really not worth the effort of modifying the zombie spawning requirements

    For my old server I just chose a random player every specific amount of server ticks.
    Chose a randomized location near the player with
    Code:java
    1. Location randLoc = p.getLocation().add(new Random().nextInt(128) - 64, 0, new Random().nextInt(128) - 64);


    And then spawned a zombie at that location
     
Thread Status:
Not open for further replies.

Share This Page