geforkt von Mirrors/Paper
275173e538
Upstream has released updates that appear to apply and compile correctly. This update has not been tested by PaperMC and as with ANY update, please do your own testing Bukkit Changes: 0c5d8709 SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends 255c4fdb SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot CraftBukkit Changes: b6b514b7e SPIGOT-7400: Downgrade maven-resolver due to issues resolving certain depends fcff84de9 SPIGOT-7399: Revert null check in CraftMetaItem#safelyAdd 44a4b5649 SPIGOT-7380: Add PlayerInteractEvent#getClickedPosition and ChiseledBookshelf#getSlot 676969d01 SPIGOT-7389: Handle setting null items in ChiseledBookshelf Inventory
37 Zeilen
2.0 KiB
Diff
37 Zeilen
2.0 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: Bjarne Koll <lynxplay101@gmail.com>
|
|
Date: Tue, 10 Jan 2023 21:06:42 +0100
|
|
Subject: [PATCH] Correctly shrink items during EntityResurrectEvent
|
|
|
|
The EntityResurrectEvent logic is supposed to locate a totem of undying
|
|
in any of the interaction slots of the player inventory and then, if the
|
|
called EntityResurrectEvent is not cancelled, shrink that item by 1,
|
|
usually reducing it to zero.
|
|
|
|
For this, the logic iterates over the items in the interaction slots and
|
|
breaks out the loop if a totem of undying was found.
|
|
However, even if no totem of undying was found, the iteration item stack
|
|
variable remains as a refernce to the last interaction slot probed.
|
|
|
|
Plugins uncancelling a EntityResurrectEvent, which is published
|
|
pre-cancelled to listeners if no totem of undying could be found,
|
|
would hence cause the server logic to shrink completely unrelated items
|
|
found in, at the writing of this patch, the players off hand slot.
|
|
|
|
This patch corrects this behaviour by only shrinking the item if a totem
|
|
of undying was found and the event was called uncancelled.
|
|
|
|
diff --git a/src/main/java/net/minecraft/world/entity/LivingEntity.java b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
index 6e955e940ab95c5be22a8fb331b3c61347a77f92..98a6480b32a1897dfcae84ed72409441519a827f 100644
|
|
--- a/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
+++ b/src/main/java/net/minecraft/world/entity/LivingEntity.java
|
|
@@ -1592,7 +1592,7 @@ public abstract class LivingEntity extends Entity implements Attackable {
|
|
this.level().getCraftServer().getPluginManager().callEvent(event);
|
|
|
|
if (!event.isCancelled()) {
|
|
- if (!itemstack1.isEmpty()) {
|
|
+ if (!itemstack1.isEmpty() && itemstack != null) { // Paper - only reduce item if actual totem was found
|
|
itemstack1.shrink(1);
|
|
}
|
|
if (itemstack != null && this instanceof ServerPlayer) {
|