Mob health being set to 1024?

Discussion in 'Plugin Development' started by Profaann, Dec 25, 2015.

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

    Profaann

    So, im trying to set a mob max health to a random number between 4000 and 8000. however, when the mob spawns, it shows an error saying that the health must be between 0 to 1024, how do i bypass that?
     
  2. Offline

    teej107

    @Profaann can you post code and stacktrace?
     
  3. Offline

    Zombie_Striker

    @Profaann
    You can't. The reason it want it to be between 0 and 1024 is because it has to send the amount of health the Entity has to the player and the packet is byte specific. The server can only send up to a certain amount of bytes.

    Try setting the max health to "1024", and just modifying the amount of damage received (E.g 2 hit damaged reduced to 0.5)
     
    Last edited: Dec 26, 2015
    teej107 likes this.
  4. Offline

    Profaann

    Well, there is a server at 1.8, and mobs have like 8k hp
     
  5. Offline

    Zombie_Striker

    @Profaann
    It's not "real" 8K health. What is happening is the damage has been scaled down.
     
  6. Offline

    Profaann

    It its not scaled down, as the health of the mob displays and the dmg applied also displays, i think its faked.
     
  7. Offline

    Zombie_Striker

    Uh huh. What you're seeing is the health "scaled up" ( it's not actually that, it's just printing it that way. E.g. ".getHealth() *8" )
     
    mug561 likes this.
  8. Offline

    ChintziSecilMC

    You could create a custom entity and auto its health there couldnt u?
     
  9. Offline

    Zombie_Striker

    What do you mean "auto it's health"? Do you mean using Entity.setMaxHealth? Because that's what causing the "problem" (not really a problem, just something you have to work around.).
     
  10. Offline

    Profaann

    No its not :c
     
  11. Offline

    teej107

    Now how do you know that? You already proved that you can't set the max health above 1024. The only way this could have been possible is if they used a custom entity (if that even works) or what @Zombie_Striker said.
    They also could have just ignored the mob's health and stuck with their own health system.
     
  12. Offline

    Xerox262

    So then create a Hash Map that store an entities' uuid along with their health, then create a damage listener and set the damage they receive to 0 and manage their health through your hash map. However this means you're gonna have to store it for persistence.
     
  13. Offline

    Profaann

    Gonna try that
     
Thread Status:
Not open for further replies.

Share This Page