9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-06 15:51:33 +00:00
Files
LeavesMC/leaves-server/minecraft-patches/features/0010-Add-isShrink-to-EntityResurrectEvent.patch
2025-09-28 09:45:17 +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 b969a50ef263a5785571df7b299e92b5cc47b439..410d75b148920f38ceb04d63d93166bd3b8e35c4 100644
--- a/net/minecraft/world/entity/LivingEntity.java
+++ b/net/minecraft/world/entity/LivingEntity.java
@@ -1740,14 +1740,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