Skip to content

Commit

Permalink
Alternative block placement Protocol (#104)
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Aug 15, 2023
1 parent 70da855 commit ce7f03c
Show file tree
Hide file tree
Showing 12 changed files with 541 additions and 199 deletions.
25 changes: 18 additions & 7 deletions patches/server/0004-Leaves-Server-Config-And-Command.patch
Original file line number Diff line number Diff line change
Expand Up @@ -128,10 +128,10 @@ index e1c99d941c7bb954bf3ac83d5002dbf58fd833b0..4760b943da08771a42fcb22eba4d586d
.withRequiredArg()
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
new file mode 100644
index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9e8bc54ba
index 0000000000000000000000000000000000000000..785e2aa78a4d1288549a0304952c2bdb1c3ec358
--- /dev/null
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -0,0 +1,968 @@
@@ -0,0 +1,979 @@
+package top.leavesmc.leaves;
+
+import com.destroystokyo.paper.util.SneakyThrow;
Expand All @@ -158,7 +158,7 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9
+public final class LeavesConfig {
+
+ public static final String CONFIG_HEADER = "Configuration file for Leaves.";
+ public static final int CURRENT_CONFIG_VERSION = 3;
+ public static final int CURRENT_CONFIG_VERSION = 4;
+
+ private static final Object[] EMPTY = new Object[0];
+
Expand Down Expand Up @@ -258,6 +258,12 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9
+ config.set("settings.modify.player-can-edit-sign", null);
+ config.set("settings.performance.skip-clone-loot-parameters", null);
+ }
+
+ case 3 -> {
+ boolean carpetAlternative = config.getBoolean("settings.protocol.carpet-alternative-block-placement", false);
+ alternativeBlockPlacement = carpetAlternative ? "CARPET" : "NONE";
+ config.set("settings.protocol.carpet-alternative-block-placement", null);
+ }
+ }
+ }
+ }
Expand Down Expand Up @@ -557,9 +563,14 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9
+ jadeProtocol = getBoolean("settings.protocol.jade-protocol", jadeProtocol);
+ }
+
+ public static boolean carpetAlternativeBlockPlacement = false;
+ private static void carpetAlternativeBlockPlacement() {
+ carpetAlternativeBlockPlacement = getBoolean("settings.protocol.carpet-alternative-block-placement", carpetAlternativeBlockPlacement);
+ public static String alternativeBlockPlacement = "NONE";
+ private static final List<String> alternativeBlockPlacementType = List.of("NONE", "CARPET", "CARPET_FIX", "LITEMATICA");
+ private static void alternativeBlockPlacement() {
+ alternativeBlockPlacement = getString("settings.protocol.alternative-block-placement", alternativeBlockPlacement);
+ if (!alternativeBlockPlacementType.contains(alternativeBlockPlacement)) {
+ alternativeBlockPlacement = "NONE";
+ LeavesLogger.LOGGER.severe("alternative-block-placement value error, reset to NONE");
+ }
+ }
+
+ public static boolean playerOperationLimiter = false;
Expand Down Expand Up @@ -665,7 +676,7 @@ index 0000000000000000000000000000000000000000..1486bf1c37cbacb6643379cbd555f8a9
+ public static boolean disableDistanceCheckForUseItem = false;
+ private static void disableDistanceCheckForUseItem() {
+ disableDistanceCheckForUseItem = getBoolean("settings.modify.disable-distance-check-for-use-item", disableDistanceCheckForUseItem);
+ if (carpetAlternativeBlockPlacement) {
+ if (!alternativeBlockPlacement.equals("NONE")) {
+ disableDistanceCheckForUseItem = true;
+ }
+ }
Expand Down
4 changes: 2 additions & 2 deletions patches/server/0019-Multithreaded-Tracker.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ Subject: [PATCH] Multithreaded Tracker
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 5b8ef14e023059466f95b7ee7c2420bababdd0e2..181b74206ec8baeff6820ca8c27d1245d3f3d335 100644
index b43c8921f63c4c8d87ceb05da2f1a64392f0ee03..3f1716583d7cd36174a28d40c19248531963c960 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -250,7 +250,7 @@ public final class LeavesConfig {
@@ -256,7 +256,7 @@ public final class LeavesConfig {
dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0037-Async-Pathfinding.patch
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@ This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)
But Pufferfish patch was ported downstream from the Petal fork

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 181b74206ec8baeff6820ca8c27d1245d3f3d335..475b3b5bcc8828c6ba2a4a6d7b2476548e13efcc 100644
index 3f1716583d7cd36174a28d40c19248531963c960..4a7557e450560bb7e8785370cd6abaaff32fa07f 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -351,7 +351,7 @@ public final class LeavesConfig {
@@ -357,7 +357,7 @@ public final class LeavesConfig {
// only config now
public static boolean asyncPathfinding = false;
private static boolean asyncPathfindingLock = false;
Expand Down
Loading

0 comments on commit ce7f03c

Please sign in to comment.