geforkt von Mirrors/Paper
52 Zeilen
3.2 KiB
Diff
52 Zeilen
3.2 KiB
Diff
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.
|
|
|
|
diff --git a/src/main/java/com/destroystokyo/paper/PaperConfig.java b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
index 933d3ace21f5a313f1d5e4dfd86777f6fa235f3f..1fd89294fabcd2a390ba7f1502acbfeb9a2343d6 100644
|
|
--- a/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
+++ b/src/main/java/com/destroystokyo/paper/PaperConfig.java
|
|
@@ -469,4 +469,10 @@ public class PaperConfig {
|
|
maxPlayerAutoSavePerTick = (playerAutoSaveRate == -1 || playerAutoSaveRate > 100) ? 10 : 20;
|
|
}
|
|
}
|
|
+
|
|
+ public static boolean allowHeadlessPistons;
|
|
+ private static void allowHeadlessPistons() {
|
|
+ config.set("settings.unsupported-settings.allow-headless-pistons-readme", "This setting controls if players should be able to create headless pistons.");
|
|
+ allowHeadlessPistons = getBoolean("settings.unsupported-settings.allow-headless-pistons", false);
|
|
+ }
|
|
}
|
|
diff --git a/src/main/java/net/minecraft/world/level/Explosion.java b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
index 8325ccbcae2a5ed55f436163bb8136cc03db9df0..97f99a06b8954b08af9f4156abe8abdad359349a 100644
|
|
--- a/src/main/java/net/minecraft/world/level/Explosion.java
|
|
+++ b/src/main/java/net/minecraft/world/level/Explosion.java
|
|
@@ -35,6 +35,8 @@ import net.minecraft.world.level.block.BaseFireBlock;
|
|
import net.minecraft.world.level.block.Block;
|
|
import net.minecraft.world.level.block.Blocks;
|
|
import net.minecraft.world.level.block.entity.BlockEntity;
|
|
+import net.minecraft.world.level.block.piston.PistonHeadBlock;
|
|
+import net.minecraft.world.level.block.piston.PistonMovingBlockEntity;
|
|
import net.minecraft.world.level.block.state.BlockState;
|
|
import net.minecraft.world.level.gameevent.GameEvent;
|
|
import net.minecraft.world.level.material.FluidState;
|
|
@@ -189,6 +191,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 (!com.destroystokyo.paper.PaperConfig.allowHeadlessPistons && iblockdata.getBlock() == Blocks.MOVING_PISTON) {
|
|
+ BlockEntity extension = this.level.getBlockEntity(blockposition);
|
|
+ if (extension instanceof PistonMovingBlockEntity && ((PistonMovingBlockEntity) extension).isSourcePiston()) {
|
|
+ net.minecraft.core.Direction direction = iblockdata.getValue(PistonHeadBlock.FACING);
|
|
+ set.add(blockposition.relative(direction.getOpposite()));
|
|
+ }
|
|
+ }
|
|
+ // Paper end
|
|
}
|
|
|
|
d4 += d0 * 0.30000001192092896D;
|