aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2024-05-29 13:58:57 -0700
committerGitHub <[email protected]>2024-05-29 22:58:57 +0200
commita31dc90741ed9c121a13a3c124c9ebf5bafd0da7 (patch)
tree81963bd94fe7772ee08bd21710230de21b6b25da /patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
parented85aac53cfd93d29fa24e6071dbdddd0e49624b (diff)
downloadPaper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.tar.gz
Paper-a31dc90741ed9c121a13a3c124c9ebf5bafd0da7.zip
Several fixes and new api for experience merging/stacking (#9242)
Diffstat (limited to 'patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch')
-rw-r--r--patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch42
1 files changed, 42 insertions, 0 deletions
diff --git a/patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch b/patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
new file mode 100644
index 0000000000..6e70197163
--- /dev/null
+++ b/patches/server/0556-Fix-PlayerBucketEmptyEvent-result-itemstack.patch
@@ -0,0 +1,42 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+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 b20263db1988529dd6e7969d65ee30096f10d591..6d494b80ae002aea00afa44adf83dad1ae5bbbc1 100644
+--- a/src/main/java/net/minecraft/world/item/BucketItem.java
++++ b/src/main/java/net/minecraft/world/item/BucketItem.java
+@@ -40,6 +40,8 @@ import org.bukkit.event.player.PlayerBucketFillEvent;
+
+ public class BucketItem extends Item implements DispensibleContainerItem {
+
++ private static @Nullable ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper - Fix PlayerBucketEmptyEvent result itemstack
++
+ public final Fluid content;
+
+ public BucketItem(Fluid fluid, Item.Properties settings) {
+@@ -123,6 +125,13 @@ public class BucketItem extends Item implements DispensibleContainerItem {
+ }
+
+ public static ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
++ // Paper start - Fix PlayerBucketEmptyEvent result itemstack
++ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
++ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
++ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
++ return itemInHand;
++ }
++ // Paper end - Fix PlayerBucketEmptyEvent result itemstack
+ return !player.hasInfiniteMaterials() ? new ItemStack(Items.BUCKET) : stack;
+ }
+
+@@ -180,6 +189,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
+ ((ServerPlayer) entityhuman).getBukkitEntity().updateInventory(); // SPIGOT-4541
+ return false;
+ }
++ itemLeftInHandAfterPlayerBucketEmptyEvent = event.getItemStack() != null ? event.getItemStack().equals(CraftItemStack.asNewCraftStack(net.minecraft.world.item.Items.BUCKET)) ? null : CraftItemStack.asNMSCopy(event.getItemStack()) : ItemStack.EMPTY; // Paper - Fix PlayerBucketEmptyEvent result itemstack
+ }
+ // CraftBukkit end
+ if (!flag2) {