aboutsummaryrefslogtreecommitdiffhomepage
path: root/patches/server/0419-Prevent-headless-pistons-from-being-created.patch
diff options
context:
space:
mode:
Diffstat (limited to 'patches/server/0419-Prevent-headless-pistons-from-being-created.patch')
-rw-r--r--patches/server/0419-Prevent-headless-pistons-from-being-created.patch27
1 files changed, 27 insertions, 0 deletions
diff --git a/patches/server/0419-Prevent-headless-pistons-from-being-created.patch b/patches/server/0419-Prevent-headless-pistons-from-being-created.patch
new file mode 100644
index 0000000000..c4ae7a0fb8
--- /dev/null
+++ b/patches/server/0419-Prevent-headless-pistons-from-being-created.patch
@@ -0,0 +1,27 @@
+From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
+From: commandblockguy <[email protected]>
+Date: Fri, 14 Aug 2020 14:44:14 -0500
+Subject: [PATCH] Prevent headless pistons from being created
+
+Prevent headless pistons from being created by explosions or tree/mushroom growth.
+
+diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
+index b03b4d366cae39081a7b70524e8615c986d76362..cd939ab6958e8eb632056d32f68e2fcae7735d64 100644
+--- a/src/main/java/net/minecraft/world/level/Explosion.java
++++ b/src/main/java/net/minecraft/world/level/Explosion.java
+@@ -205,6 +205,15 @@ public class Explosion {
+
+ if (f > 0.0F && this.damageCalculator.shouldBlockExplode(this, this.level, blockposition, iblockdata, f)) {
+ set.add(blockposition);
++ // Paper start - prevent headless pistons from forming
++ if (!io.papermc.paper.configuration.GlobalConfiguration.get().unsupportedSettings.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
++ net.minecraft.world.level.block.entity.BlockEntity extension = this.level.getBlockEntity(blockposition);
++ if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
++ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
++ set.add(blockposition.relative(direction.getOpposite()));
++ }
++ }
++ // Paper end - prevent headless pistons from forming
+ }
+
+ d4 += d0 * 0.30000001192092896D;