9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-19 14:59:32 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0010-Add-isShrink-to-EntityResurrectEvent.patch
Lumine1909 f09fbb247d 1.21.5 (#470)
---------

Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com>
Co-authored-by: Fortern <blueten.ki@gmail.com>
Co-authored-by: MC_XiaoHei <xor7xiaohei@gmail.com>
Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
Co-authored-by: MC_XiaoHei <xiaohei.xor7@outlook.com>
2025-06-05 18:41:51 +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 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