mirror of
https://github.com/LeavesMC/Leaves.git
synced 2025-12-19 14:59:32 +00:00
--------- Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com> Co-authored-by: violetc <58360096+s-yh-china@users.noreply.github.com> Co-authored-by: Helvetica Volubi <88063803+Suisuroru@users.noreply.github.com>
28 lines
1.9 KiB
Diff
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 c18b0155edd695524246e5c2134de94008d8a023..f4a45a39afae0befa5c6048bb5f2001395d5cbfc 100644
|
|
--- a/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1741,14 +1741,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
|