2022-06-09 10:51:45 +02:00
|
|
|
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
|
|
From: commandblockguy <commandblockguy1@gmail.com>
|
|
|
|
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.
|
|
|
|
|
2024-10-23 16:55:24 +02:00
|
|
|
diff --git a/src/main/java/net/minecraft/world/level/ServerExplosion.java b/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
|
|
|
index d3d74a7f306d88b0d5cd83893b3ee5e750fd4caf..86656de31b1e33381eddd3ef210122118b31e620 100644
|
|
|
|
--- a/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
|
|
|
+++ b/src/main/java/net/minecraft/world/level/ServerExplosion.java
|
|
|
|
@@ -164,6 +164,15 @@ public class ServerExplosion implements Explosion {
|
2022-06-09 10:51:45 +02:00
|
|
|
|
|
|
|
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) {
|
2023-12-06 19:21:23 +01:00
|
|
|
+ net.minecraft.world.level.block.entity.BlockEntity extension = this.level.getBlockEntity(blockposition);
|
2022-06-09 10:51:45 +02:00
|
|
|
+ if (extension instanceof net.minecraft.world.level.block.piston.PistonMovingBlockEntity blockEntity && blockEntity.isSourcePiston()) {
|
2024-10-23 16:55:24 +02:00
|
|
|
+ net.minecraft.core.Direction direction = iblockdata.getValue(net.minecraft.world.level.block.piston.PistonHeadBlock.FACING);
|
|
|
|
+ set.add(blockposition.relative(direction.getOpposite()));
|
2022-06-09 10:51:45 +02:00
|
|
|
+ }
|
|
|
|
+ }
|
2024-01-20 23:13:41 +01:00
|
|
|
+ // Paper end - prevent headless pistons from forming
|
2022-06-09 10:51:45 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
d4 += d0 * 0.30000001192092896D;
|