Overwriting Mob Health

Discussion in 'Bukkit Help' started by Terra-Network.org, Dec 14, 2011.

Thread Status:
Not open for further replies.
  1. Hi @ all!

    I've got a problem with a plugin, maybe you know it: CustomDifficulty
    On part of this plugin is to overwrite the default Healthpoints (HP) of a mob.
    There was a time when this plugin worked with relatively high numbers (60 and more)
    but now i'm getting this error:

    Code:
    2011-12-15 00:00:16 [SEVERE] Could not pass event CREATURE_SPAWN to CustomDifficulty
    java.lang.IllegalArgumentException: Health must be between 0 and 16
        at org.bukkit.craftbukkit.entity.CraftLivingEntity.setHealth(CraftLivingEntity.java:42)
        at Pasukaru.CustomDifficulty.CustomDifficultyEntityListener.onCreatureSpawn(CustomDifficultyEntityListener.java:104)
        at org.bukkit.plugin.java.JavaPluginLoader$72.execute(JavaPluginLoader.java:767)
        at org.bukkit.plugin.RegisteredListener.callEvent(RegisteredListener.java:58)
        at org.bukkit.plugin.SimplePluginManager.callEvent(SimplePluginManager.java:339)
        at org.bukkit.craftbukkit.event.CraftEventFactory.callCreatureSpawnEvent(CraftEventFactory.java:259)
        at net.minecraft.server.World.addEntity(World.java:883)
        at org.bukkit.craftbukkit.CraftWorld.spawn(CraftWorld.java:820)
        at org.bukkit.craftbukkit.CraftWorld.spawn(CraftWorld.java:655)
        at org.bukkit.craftbukkit.CraftWorld.spawnCreature(CraftWorld.java:323)
        at Pasukaru.CustomDifficulty.SchedulerTasks.SpawnControl.run(SpawnControl.java:433)
        at org.bukkit.craftbukkit.scheduler.CraftScheduler.mainThreadHeartbeat(CraftScheduler.java:137)
        at net.minecraft.server.MinecraftServer.w(MinecraftServer.java:493)
        at net.minecraft.server.MinecraftServer.run(MinecraftServer.java:425)
        at net.minecraft.server.ThreadServerApplication.run(SourceFile:457)
    I fixed this problem with a little modification of the plugin.
    Instead of setting the HP to the users value i check the maximum HP with getMaxHealth and when the player value is too high i set it to the default ... but that's a great FAIL
    Is there no way anymore to manipulate the maximum HP of a Creature?

    Thx for your help!
     
  2. I don't know if you were one of the people who asked, but there was a thread about this. Basically extend Entity[Whatever] and change getMaxHealth() to your custom health. Search "Custom Entity"
     
  3. It's the first time i'm asking, so no ^^
    Thanks, i will have a look!
     
  4. Offline

    BobtheChicken

    I couldn't seem to find the Custom Entity thread. Could you explain this a little more in-depth?
     
Thread Status:
Not open for further replies.

Share This Page