Changing Zombie Movement speed, Health, Attack

Discussion in 'Plugin Development' started by Haxir, Jul 16, 2012.

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

    Haxir

    Just curious, have a plugin in development where this would be necessary. I was reading and know you can't use potion effects on mobs so that knocks out my first idea.

    Say for a special zombie, it would have x4 normal zombie health and walk x2 faster. Can it be done without spout ?
     
  2. ferrybig likes this.
  3. Offline

    Haxir

    Thank you kind sir :]
     
  4. that tutorial doesn't actually explain much, nor does it change the mob speed
     
  5. CorrieKay is our mob expert and she also has answered many threads abhout that, so use the search function.

    BTW: CorrieKay Why don't you answer to my PM? :'(
     
  6. an not working picture?
     
  7. i know she is da boss on them mobs. but there is still not to this day, a nice overview on how to change mob speed. there are a thousand threads with a solution in all of them. why not gather at one place?
    i think i almost got it, but the server get some severe errors
     
  8. what kind of errors, may we see those errors?
     
  9. yep. tried to make a plugin that changes zombie movement to make them harder. this is the errors:

    15:55:32 [SEVERE] Could not pass event CreatureSpawnEvent to DeadlierZombies
    org.bukkit.event.EventException
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:304)
    at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:62)
    at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:460)
    at org.bukkit.craftbukkit.event.CraftEventFactory.callCreatureSpawnEvent(CraftEventFactory.j
    ava:226)
    at net.minecraft.server.World.addEntity(World.java:890)
    at net.minecraft.server.ItemMonsterEgg.a(ItemMonsterEgg.java:41)
    at net.minecraft.server.ItemMonsterEgg.interactWith(ItemMonsterEgg.java:25)
    at net.minecraft.server.ItemStack.placeItem(ItemStack.java:83)
    at net.minecraft.server.ItemInWorldManager.interact(ItemInWorldManager.java:303)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:636)
    at net.minecraft.server.Packet15Place.handle(SourceFile:39)
    at net.minecraft.server.NetworkManager.b(NetworkManager.java:229)
    at net.minecraft.server.NetServerHandler.a(NetServerHandler.java:113)
    at net.minecraft.server.NetworkListenThread.a(NetworkListenThread.java:78)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:567)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:459)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    Caused by: java.lang.ClassCastException: org.bukkit.craftbukkit.CraftWorld cannot be cast to net.min
    ecraft.server.World
    at deadlierzombies.EntityListener.onCreatureSpawn(EntityListener.java:155)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.bukkit.plugin.java.JavaPluginLoader$1.execute(JavaPluginLoader.java:302)
    ... 16 more
    15:55:32 [SEVERE] java.lang.ClassCastException: org.bukkit.craftbukkit.CraftWorld cannot be cast to
    org.bukkit.entity.Zombie
    15:55:32 [SEVERE] at deadlierzombies.Zombies.F_(Zombies.java:20)
    15:55:32 [SEVERE] at net.minecraft.server.World.entityJoinedWorld(World.java:1262)
    15:55:32 [SEVERE] at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:106)
    15:55:32 [SEVERE] at net.minecraft.server.World.playerJoinedWorld(World.java:1244)
    15:55:32 [SEVERE] at net.minecraft.server.World.tickEntities(World.java:1151)
    15:55:32 [SEVERE] at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:558)
    15:55:32 [SEVERE] at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:459)
    15:55:32 [SEVERE] at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
    15:55:32 [SEVERE] Unexpected exception
    java.lang.ClassCastException: org.bukkit.craftbukkit.CraftWorld cannot be cast to org.bukkit.entity.
    Zombie
    at deadlierzombies.Zombies.F_(Zombies.java:20)
    at net.minecraft.server.World.entityJoinedWorld(World.java:1262)
    at net.minecraft.server.WorldServer.entityJoinedWorld(WorldServer.java:106)
    at net.minecraft.server.World.playerJoinedWorld(World.java:1244)
    at net.minecraft.server.World.tickEntities(World.java:1151)
    at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:558)
    at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:459)
    at net.minecraft.server.ThreadServerApplication.run(SourceFile:492)
     
  10. can you give
    15:55:32 [SEVERE] at deadlierzombies.Zombies.F_(Zombies.java:20)
    zombies.java line 20
    at deadlierzombies.EntityListener.onCreatureSpawn(EntityListener.java:155)
    entitylistener line 155
     
  11. Code:
        public void F_(){
            Zombie zombie = (Zombie) this.getBukkitEntity().getWorld();
           
            Location from = new Location(zombie.getWorld(), this.lastX, this.lastY, this.lastZ, this.lastYaw, this.lastPitch);
            Location to = new Location(zombie.getWorld(), this.locX, this.locY, this.locZ, this.yaw, this.pitch);
            EntityCreature ec = ((CraftCreature)zombie).getHandle();
            Navigation nav = ec.al();
              nav.a(1f);
           
           
            ZombieMoveEvent event = new ZombieMoveEvent(zombie, from, to, nav);
     
            this.world.getServer().getPluginManager().callEvent(event);
     
            if (event.isCancelled() && zombie.isDead() == false){
                return;
            }
     
            super.F_();
        }
    Code:
    public void onCreatureSpawn (CreatureSpawnEvent event) {
       
            Location location = event.getLocation();
            Entity entity = event.getEntity();
            EntityType entityType = event.getEntityType();
            //World world = (World) location.getWorld();
     
            net.minecraft.server.World mcWorld = (World) (event.getLocation().getWorld());
            net.minecraft.server.Entity mcEntity = (((CraftEntity) entity).getHandle());
     
            if (entityType == EntityType.ZOMBIE && mcEntity instanceof Zombies == false){
                Zombies zombies = new Zombies(mcWorld);
     
                zombies.setPosition(location.getX(), location.getY(), location.getZ());
     
                mcWorld.removeEntity((net.minecraft.server.EntityZombie) mcEntity);
                mcWorld.addEntity(zombies, SpawnReason.CUSTOM);
     
                return;
            }
     
  12. Zombie zombie = (Zombie) this.getBukkitEntity().getWorld();
    how can a world an zombie, I think you mean
    Zombie zombie = (Zombie) this.getBukkitEntity();

    net.minecraft.server.World mcWorld = (World) (event.getLocation().getWorld());
    you cant craft an craftworld to an net.mc world, do
    net.minecraft.server.World mcWorld = ((CraftWorld) (event.getLocation().getWorld())).getHandle(); // may forget something here
     
  13. wow! that helped! it works! eureka! haha.
    i think the problem was the .getWorld(); part, because i had the CraftWorld part in it the first time around.
    Thanks man! i'll post the plugin github link when i get it done, so other can see.
     
  14. Oh gosh, i wouldnt consider myself an expert on any level with this... If i was i'd be able to answer the other thread @_@

    Um, also, dont worry, ive read it, and im giving it some thought.
     
  15. Well, you know more about it than the most (if not any) other devs...
    Alright. I was just worried because I saw you online but didn't got any reply. And I would really love it if you would join the team. All that I saw from you is that you have a lot of coding talent. Exactly what we need. :)
     
  16. Offline

    p1rat33r

    I'm having trouble with this line:
    ZombieMoveEvent event = new ZombieMoveEvent(zombie, from, to, nav);
    Eclipse reports: ZombieMoveEvent cannot be resolved to a type.

    Which import should be included for this class?
     
  17. zombie move event is a custom event that you need to throw in your custom zombie class whenever it moves.

    If the event is cancelled, dont do anything.
     
    V10lator likes this.
Thread Status:
Not open for further replies.

Share This Page