Is There A Method To Set Natural Armour Points Of A Mob

Discussion in 'Spigot Plugin Development' started by TheShermanTanker, Jun 8, 2017.

  1. I have been searching for tutorials for this but there is not a single one. What's the way to set natural armour points for a mob? (I don't mean equipped armour I mean natural armour points)
     
  2. Hello, you can add more health or add a potion effect
     
    • Like Like x 1
    • Winner Winner x 1
  3. if I wanted that I would have done that already its for an ability to strengthen a custom mob when it goes below a certain amout of hp
     
  4. Then you should have mentioned that in the OP. Listen for damage event, if the entity being damaged is one of your "special" entities, change its effects/health/armor/etc.
     
  5. I know that I have this (Microsoft Edge is fucking up syntax)

    Code (Java):
    public void onHurt(EntityDamageEvent event){

    if(event.getEntity() instanceof Wither && event.getEntity().getHealth() < 500){

    //Code here, but what's the method to set natural armour points??

    }

    }
    I just need the method that I have to use to set natural armour points cause right now I can't find one
     
  6. If you're wanting to "strengthen" it, why don't you just detect the amount of damage dealt and reduce it by a percentage? Would probably be much easier to do.
     
  7. Meh wanted a creative way to do it and I'm not good at math so percentage...
     
  8. Just a double < 1
     
  9. As I said, you can edit generic.armor attribute of the mob:

    Code (Text):
    entity.getAttribute(Attribute.GENERIC_ARMOR).setBaseValue(value);
    Notice how the zombie with "more armor" takes less damage?

    [​IMG]

    [​IMG]
     
    #10 T4TU_, Jun 9, 2017
    Last edited: Jun 10, 2017
  10. Oh, thanks, but what version can you do this on?
     
  11. If I'm not completely mistaken it's 1.9 and up. At least they added the armor attribute in Minecraft 1.9.
     
  12. Dammit I'm on 1.7 my friend challenged me to it






    Guess its nms time for me then :/