aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJake Potrebic <[email protected]>2021-12-21 16:32:54 -0800
committerGitHub <[email protected]>2021-12-21 16:32:54 -0800
commit9adc0b243b0ce77a4b72d91ec7dd59d1191a1867 (patch)
treecf96341596506241058692d75ea776d0adcf213d
parent75f4cb074adb357cd1474c6f65c3734abd3562ee (diff)
downloadPaper-9adc0b243b0ce77a4b72d91ec7dd59d1191a1867.tar.gz
Paper-9adc0b243b0ce77a4b72d91ec7dd59d1191a1867.zip
Fix breakNaturally for fluid-logged blocks (#7134)
-rw-r--r--patches/server/0832-Fix-fluid-logging-on-Block-breakNaturally.patch29
1 files changed, 29 insertions, 0 deletions
diff --git a/patches/server/0832-Fix-fluid-logging-on-Block-breakNaturally.patch b/patches/server/0832-Fix-fluid-logging-on-Block-breakNaturally.patch
new file mode 100644
index 0000000000..2489e93ffd
--- /dev/null
+++ b/patches/server/0832-Fix-fluid-logging-on-Block-breakNaturally.patch
@@ -0,0 +1,29 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: Jake Potrebic <[email protected]>
+Date: Tue, 21 Dec 2021 16:28:17 -0800
+Subject: [PATCH] Fix fluid-logging on Block#breakNaturally
+
+Leaves fluid if the block broken was fluid-logged which is what
+happens if a player breaks a fluid-logged block
+
+diff --git a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+index 89cfa5093d53e1a249efc64aa1b449755c6eecd9..7cf7b845620ab5b118da79f6057c0d80a254585e 100644
+--- a/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
++++ b/src/main/java/org/bukkit/craftbukkit/block/CraftBlock.java
+@@ -508,6 +508,7 @@ public class CraftBlock implements Block {
+ net.minecraft.world.level.block.state.BlockState iblockdata = this.getNMS();
+ net.minecraft.world.level.block.Block block = iblockdata.getBlock();
+ net.minecraft.world.item.ItemStack nmsItem = CraftItemStack.asNMSCopy(item);
++ net.minecraft.world.level.material.FluidState fluidState = this.world.getFluidState(this.position); // Paper
+ boolean result = false;
+
+ // Modelled off EntityHuman#hasBlock
+@@ -518,7 +519,7 @@ public class CraftBlock implements Block {
+ }
+
+ // SPIGOT-6778: Directly call setBlock instead of setTypeAndData, so that the tile entiy is not removed and custom remove logic is run.
+- return this.world.setBlock(position, Blocks.AIR.defaultBlockState(), 3) && result;
++ return this.world.setBlock(position, fluidState.createLegacyBlock(), 3) && result; // Paper - leave liquid if waterlogged
+ }
+
+ @Override