From 03aecfb4286c282fb1a295d4e042724df828c800 Mon Sep 17 00:00:00 2001 From: CraftBukkit/Spigot Date: Wed, 18 Aug 2021 17:06:40 +1000 Subject: [PATCH] SPIGOT-6714: Don't fire PlayerBucketEvent when empty By: Noah van der Aa --- .../nms-patches/net/minecraft/world/item/ItemBucket.patch | 1 + 1 file changed, 1 insertion(+) diff --git a/paper-server/nms-patches/net/minecraft/world/item/ItemBucket.patch b/paper-server/nms-patches/net/minecraft/world/item/ItemBucket.patch index 85cf4e6c9a..4246025561 100644 --- a/paper-server/nms-patches/net/minecraft/world/item/ItemBucket.patch +++ b/paper-server/nms-patches/net/minecraft/world/item/ItemBucket.patch @@ -23,6 +23,7 @@ IFluidSource ifluidsource = (IFluidSource) iblockdata.getBlock(); + // CraftBukkit start + ItemStack dummyFluid = ifluidsource.removeFluid(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata); ++ if (dummyFluid.isEmpty()) return InteractionResultWrapper.fail(itemstack); // Don't fire event if the bucket won't be filled. + PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((WorldServer) world, entityhuman, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem()); + + if (event.isCancelled()) {