Commits

Travis Watkins authored f9e3bf24a81
Recalculate damage modifiers in event for old method. Fixes BUKKIT-5681

When we added the new API in EntityDamageEvent to give control over the various things that modify the final damage done we caused a change in behavior for users of the old #setDamage(double) method. Before changing the damage would happen before the modifiers were calculated so they would be based on the final damage value from the event. Now they are calculated at the beginning so changing the damage does not change the modifiers. To allow the old style and the new to coexist we now expose the vanilla modifer calculations to the event in the form of Function objects. These are used in #setDamage(double) to calculate the difference in the modifier between the old damage and the new and apply this difference to the current modifier. The difference is between the vanilla values for both damage values and is applied on top of the event's modifier value as this should make old and new API usage work together in a way that isn't surprising.
No tags

src/main/java/org/bukkit/event/entity/EntityDamageByBlockEvent.java

Modified

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut