geforkt von Mirrors/Paper
44 Zeilen
2.2 KiB
Diff
44 Zeilen
2.2 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 d0e847e58483695d2af1c1410826bb25231cd6f6..08c00a084b2972420eae020e13480489b29aec64 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
@@ -116,6 +116,13 @@ public class BucketItem extends Item {
|
|
}
|
|
|
|
protected ItemStack getEmptySuccessItem(ItemStack stack, Player player) {
|
|
+ // Paper
|
|
+ if (itemLeftInHandAfterPlayerBucketEmptyEvent != null) {
|
|
+ ItemStack itemInHand = itemLeftInHandAfterPlayerBucketEmptyEvent;
|
|
+ itemLeftInHandAfterPlayerBucketEmptyEvent = null;
|
|
+ return itemInHand;
|
|
+ }
|
|
+ // Paper
|
|
return !player.abilities.instabuild ? new ItemStack(Items.BUCKET) : stack;
|
|
}
|
|
|
|
@@ -126,6 +133,7 @@ public class BucketItem extends Item {
|
|
return a(player, world, pos, movingobjectpositionblock, null, null, null, null);
|
|
}
|
|
|
|
+ private ItemStack itemLeftInHandAfterPlayerBucketEmptyEvent = null; // Paper
|
|
public boolean a(Player entityhuman, Level world, BlockPos blockposition, @Nullable BlockHitResult movingobjectpositionblock, Direction enumdirection, BlockPos clicked, ItemStack itemstack, InteractionHand enumhand) {
|
|
// Paper end
|
|
// CraftBukkit end
|
|
@@ -146,6 +154,9 @@ public class BucketItem extends Item {
|
|
((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) {
|