mirror of
https://github.com/PaperMC/Paper.git
synced 2024-12-11 17:31:06 +01:00
1358d1e914
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: 881e06e5 PR-725: Add Item Unlimited Lifetime APIs CraftBukkit Changes: 74c08312 SPIGOT-6962: Call EntityChangeBlockEvent when when FallingBlockEntity starts to fall 64db5126 SPIGOT-6959: Make /loot command ignore empty items for spawn 2d760831 Increase outdated build delay 9ed7e4fb SPIGOT-6138, SPIGOT-6415: Don't call CreatureSpawnEvent after cross-dimensional travel fc4ad813 SPIGOT-6895: Trees grown with applyBoneMeal() don't fire the StructureGrowthEvent 59733a2e SPIGOT-6961: Actually return a copy of the ItemMeta Spigot Changes: ffceeae3 SPIGOT-6956: Drop unload queue patch as attempt at fixing stop issue e19ddabd PR-1011: Add Item Unlimited Lifetime APIs 34d40b0e SPIGOT-2942: give command fires PlayerDropItemEvent, cancelling it causes Item Duplication
42 lines
2.2 KiB
Diff
42 lines
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 5406acd65d4e1146f3bd7340ff9a1954a5c39ddb..a3f04f66c66f40068792da3ef0e75e7df102b0e0 100644
|
|
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
|
|
@@ -39,6 +39,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) {
|
|
@@ -120,6 +122,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) {
|