Paper/patches/server/0697-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
Shane Freeder aa52bf9e33
Remove "Implement-Chunk-Priority-Urgency-System-for-Chunks" (Fixes #5980)
Mojang made some changes to priorities in 1.17 and it seems that these changes
conflict with the changes made in this patch, which in some cases appears to
cause excessive rescheduling of tasks.

This, however, is not confirmed as such but seems to be the behavior that we're
seeing to cause this issue, if mojang has adopted the changes we suggested,
then a good chunk of this patch may be unneeded, but, this needs a much better
look than I'm currently able to do
2021-08-14 14:55:55 +01:00

45 Zeilen
2.1 KiB
Diff

From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Jake Potrebic <jake.m.potrebic@gmail.com>
Date: Thu, 20 May 2021 22:16:37 -0700
Subject: [PATCH] Fix PlayerBucketEmptyEvent result itemstack
Fixes SPIGOT-2560: https://hub.spigotmc.org/jira/projects/SPIGOT/issues/SPIGOT-2560
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index 7c3e94c6bf8337ef660473d8ed451606d56082a5..4fdb99240e6ebda946fd2e0a847654d92b7c56a1 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -41,6 +41,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
public class BucketItem extends Item implements DispensibleContainerItem {
+ private static ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
+
public final Fluid content;
public BucketItem(Fluid fluid, Item.Properties settings) {
@@ -121,6 +123,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
}
public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
+ // Paper start
+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
+ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
+ return itemInHand;
+ }
+ // Paper end
return !player.getAbilities().instabuild ? new ItemStack(Items.BUCKET) : stack;
}
@@ -153,6 +162,9 @@ public class BucketItem extends Item implements DispensibleContainerItem {
((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
return false;
}
+ // Paper start
+ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack());
+ // Paper end
}
// CraftBukkit end
if (!flag1) {