1.15.2 Allowing shields to only block a percentage of the damage

Discussion in 'Spigot Plugin Development' started by SenpaiiCat, Mar 22, 2020.

  1. Hi All,

    when players take damage by a shield, the shield blocks all of the damge. **it is** possible to make it so that shields block half of the damage.
    I can do it using
    Code (Text):

    EntityDamageByEntityEvent (EDBE)
    // Shields block half damage
    EDBE#setDamage(DamageModifier.Blocking, EDBE#getOriginalDamage(DamageModifier.Blocking) / 2);
    But, is it possible to make the rest of the damage be handled by armor and everything.
    Because with the current setup, the player will take the rest of the damage ignoring the hearts, and I want things such as the armor, potion effects (resistance, etc) to also be taken into account when applying the rest of the damage.