aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch')
-rw-r--r--patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch23
1 files changed, 23 insertions, 0 deletions
diff --git a/patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch b/patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch
new file mode 100644
index 0000000000..e4f75e957c
--- /dev/null
+++ b/patches/server/1064-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch
@@ -0,0 +1,23 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Lulu13022002 <[email protected]>
+Date: Mon, 18 Nov 2024 20:27:58 +0100
+Subject: [PATCH] Fix NPE when EntityResurrectEvent is uncancelled
+
+
+diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+index cc4cc42adc95fb9357d4cf94d81b6c0c109879c1..a542bde48edd91929cb7e3dc62c425507a8118fa 100644
+--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
++++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
+@@ -1722,6 +1722,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
+ if (!itemstack1.isEmpty() && itemstack != null) { // Paper - only reduce item if actual totem was found
+ itemstack1.shrink(1);
+ }
++ // 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
++ if (deathprotection == null) {
++ deathprotection = DeathProtection.TOTEM_OF_UNDYING;
++ }
++ // Paper end - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled
+ if (itemstack != null && this instanceof ServerPlayer) {
+ // CraftBukkit end
+ ServerPlayer entityplayer = (ServerPlayer) this;