[SPIGOT-1963] Extra block modifier being applied Created: 18/Mar/16  Updated: 18/Mar/16  Resolved: 18/Mar/16

Status: Resolved
Project: Spigot
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major
Reporter: MasterGberry Assignee: Unassigned
Resolution: Fixed Votes: 0
Labels: 1.9, Craftbukkit, bug


 Description   

Same issue as SPIGOT-1680

The blocking modifier code is being applied multiple times. There is some shield code found in EntityLiving:

if (f > 0.0F && this.d(damagesource)) {
    this.k(f);
    if (damagesource.a()) {
        f = 0.0F;
    } else {
        f *= 0.33F;
        if (damagesource.i() instanceof EntityLiving) {
            ((EntityLiving) damagesource.i()).a(this, 0.5F, this.locX - damagesource.i().locX, this.locZ - damagesource.i().locZ);
        }
    }

    flag = true;
}                   

This is the new NMS code for handling blocking. Arrows do no damage to shields, regular attacks do 1/3 of the damage when they are blocking.

Then there is the code found in the Modifier section:

Function<Double, Double> blocking = new Function<Double, Double>() {
    @Override
    public Double apply(Double f) {
        if (human) {
            if (!damagesource.ignoresArmor() && ((EntityHuman) EntityLiving.this).isBlocking() && f > 0.0F) {
                return -(f - ((1.0F + f) * 0.5F));
            }
        }
        return -0.0;
    }
};

As a result there is two sections of code modifying blocking damage. Solution is to move the correct blocking damage modifier into the CraftBukkit method.


Generated at Sat Dec 13 13:38:05 UTC 2025 using Jira 10.3.13#10030013-sha1:56dd970ae30ebfeda3a697d25be1f6388b68a422.