9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0010-Add-isShrink-to-EntityResurrectEvent.patch
Lumine1909 c5ecbe85d2 1.21.7/8 (#587)
---------

Co-authored-by: MC-XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
2025-07-21 21:18:24 +08:00

28 lines
1.9 KiB
Diff

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 1ba342a1a60951f828034d3ed535b577b3990bf6..7a7971ec03fcdf72ecaa1e934d5ab3c62113c251 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1733,14 +1733,14 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin
}
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