9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-23 17:09:26 +00:00
Files
LeavesMC/patches/server/0013-Add-isShrink-to-EntityResurrectEvent.patch
violetc 4a69af351b 1.21 (#238)
---------

Co-authored-by: Lumine1909 <133463833+Lumine1909@users.noreply.github.com>
Co-authored-by: LittleChest <81231195+LittleChest@users.noreply.github.com>
2024-07-05 01:30:46 +08:00

31 lines
1.8 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/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
index de0c9798261c00a76c7c37c396379f42a44720be..8766907511d0234a50f2ae23689a7e3005757309 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1630,12 +1630,12 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
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);
+ 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()) {
- if (!itemstack1.isEmpty() && itemstack != null) { // Paper - only reduce item if actual totem was found
+ if (!itemstack1.isEmpty() && itemstack != null && event.isShrink()) { // Paper - only reduce item if actual totem was found // Leaves - can dont shrink
itemstack1.shrink(1);
}
if (itemstack != null && this instanceof ServerPlayer) {
@@ -4595,3 +4595,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+