From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: violetc <58360096+s-yh-china@users.noreply.github.com> Date: Wed, 30 Mar 2022 08:58:45 +0000 Subject: [PATCH] Add isShrink to EntityResurrectEvent diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java index 3e8f4f3c3d43c6875108295187023c48eece2788..5fc4d97ef421a37158b01864b035385bb7bf5f5f 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -1701,14 +1701,14 @@ public abstract class LivingEntity extends Entity implements Attackable { } final org.bukkit.inventory.EquipmentSlot handSlot = (hand != null) ? org.bukkit.craftbukkit.CraftEquipmentSlot.getHand(hand) : null; - final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot); + final EntityResurrectEvent event = new EntityResurrectEvent((org.bukkit.entity.LivingEntity) this.getBukkitEntity(), handSlot, true); // Leaves - can dont shrink 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 resurrection. deathProtection = null; } else { - if (!itemInHand.isEmpty() && itemStack != null) { // Paper - only reduce item if actual totem was found + if (!itemInHand.isEmpty() && itemStack != null && event.isShrink()) { // Paper - only reduce item if actual totem was found // Leaves - can dont shrink itemInHand.shrink(1); } // Paper start - fix NPE when pre-cancelled EntityResurrectEvent is uncancelled