2024-01-02 18:14:42 +01:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: Jake Potrebic <jake.m.potrebic@gmail.com>
|
|
|
|
Date: Mon, 1 Jan 2024 12:57:19 -0800
|
|
|
|
Subject: [PATCH] Correctly check if bucket dispenses will succeed for event
|
|
|
|
|
|
|
|
Upstream incorrectly checks if the bucket place will succeed
|
|
|
|
in order to fire the BlockDispenseEvent. This patch corrects
|
|
|
|
that.
|
|
|
|
|
|
|
|
diff --git a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
2024-10-23 20:15:25 +02:00
|
|
|
index c63a86af95849cacdfed3b061122b90651fd5bdf..5793569ae8a088f21b0d8d6771a5099b1e88be09 100644
|
2024-01-02 18:14:42 +01:00
|
|
|
--- a/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
|
|
|
+++ b/src/main/java/net/minecraft/core/dispenser/DispenseItemBehavior.java
|
2024-10-23 20:15:25 +02:00
|
|
|
@@ -330,7 +330,13 @@ public interface DispenseItemBehavior {
|
2024-01-02 18:14:42 +01:00
|
|
|
int y = blockposition.getY();
|
|
|
|
int z = blockposition.getZ();
|
|
|
|
BlockState iblockdata = worldserver.getBlockState(blockposition);
|
|
|
|
- if (iblockdata.isAir() || iblockdata.canBeReplaced() || (dispensiblecontaineritem instanceof BucketItem && iblockdata.getBlock() instanceof LiquidBlockContainer && ((LiquidBlockContainer) iblockdata.getBlock()).canPlaceLiquid((Player) null, worldserver, blockposition, iblockdata, ((BucketItem) dispensiblecontaineritem).content))) {
|
|
|
|
+ // Paper start - correctly check if the bucket place will succeed
|
|
|
|
+ /* Taken from SolidBucketItem#emptyContents */
|
|
|
|
+ boolean willEmptyContentsSolidBucketItem = dispensiblecontaineritem instanceof net.minecraft.world.item.SolidBucketItem && worldserver.isInWorldBounds(blockposition) && iblockdata.isAir();
|
2024-01-13 16:35:59 +01:00
|
|
|
+ /* Taken from BucketItem#emptyContents */
|
2024-01-02 18:14:42 +01:00
|
|
|
+ boolean willEmptyBucketItem = dispensiblecontaineritem instanceof final BucketItem bucketItem && bucketItem.content instanceof net.minecraft.world.level.material.FlowingFluid && (iblockdata.isAir() || iblockdata.canBeReplaced(bucketItem.content) || (iblockdata.getBlock() instanceof LiquidBlockContainer liquidBlockContainer && liquidBlockContainer.canPlaceLiquid(null, worldserver, blockposition, iblockdata, bucketItem.content)));
|
|
|
|
+ if (willEmptyContentsSolidBucketItem || willEmptyBucketItem) {
|
|
|
|
+ // Paper end - correctly check if the bucket place will succeed
|
|
|
|
org.bukkit.block.Block block = CraftBlock.at(worldserver, pointer.pos());
|
2024-01-24 15:57:53 +01:00
|
|
|
CraftItemStack craftItem = CraftItemStack.asCraftMirror(stack);
|
2024-01-02 18:14:42 +01:00
|
|
|
|