Skip to content

Commit

Permalink
Lock optimize chunk ticking config
Browse files Browse the repository at this point in the history
  • Loading branch information
s-yh-china committed Sep 13, 2022
1 parent 8cf1d37 commit 3384dee
Show file tree
Hide file tree
Showing 17 changed files with 42 additions and 38 deletions.
12 changes: 8 additions & 4 deletions patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch
Original file line number Diff line number Diff line change
Expand Up @@ -93,16 +93,20 @@ index 2292cb0e0c1a3e0ed34b941f028136bfb0bff13e..a6ea5fd73cb1f6b3c6c35d0cde331b6c

public org.bukkit.Chunk bukkitChunk;
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index f5c07942038a51400e6cdbaee264ad869ebe8b7b..a5f51eefcff48e5a5e44b5143f80b87be06676c3 100644
index f5c07942038a51400e6cdbaee264ad869ebe8b7b..8eee57b9e0ccd90473d0cbacda6c81e27117dd37 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -271,6 +271,11 @@ public final class LeavesConfig {
@@ -271,6 +271,15 @@ public final class LeavesConfig {
checkSpookySeasonOnceAnHour = getBoolean("settings.performance.check-spooky-season-once-an-hour", checkSpookySeasonOnceAnHour);
}

+ public static boolean optimizeChunkTicking = false;
+ public static boolean optimizeChunkTicking = true;
+ private static boolean optimizeChunkTickingLock = false;
+ private static void optimizeChunkTicking() {
+ optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking);
+ if (!optimizeChunkTickingLock) {
+ optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking);
+ optimizeChunkTickingLock = true;
+ }
+ }
+
public static final class WorldConfig {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ index 43243537b765a2d270be6de3f053fea77ff67d18..7d8a137068ab2b33690c369f4da46e90
this.batchCache.long2ObjectEntrySet().removeIf((entry) -> {
return !entry.getValue().isStillValid(time);
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index a5f51eefcff48e5a5e44b5143f80b87be06676c3..f00104ea447d83f4fa94352296b9ae78cd46b765 100644
index 8eee57b9e0ccd90473d0cbacda6c81e27117dd37..3e91b77dd019d3c3d13c1483f00505e7eff849ed 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -276,6 +276,11 @@ public final class LeavesConfig {
optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking);
@@ -280,6 +280,11 @@ public final class LeavesConfig {
}
}

+ public static boolean skipPOIFindingInVehicle = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ index a7575b5ef56af6f53448d391abb4956e130148ca..e2764cbc888be39943728ff810e1e44b
return false;
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index f00104ea447d83f4fa94352296b9ae78cd46b765..5a56cae5ef2a256b5b70e8b0bebdea4a88431f0b 100644
index 3e91b77dd019d3c3d13c1483f00505e7eff849ed..ed22228ea5d1409990a5449ed03272c67faa8362 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -280,6 +280,11 @@ public final class LeavesConfig {
@@ -284,6 +284,11 @@ public final class LeavesConfig {
private static void skipPOIFindingInVehicle() {
skipPOIFindingInVehicle = getBoolean("settings.performance.skip-poi-find-in-vehicle", skipPOIFindingInVehicle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ index e31a2eea9a62ab2c0bed1a97dab6bae231b8cd8b..cc851e1a9c5b23269c53206a7f1e14f3

public static boolean isValidEmptySpawnBlock(BlockGetter blockView, BlockPos pos, BlockState state, FluidState fluidState, EntityType<?> entityType) {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 5a56cae5ef2a256b5b70e8b0bebdea4a88431f0b..c0b01e0aee7fcb66f2940225069366ef02b6ef2a 100644
index ed22228ea5d1409990a5449ed03272c67faa8362..7935bb83c360fb8d194c57e6f0b5a989a60f24db 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -286,6 +286,11 @@ public final class LeavesConfig {
@@ -290,6 +290,11 @@ public final class LeavesConfig {
entityTargetFindingOptimization = getBoolean("settings.performance.entity-target-find-optimization", entityTargetFindingOptimization);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0031-Config-to-disable-method-profiler.patch
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,10 @@ index 6832efb59d9efdfbc3ec38a219193b503f57cabe..7b2ec2afb29f4141a1cc2736e3d6c07d
}

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index c0b01e0aee7fcb66f2940225069366ef02b6ef2a..306415241dbe86eac20b2011ac7676dbca032644 100644
index 7935bb83c360fb8d194c57e6f0b5a989a60f24db..4196fc65d8f11a3f9be3f67d0d227e0b95a8ec18 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -291,6 +291,11 @@ public final class LeavesConfig {
@@ -295,6 +295,11 @@ public final class LeavesConfig {
useMoreThreadUnsafeRandom = getBoolean("settings.performance.use-more-thread-unsafe-random", useMoreThreadUnsafeRandom);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@ index 3646b969fa51b9683ab4137e530c3a6f6fc6c465..ed06eaa8bcd8246483115d2dfcb1de23
}
if (this.targetSelector.inactiveTick()) {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 306415241dbe86eac20b2011ac7676dbca032644..85d13feec033d3939dbbe8f1684aa408796a1706 100644
index 4196fc65d8f11a3f9be3f67d0d227e0b95a8ec18..48af9ecf4bcb8228c91c760e827340276337deac 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -296,6 +296,11 @@ public final class LeavesConfig {
@@ -300,6 +300,11 @@ public final class LeavesConfig {
disableMethodProfiler = getBoolean("settings.misc.disable-method-profiler", disableMethodProfiler);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0033-Skip-cloning-loot-parameters.patch
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ index 35f9b11a3a61976c952a2c1c64bb2a932538f54f..5d678cfca0a39aeed0881c3a38828fdc

public boolean hasParam(LootContextParam<?> parameter) {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 85d13feec033d3939dbbe8f1684aa408796a1706..d14eb8bf345552559708bd028bfe5c76d1de3720 100644
index 48af9ecf4bcb8228c91c760e827340276337deac..6bad9270be98411263c34a3d49877cfa5a9d199e 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -301,6 +301,11 @@ public final class LeavesConfig {
@@ -305,6 +305,11 @@ public final class LeavesConfig {
throttleInactiveGoalSelectorTick = getBoolean("settings.performance.inactive-goal-selector-disable", throttleInactiveGoalSelectorTick);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0034-Reduce-entity-allocations.patch
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,10 @@ index c770ee21b7b699522941f6a1584d532001c04082..a0672f21797ff90e8bb6b16d3aaa671b

public boolean hasAttribute(Attribute attribute) {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index d14eb8bf345552559708bd028bfe5c76d1de3720..ddb1ed98be6bcdcd6604025c7996432d613697d8 100644
index 6bad9270be98411263c34a3d49877cfa5a9d199e..c350182aea6137ef342e3a5a650cffa560fb6186 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -306,6 +306,11 @@ public final class LeavesConfig {
@@ -310,6 +310,11 @@ public final class LeavesConfig {
skipCloneLootParameters = getBoolean("settings.performance.skip-clone-loot-parameters", skipCloneLootParameters);
}

Expand Down
6 changes: 3 additions & 3 deletions patches/server/0035-Remove-lambda-from-ticking-guard.patch
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Subject: [PATCH] Remove lambda from ticking guard
This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish)

diff --git a/src/main/java/net/minecraft/server/level/ServerLevel.java b/src/main/java/net/minecraft/server/level/ServerLevel.java
index bb360a8a54fa4efe1cc6b672df09d4c0d6816d16..82fdf9ae2af5e36b2a8b74ec92d604d11326d4eb 100644
index ba86d0cf5de70b13ed9fd669db6938686a07bf16..eac2746f650eebd202a1b2d762384c5b0771d517 100644
--- a/src/main/java/net/minecraft/server/level/ServerLevel.java
+++ b/src/main/java/net/minecraft/server/level/ServerLevel.java
@@ -690,7 +690,24 @@ public class ServerLevel extends Level implements WorldGenLevel {
Expand Down Expand Up @@ -36,10 +36,10 @@ index bb360a8a54fa4efe1cc6b672df09d4c0d6816d16..82fdf9ae2af5e36b2a8b74ec92d604d1
}
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index ddb1ed98be6bcdcd6604025c7996432d613697d8..cfc8289915c95596991661e42fe5894aac9225c2 100644
index c350182aea6137ef342e3a5a650cffa560fb6186..cd3c32af781e44ba3e37488b9d66ef4de38cda64 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -311,6 +311,11 @@ public final class LeavesConfig {
@@ -315,6 +315,11 @@ public final class LeavesConfig {
reduceEntityAllocations = getBoolean("settings.performance.reduce-entity-allocations", reduceEntityAllocations);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,10 @@ index a1a625a8dacf4d2bbf75ddd90dce1b1be663c919..038c5fae763c5d387a23aaacc3264ab3
}

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index cfc8289915c95596991661e42fe5894aac9225c2..2c4b7a4c69721bfdd6cf8b9f06663dc3ad875fe3 100644
index cd3c32af781e44ba3e37488b9d66ef4de38cda64..17ae3836a43f2c27bed96bce24a5d46fb278bc55 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -316,6 +316,11 @@ public final class LeavesConfig {
@@ -320,6 +320,11 @@ public final class LeavesConfig {
removeTickGuardLambda = getBoolean("settings.performance.remove.tick-guard-lambda", removeTickGuardLambda);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,10 @@ index 66cecf64fac0b72590e1a4ea7147ea2ac78dd30a..2a55e56b80e2835ca8b3975f3b34e008
return chunkMap.playerEntityTrackerTrackMaps[type.ordinal()].getObjectsInRange(MCUtil.getCoordinateKey(this));
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 2c4b7a4c69721bfdd6cf8b9f06663dc3ad875fe3..b4555c7beabd15666be6869432d0cb92484a8df8 100644
index 17ae3836a43f2c27bed96bce24a5d46fb278bc55..49ab3d4e099f285ade340e41b593951e337f3680 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -321,6 +321,11 @@ public final class LeavesConfig {
@@ -325,6 +325,11 @@ public final class LeavesConfig {
removeInventoryContainsIterators = getBoolean("settings.performance.remove.inventory-contains-iterators", removeInventoryContainsIterators);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,10 @@ index 6c95663869b9d7a545393df0416332a509306bb5..b5ac10207ef5d500b36547322459f19e
return this.scaledRange(i);
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index b4555c7beabd15666be6869432d0cb92484a8df8..9845b7397c7c3a1e0229d40c054353c4a489e542 100644
index 49ab3d4e099f285ade340e41b593951e337f3680..4a886963a439fee06d6a846947186f8a86dab398 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -326,6 +326,11 @@ public final class LeavesConfig {
@@ -330,6 +330,11 @@ public final class LeavesConfig {
removeGetNearPlayerStreams = getBoolean("settings.performance.remove.get-nearby-players-streams", removeGetNearPlayerStreams);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0039-Async-Pathfinding.patch
Original file line number Diff line number Diff line change
Expand Up @@ -756,10 +756,10 @@ index d23481453717f715124156b5d83f6448f720d049..6cc6140f44827ccc055aafdd6bfb3a09
protected float distance(Node a, Node b) {
return a.distanceTo(b);
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 9845b7397c7c3a1e0229d40c054353c4a489e542..9636d6b7494c937071ea685dad9da06acba6149b 100644
index 4a886963a439fee06d6a846947186f8a86dab398..746fabb5839357f7506430096768c621d97da6fc 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -331,6 +331,15 @@ public final class LeavesConfig {
@@ -335,6 +335,15 @@ public final class LeavesConfig {
removeRangeCheckStreams = getBoolean("settings.performance.remove.range-check-streams-and-iterators", removeRangeCheckStreams);
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0040-Cache-climbing-check-for-activation.patch
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ index 40b382c2e0e33fe5c24a51b211cd2f9557a60c5e..5da7dc703aeaa4d7c325574ea9f6fd8c
return 1; // Paper
}
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 9636d6b7494c937071ea685dad9da06acba6149b..9dc2a8d9de3207d56a6c6567f18ec3286010610e 100644
index 746fabb5839357f7506430096768c621d97da6fc..dde182e15f5a843ed783d77500e8e532422a9700 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -340,6 +340,11 @@ public final class LeavesConfig {
@@ -344,6 +344,11 @@ public final class LeavesConfig {
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,10 +102,10 @@ index ca259e278ad10347567c021376abca0287610432..968937e86bca8568a17988409506bcc0

public boolean shouldFreeze(LevelReader world, BlockPos blockPos) {
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index 9dc2a8d9de3207d56a6c6567f18ec3286010610e..fa323a0348536b4e356a0f796131f2b364a1cb6d 100644
index dde182e15f5a843ed783d77500e8e532422a9700..6fddd2151d4ac6acb4898b48627485d9b408e427 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -345,6 +345,15 @@ public final class LeavesConfig {
@@ -349,6 +349,15 @@ public final class LeavesConfig {
cacheClimbCheck = getBoolean("settings.performance.cache-climb-check", cacheClimbCheck);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,10 +217,10 @@ index b0c9fce9d4e06cac139e341d218d0b6aac1f1943..f53fee91b78ba4c1e17360a40d5a94fe

});
diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index fa323a0348536b4e356a0f796131f2b364a1cb6d..f2e6d4879afbf8cef5440fc615512e92b61d8085 100644
index 6fddd2151d4ac6acb4898b48627485d9b408e427..bb4c4647bb98535b2e650eaefac50596a1107fb8 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -354,6 +354,11 @@ public final class LeavesConfig {
@@ -358,6 +358,11 @@ public final class LeavesConfig {
}
}

Expand Down
4 changes: 2 additions & 2 deletions patches/server/0043-Reduce-chunk-loading-lookups.patch
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,10 @@ index f22e615dba31619c97bf58930da060476a52facf..c330e65310821248409655953b88717f
boolean flag1 = iblockdata.getFluidState().is(FluidTags.WATER);

diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
index f2e6d4879afbf8cef5440fc615512e92b61d8085..3260987fc92c2571907695386e7c0d3f23c6ab38 100644
index bb4c4647bb98535b2e650eaefac50596a1107fb8..66bbc262a6b272eedd1fae2d0e33e31e8fbcf3bb 100644
--- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java
+++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java
@@ -359,6 +359,11 @@ public final class LeavesConfig {
@@ -363,6 +363,11 @@ public final class LeavesConfig {
reduceEntityFluidLookup = getBoolean("settings.performance.reduce-entity-fluid-lookup", reduceEntityFluidLookup);
}

Expand Down

0 comments on commit 3384dee

Please sign in to comment.