Skip to content

Damage with any cause#7980

Closed
TetraTheta wants to merge 2 commits into
PaperMC:masterfrom
TetraTheta:damage-with-any-cause
Closed

Damage with any cause#7980
TetraTheta wants to merge 2 commits into
PaperMC:masterfrom
TetraTheta:damage-with-any-cause

Conversation

@TetraTheta
Copy link
Copy Markdown
Contributor

Continuation of #7423.

Since this is almost direct port of original(#5191) PR, I don't think I fully understood the original code. I will leave some comment on the code.

Any comments will be welcomed, so please, feel free to give me any feedback.

Comment on lines +417 to +432
+ /*
+ EntityDamageEvent event = new EntityDamageByBlockEvent(blockDamager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions); // Paper
event.setCancelled(cancelled);

CraftEventFactory.blockDamage = null; // SPIGOT-6639: Clear blockDamage to allow other entity damage during event call
CraftEventFactory.callEvent(event);
- CraftEventFactory.blockDamage = damager; // SPIGOT-6639: Re-set blockDamage so that other entities which are also getting damaged have the right cause
+ CraftEventFactory.blockDamage = blockDamager; // SPIGOT-6639: Re-set blockDamage so that other entities which are also getting damaged have the right cause // Paper

if (!event.isCancelled()) {
event.getEntity().setLastDamageCause(event);
@@ -1078,6 +1087,8 @@ public class CraftEventFactory {
throw new IllegalStateException(String.format("Unhandled damage of %s by %s from %s", entity, damager.getHandle(), source.msgId));
}
EntityDamageEvent event = new EntityDamageByEntityEvent(damager, entity.getBukkitEntity(), cause, modifiers, modifierFunctions, source.isCritical()); // Paper - add critical damage API
+ */
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These lines were undeleted by purpose. I wasn't sure if I can safely delete these lines. If it is ok to delete this lines, I will.

@TetraTheta TetraTheta marked this pull request as ready for review June 14, 2022 14:23
@TetraTheta
Copy link
Copy Markdown
Contributor Author

Closing mine because #8058 is much more 'beautiful'
Even though mentioned PR is still draft, I think it is more productive. Mine was just 'lazy' 😄

I think no one would think this PR should be 'revived', but if anyone thinks so, feel free to re-open this. (Don't know if it is possible though)

@TetraTheta TetraTheta closed this Aug 3, 2022
@TetraTheta TetraTheta deleted the damage-with-any-cause branch October 2, 2022 07:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant