From 3cad0316e0417cd2d3a2812db1300caa021542a8 Mon Sep 17 00:00:00 2001 From: Noah van der Aa Date: Wed, 18 Aug 2021 17:06:40 +1000 Subject: [PATCH] SPIGOT-6714: Don't fire PlayerBucketEvent when empty --- nms-patches/net/minecraft/world/item/ItemBucket.patch | 1 + 1 file changed, 1 insertion(+) diff --git a/nms-patches/net/minecraft/world/item/ItemBucket.patch b/nms-patches/net/minecraft/world/item/ItemBucket.patch index 85cf4e6c9..424602556 100644 --- a/nms-patches/net/minecraft/world/item/ItemBucket.patch +++ b/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()) {