geforkt von Mirrors/Paper
20503beee5
Messing with game time sent to the client isn't worth the trouble whenever it may be used by the client now and in the future for such a small issue. Mojang, plz fix
43 Zeilen
2.2 KiB
Diff
43 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 f165b6e83a76d837257d5c30fa6ea838889cfc72..5c6aa9c464784ad5ee366412d080c72d3d22a76f 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
|
|
+
|
|
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;
|
|
}
|
|
|
|
@@ -152,6 +161,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 empty event result itemstack
|
|
}
|
|
// CraftBukkit end
|
|
if (!flag1) {
|