9
0
mirror of https://github.com/LeavesMC/Leaves.git synced 2025-12-21 07:49:35 +00:00
Files
LeavesMC/patches/server/0013-Add-isShrink-to-EntityResurrectEvent.patch
2022-11-29 18:56:19 +08:00

31 lines
1.6 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 11d7c42d65b91bf57b7bba7812aa17e60e018c67..3529f5fede54fbdf0a3783cce2e3322110685e99 100644
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
@@ -1548,12 +1548,12 @@ public abstract class LivingEntity extends Entity {
}
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);
event.setCancelled(itemstack == null);
this.level.getCraftServer().getPluginManager().callEvent(event);
if (!event.isCancelled()) {
- if (!itemstack1.isEmpty()) {
+ if (!itemstack1.isEmpty() && event.isShrink()) {
itemstack1.shrink(1);
}
if (itemstack != null && this instanceof ServerPlayer) {
@@ -4414,3 +4414,4 @@ public abstract class LivingEntity extends Entity {
}
}
+