diff options
author | Owen1212055 <[email protected]> | 2024-12-22 20:46:38 -0500 |
---|---|---|
committer | Owen1212055 <[email protected]> | 2024-12-22 20:46:38 -0500 |
commit | 779b3f2b09e52d308d1ffc3fa459c0c6ba85ca81 (patch) | |
tree | 35e72de3151e49bb875eb3f279171ad2251cf141 /paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch | |
parent | 083c083188825b6c758e700023541d4db7804502 (diff) | |
download | Paper-fix/totems.tar.gz Paper-fix/totems.zip |
Fix totems negating incorrect itemfix/totems
Diffstat (limited to 'paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch')
-rw-r--r-- | paper-server/patches/sources/net/minecraft/world/entity/LivingEntity.java.patch | 21 |
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 6e41390320..958afd1115 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 @@ -669,22 +669,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 |