Expansion of Living Damage Event Sequence #548
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Damage Events Overhaul
This expands upon the event sequence tied to damaging living entities. The goal of these changes are:
Background/Context
currently the sequence of damage events and calculations is as follows:
LivingEntity#hurt
being calledLivingAttackEvent
, an immutable reference to damage intended to be applied by the attacker for the entity provided, cancellation prevents all subsequent behaviorShieldBlockEvent
, which allows modification of the damage and whether the shield takes durability lossIS_FREEZING
and entity is in theFREEZE_HURTS_EXTRA_TYPES
tagactuallyHurt
for damage less than last damage receivedactuallyHurt
for whole damageLivingEntity#actuallyHurt
sequenceLivingHurtEvent
, which allows mutation of the damage.LivingDamageEvent
, which allows mutation of the damage. subsequent behavior ignored if damage output is zeroENTITY_DAMAGE
back to
LivingEntity#hurt
sequenceOnce
actuallyHurt
logic completes, the hurt behavior continues with the followingLivingUseTotemEvent
during this checkUpstream behavior significant to the above sequence
Player#hurt
,ServerPlayer#hurt
,RemotePlayer#hurt
, andLocalPlayer#hurt
overridesLivingAttackEvent
before later callingsuper.hurt
which starts with anotherLivingAttackEvent
super.hurt
from being called for peaceful mode and invulnerability checksArmorStand#hurt
overrideWitherBoss#hurt
overrideIdentified Gaps
Based on the above sequence and event distribution, this PR attempts to address the following gaps
Areas for potential implementation
Lastly
I started this as a draft in case there was any feedback regarding additional content to implement, or changes in how the current implementation was done. Once any input, if any, has been incorporated, I will create the tests and submit for review.