geforkt von Mirrors/Paper
4af62f6d1d
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: 2d009e64 Update SnakeYAML javadoc link b4fd213c Switch Player#updateInventory deprecation for internal API annotation CraftBukkit Changes: f3b2b2210 SPIGOT-7376: Exception with getBlockData when hasBlockData is false 725545630 SPIGOT-7375: Fix crash breeding certain entities b9873b0d4 Update Brigadier version with fix 68b320562 SPIGOT-7266: Found typo in CraftBukkit package 98b4d2ff8 SPIGOT-7372, SPIGOT-7373: Signs can't be edited, issues with SignChangeEvent 5f7bd4d78 SPIGOT-7371: Sign does not open edit text on placement b4cf99d24 SPIGOT-7371: Fix editing signs with API a2b6c2744 PR-1200: Implement open sign by side a345bb940 SPIGOT-7368: Downgrade SpecialSource version Spigot Changes: 723951c3 Rebuild patches b655c57d Drop old collision API deprecated since 1.9.4 55b0fed4 Rebuild patches
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 7a6caded7f5c711e96fa0d6b177923c2a49004e4..16e98ca278c9005d7695a73582de2123abb68ac4 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) {
|