Cleanup damage source a bit (#12106)

This commit is contained in:
Lulu13022002
2025-02-16 20:14:00 +01:00
committed by GitHub
parent 608f004a2c
commit 7bee99714a
31 changed files with 135 additions and 215 deletions

View File

@@ -678,7 +678,7 @@
+ event.setCancelled(itemStack == null);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+ if (event.isCancelled()) {
+ // Set death protection to null as the event was cancelled. Prevent any attempt at ressurection.
+ // Set death protection to null as the event was cancelled. Prevent any attempt at resurrection.
+ deathProtection = null;
+ } else {
+ if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
@@ -691,7 +691,7 @@
- if (this instanceof ServerPlayer serverPlayer) {
+ }
+ // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
+ // restore the previous behavior in that case by defaulting to vanillas totem of undying efect
+ // restore the previous behavior in that case by defaulting to vanillas totem of undying effect
+ if (deathProtection == null) {
+ deathProtection = DeathProtection.TOTEM_OF_UNDYING;
+ }