Paper/paper-server/patches/sources/net/minecraft/world
Bjarne Koll c7c3d8a9cb Fix incorrect invulnerability damage reduction
Fixes incorrect spigot handling of the invulnerability damage
reduction applied when an already invulnerable entity is damaged with a
larger damage amount than the initial damage.
Vanilla still damages entities even if invulnerable if the damage to be
applied is larger than the previous damage taken. In that case, vanilla
applies the difference between the previous damage taken and the
proposed damage.

Spigot's damage modifier API takes over the computation of damage
reducing effects, however spigot invokes this handling with the initial
damage before computing the difference to the previous damage amount.
This leads to the reduction values to generally be larger than expected,
as they are computed on the not-yet-reduced value.
Spigot applies these reductions after calling the EntityDamageEvent and
*then* subtracts the previous damage point, leading to the final damage
amount being smaller than expected.

This patch cannot simply call the EntityDamageEvent with the reduced
damage, as that would lead to EntityDamageEvent#getDamage() returning
the already reduced damage, which breaks its method contract.
Instead, this patch makes use of the DamageModifier API, implementing
the last-damage-reduction as a DamageModifier.
2024-11-11 21:35:27 +01:00
..
damagesource Fix DamageSource API 2024-03-09 14:13:04 -08:00
effect Fire EntityChangeBlockEvent in more places 2021-08-09 20:45:46 -07:00
entity Fix incorrect invulnerability damage reduction 2024-11-11 21:35:27 +01:00
food EntityRegainHealthEvent isFastRegen API 2016-04-22 01:43:11 -05:00
inventory Add AnvilView#bypassEnchantmentLevelRestriction 2024-10-06 16:46:36 -03:00
item Improve performance of RecipeMap#removeRecipe 2024-10-31 20:36:41 -07:00
level Add startup flag to disable gamerule limits 2024-10-25 14:20:40 -07:00
scores Don't save empty scoreboard teams to scoreboard.dat 2016-05-07 23:33:08 -04:00
BossEvent.java.patch Adventure 2021-01-29 17:54:03 +01:00
CompoundContainer.java.patch Remap CraftBukkit to Mojang+Yarn Mappings 2024-12-11 22:26:55 +01:00
Container.java.patch Add missing InventoryHolders to inventories 2022-01-24 00:09:02 -08:00
RandomizableContainer.java.patch Validate ResourceLocation in NBT reading 2024-01-04 13:49:14 +01:00
SimpleContainer.java.patch Fix inventories returning null Locations 2023-03-15 18:29:45 -07:00