9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2026-01-04 15:41:31 +00:00
Files
LeavesMC/patches/server/0014-Add-isShrink-to-EntityResurrectEvent.patch
violetc f40d340092 1.20.6 (#216)
---------

Co-authored-by: MC_XiaoHei <xiaohei.xor7studio@foxmail.com>
Co-authored-by: Bluemangoo <chenfy2006@qq.com>
2024-05-20 23:03:56 +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 e8a472f7e90dfb39b16521f75521d60b532af5cc..d106491e5ca187cf62758cbd33bab575ccbc3bec 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1648,12 +1648,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) {
@@ -4562,3 +4562,4 @@ public abstract class LivingEntity extends Entity implements Attackable {
}
}
+