Add config for the piston push limit (#311)

This commit is contained in:
Bierque Jason
2021-05-03 00:42:41 +02:00
committed by GitHub
parent a30e5ac971
commit 7ee3393e30

View File

@@ -0,0 +1,60 @@
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: DoctaEnkoda <bierquejason@gmail.com>
Date: Sun, 2 May 2021 23:14:54 +0200
Subject: [PATCH] Allows you to change the thrust limit of a piston by World
diff --git a/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java b/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
index 6c9c4ab65b7e42efa68027057242e25b70313081..cbe34059659e0f80ff384508b01e516cd7c5e28a 100644
--- a/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
+++ b/src/main/java/net/minecraft/world/level/block/piston/PistonExtendsChecker.java
@@ -12,7 +12,7 @@ import net.minecraft.world.level.material.EnumPistonReaction;
public class PistonExtendsChecker {
- private final World a;
+ private final World a; public World getWorld() { return a; } // Purpur - OBFHELPER
private final BlockPosition b;
private final boolean c;
private final BlockPosition d;
@@ -86,7 +86,7 @@ public class PistonExtendsChecker {
} else {
int i = 1;
- if (i + this.f.size() > 12) {
+ if (i + this.f.size() > this.getWorld().purpurConfig.pistonBlockPushLimit) { // Purpur
return false;
} else {
while (a(block)) {
@@ -100,7 +100,7 @@ public class PistonExtendsChecker {
}
++i;
- if (i + this.f.size() > 12) {
+ if (i + this.f.size() > this.getWorld().purpurConfig.pistonBlockPushLimit) { // Purpur
return false;
}
}
@@ -148,7 +148,7 @@ public class PistonExtendsChecker {
return true;
}
- if (this.f.size() >= 12) {
+ if (this.f.size() >= this.getWorld().purpurConfig.pistonBlockPushLimit) { // Purpur
return false;
}
diff --git a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
index 10590525f70e080ce7ffe6d7a3d908c2b60f8810..d9c836dd20d104cb9997d7fa0b88bb87d70d0bce 100644
--- a/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
+++ b/src/main/java/net/pl3x/purpur/PurpurWorldConfig.java
@@ -2147,4 +2147,9 @@ public class PurpurWorldConfig {
magmaBlockDamageWhenSneaking = getBoolean("blocks.magma-block.damage-when-sneaking", magmaBlockDamageWhenSneaking);
magmaBlockDamageWithFrostWalker = getBoolean("blocks.magma-block.damage-with-frost-walker", magmaBlockDamageWithFrostWalker);
}
+
+ public int pistonBlockPushLimit = 12;
+ private void pistonSettings() {
+ pistonBlockPushLimit = getInt("blocks.piston.block-push-limit", pistonBlockPushLimit);
+ }
}