aboutsummaryrefslogtreecommitdiffhomepage
path: root/paper-server
diff options
context:
space:
mode:
authorOwen <[email protected]>2024-12-22 23:58:01 -0500
committerGitHub <[email protected]>2024-12-22 23:58:01 -0500
commit188124bcc38839421fe2d2b067ee26ac61b5e9b1 (patch)
tree92be988c425cf5b21e4c995dc5e8db70a8db9e66 /paper-server
parentf8bf600375fed91a712993d1c3dc6329042c8274 (diff)
downloadPaper-188124bcc38839421fe2d2b067ee26ac61b5e9b1.tar.gz
Paper-188124bcc38839421fe2d2b067ee26ac61b5e9b1.zip
Fix totems negating incorrect item (#11776)
Diffstat (limited to 'paper-server')
-rw-r--r--paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch21
1 files changed, 12 insertions, 9 deletions
diff --git a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
index 15811ba3c8..89bdfae78b 100644
--- a/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
+++ b/paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch
@@ -668,22 +668,25 @@
if (deathProtection != null) {
+ hand = interactionHand; // CraftBukkit
itemStack = itemInHand.copy();
-- itemInHand.shrink(1);
+ // itemInHand.shrink(1); // CraftBukkit
- break;
- }
- }
-
-- if (itemStack != null) {
-- if (this instanceof ServerPlayer serverPlayer) {
++ break;
++ }
++ }
++
+ org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null;
+ EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot);
+ event.setCancelled(itemStack == null);
+ this.level().getCraftServer().getPluginManager().callEvent(event);
+
+ if (!event.isCancelled()) {
-+ if (!itemStack.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
-+ itemStack.shrink(1);
++ if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found
+ itemInHand.shrink(1);
+- break;
+- }
+- }
+-
+- if (itemStack != null) {
+- 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