Do not fire PlayerBucketFillEvent when no fluid (Fixes #4611)

This commit is contained in:
Shane Freeder 2021-08-17 15:43:01 +01:00
parent 6dfd1d9a71
commit f2471d20b4
No known key found for this signature in database
GPG key ID: A3F61EA5A085289C

View file

@ -0,0 +1,18 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: Shane Freeder <theboyetronic@gmail.com>
Date: Tue, 17 Aug 2021 15:42:21 +0100
Subject: [PATCH] Do not fire PlayerBucketFillEvent when no fluid
diff --git a/src/main/java/net/minecraft/world/item/BucketItem.java b/src/main/java/net/minecraft/world/item/BucketItem.java
index 4fdb99240e6ebda946fd2e0a847654d92b7c56a1..fb25e1107db0a01b0803af031c117e57e03dc5c1 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -73,6 +73,7 @@ public class BucketItem extends Item implements DispensibleContainerItem {
BucketPickup ifluidsource = (BucketPickup) iblockdata.getBlock();
// CraftBukkit start
ItemStack dummyFluid = ifluidsource.pickupBlock(DummyGeneratorAccess.INSTANCE, blockposition, iblockdata);
+ if (dummyFluid.isEmpty()) return InteractionResultHolder.fail(itemstack); // Paper
PlayerBucketFillEvent event = CraftEventFactory.callPlayerBucketFillEvent((ServerLevel) world, user, blockposition, blockposition, movingobjectpositionblock.getDirection(), itemstack, dummyFluid.getItem(), hand); // Paper - add enumhand
if (event.isCancelled()) {