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 5da877975c
commit 972fbb74c9

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 0000000000000000000000000000000000000000..0000000000000000000000000000000000000000 100644
--- a/src/main/java/net/minecraft/world/item/BucketItem.java
+++ b/src/main/java/net/minecraft/world/item/BucketItem.java
@@ -0,0 +0,0 @@ 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()) {