forked from PaperMC/Paper
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix NPE when EntityResurrectEvent is uncancelled (PaperMC#11636)
- Loading branch information
1 parent
d0dcd7d
commit 85bfdc0
Showing
1 changed file
with
23 additions
and
0 deletions.
There are no files selected for viewing
23 changes: 23 additions & 0 deletions
23
patches/server/1067-Fix-NPE-when-EntityResurrectEvent-is-uncancelled.patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 | ||
From: Lulu13022002 <41980282+Lulu13022002@users.noreply.github.com> | ||
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 51f913a495e7fda7e0e72439c6d7cc9607bd4af8..f36a075dbee2b96d01899e02460b1d8443e91749 100644 | ||
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java | ||
@@ -1711,6 +1711,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; |