diff --git a/patches/server/0018-Optimize-mob-spawning.patch b/patches/server/0018-Optimize-mob-spawning.patch index 056e3f86..da936c17 100644 --- a/patches/server/0018-Optimize-mob-spawning.patch +++ b/patches/server/0018-Optimize-mob-spawning.patch @@ -151,18 +151,22 @@ index 4cdfc433df67afcd455422e9baf56f167dd712ae..a6e0f5dab21d806e0c7744b2a337cded private void ensureActiveIsNotIterated() { // Paper - replace with better logic, do not delay removals diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 857b8881ba2d526ee366aa04228b72bc8d7c8c47..7430ba59d0d16c628a7c62100902e23b0470b419 100644 +index 857b8881ba2d526ee366aa04228b72bc8d7c8c47..6f0d0c255e7767c31605effbcb0b41659f0b8ddb 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -222,7 +222,12 @@ public final class LeavesConfig { +@@ -222,7 +222,16 @@ public final class LeavesConfig { } noChatSign = getBoolean("settings.misc.no-chat-sign", noChatSign); } - + + public static boolean asyncMobSpawning = false; ++ private static boolean asyncMobSpawningLock = false; + private static void asyncMobSpawning() { -+ asyncMobSpawning = getBoolean("settings.performance.async-mob-spawning", asyncMobSpawning); ++ if (!asyncMobSpawningLock) { ++ asyncMobSpawning = getBoolean("settings.performance.async-mob-spawning", asyncMobSpawning); ++ asyncMobSpawningLock = true; ++ } + } + public static final class WorldConfig { diff --git a/patches/server/0019-Dont-send-useless-entity-packets.patch b/patches/server/0019-Dont-send-useless-entity-packets.patch index 1a5e2b09..006f13dd 100644 --- a/patches/server/0019-Dont-send-useless-entity-packets.patch +++ b/patches/server/0019-Dont-send-useless-entity-packets.patch @@ -69,11 +69,11 @@ index 3b144c820531122eb37d41be06c182b5f5dc0724..8eb4a062489b42b26076d5f3bdfbff36 this.entity.stopSeenByPlayer(player); player.connection.send(new ClientboundRemoveEntitiesPacket(new int[]{this.entity.getId()})); diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 7430ba59d0d16c628a7c62100902e23b0470b419..26e23a21f7cbd8d5e9a2dbf4860adc03a04e6e0e 100644 +index 6f0d0c255e7767c31605effbcb0b41659f0b8ddb..f4e5b84f0bd952676950369eff44b87fe1c46f1b 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -228,6 +228,11 @@ public final class LeavesConfig { - asyncMobSpawning = getBoolean("settings.performance.async-mob-spawning", asyncMobSpawning); +@@ -232,6 +232,11 @@ public final class LeavesConfig { + } } + public static boolean dontSendUselessEntityPackets = true; diff --git a/patches/server/0020-Multithreaded-Tracker.patch b/patches/server/0020-Multithreaded-Tracker.patch index fc6e858f..78a3b0f1 100644 --- a/patches/server/0020-Multithreaded-Tracker.patch +++ b/patches/server/0020-Multithreaded-Tracker.patch @@ -186,16 +186,20 @@ index 8eb4a062489b42b26076d5f3bdfbff368c1a199b..441edf3dbd34c8d15b7b1ba02c92e8f1 set.clear(); diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 26e23a21f7cbd8d5e9a2dbf4860adc03a04e6e0e..51130d4d0f95af0d3ee508e83e69697783c31106 100644 +index f4e5b84f0bd952676950369eff44b87fe1c46f1b..1ef5e16bc44369eefd58df7d93e031ca83ce7190 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -233,6 +233,11 @@ public final class LeavesConfig { +@@ -237,6 +237,15 @@ public final class LeavesConfig { dontSendUselessEntityPackets = getBoolean("settings.performance.dont-send-useless-entity-packets", dontSendUselessEntityPackets); } + public static boolean asyncEntityTracker = false; ++ private static boolean asyncEntityTrackerLock = false; + private static void asyncEntityTracker() { -+ asyncEntityTracker = getBoolean("settings.performance.async-entity-tracker", asyncEntityTracker); ++ if (!asyncEntityTrackerLock) { ++ asyncEntityTracker = getBoolean("settings.performance.async-entity-tracker", asyncEntityTracker); ++ asyncEntityTrackerLock = true; ++ } + } + public static final class WorldConfig { diff --git a/patches/server/0021-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch b/patches/server/0021-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch index c07b6944..db922b61 100644 --- a/patches/server/0021-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch +++ b/patches/server/0021-Fix-Paper-6045-block-goal-shouldn-t-load-chunks.patch @@ -18,11 +18,11 @@ index 26bf383caea68834c654b25653ced9017f1b1b22..71e3c7fc5c071e83dfeca6954771e559 this.blockPos = mutableBlockPos; setTargetPosition(mutableBlockPos.immutable()); // Paper diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 51130d4d0f95af0d3ee508e83e69697783c31106..f157ee3c0b37fab427c9ce97ac3d28ddca831f8b 100644 +index 1ef5e16bc44369eefd58df7d93e031ca83ce7190..51c71e922fa98dd30d52d89b1d8d4be77eff491b 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -238,6 +238,11 @@ public final class LeavesConfig { - asyncEntityTracker = getBoolean("settings.performance.async-entity-tracker", asyncEntityTracker); +@@ -246,6 +246,11 @@ public final class LeavesConfig { + } } + public static boolean fixPaper6045 = true; diff --git a/patches/server/0022-Optimize-entity-coordinate-key.patch b/patches/server/0022-Optimize-entity-coordinate-key.patch index 6c17b3b5..6aa23fdb 100644 --- a/patches/server/0022-Optimize-entity-coordinate-key.patch +++ b/patches/server/0022-Optimize-entity-coordinate-key.patch @@ -38,10 +38,10 @@ index eda98b85fb00fe7787d2f7a643c3854aa4b02fbf..1f1bed78e8d003cfd85bc5cf38014c3d private Vec3 deltaMovement; public float yRot; // Paper - private->public diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index f157ee3c0b37fab427c9ce97ac3d28ddca831f8b..fbdead4eaeee7bb730c23d6228ae939ce9c01971 100644 +index 51c71e922fa98dd30d52d89b1d8d4be77eff491b..338aef7429790cb24bacb790c0180d5516c9c3ba 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -243,6 +243,11 @@ public final class LeavesConfig { +@@ -251,6 +251,11 @@ public final class LeavesConfig { fixPaper6045 = getBoolean("settings.performance.fix.fix-paper-6045", fixPaper6045); } diff --git a/patches/server/0023-Optimize-suffocation.patch b/patches/server/0023-Optimize-suffocation.patch index f32bb317..0f244e1e 100644 --- a/patches/server/0023-Optimize-suffocation.patch +++ b/patches/server/0023-Optimize-suffocation.patch @@ -35,10 +35,10 @@ index 2dee51917888e20768f434b8232430094028b516..8f9bbe88827b6697762f4d43dce1da39 public boolean hurt(DamageSource source, float amount) { if (this.isInvulnerableTo(source)) { diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index fbdead4eaeee7bb730c23d6228ae939ce9c01971..6091a783878f929edfb87cf88963590538c72634 100644 +index 338aef7429790cb24bacb790c0180d5516c9c3ba..4e241398ea555e3696ad969aa37c51311116b92e 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -248,6 +248,11 @@ public final class LeavesConfig { +@@ -256,6 +256,11 @@ public final class LeavesConfig { optimizeEntityCoordinateKey = getBoolean("settings.performance.optimize-entity-coordinate-key", optimizeEntityCoordinateKey); } diff --git a/patches/server/0024-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch b/patches/server/0024-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch index 9e3e4d01..0098b593 100644 --- a/patches/server/0024-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch +++ b/patches/server/0024-Strip-raytracing-for-EntityLiving-hasLineOfSight.patch @@ -142,10 +142,10 @@ index fd18fb454263893d404979a9c9af860ee2ba9a3a..1bd4a181ccf82c687f58b8033683f15a return pos.isInsideBuildHeightAndWorldBoundsHorizontal(this); // Paper - use better/optimized check } diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 6091a783878f929edfb87cf88963590538c72634..76c4110c54c8a883fd015a434c7b101fa3fbb18b 100644 +index 4e241398ea555e3696ad969aa37c51311116b92e..8de03a1d05888308b64007d78dc01f6be58fd730 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -253,6 +253,11 @@ public final class LeavesConfig { +@@ -261,6 +261,11 @@ public final class LeavesConfig { enableSuffocationOptimization = getBoolean("settings.performance.enable-suffocation-optimization", enableSuffocationOptimization); } diff --git a/patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch b/patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch index 2c009298..2212aeff 100644 --- a/patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch +++ b/patches/server/0025-Only-check-for-spooky-season-once-an-hour.patch @@ -45,10 +45,10 @@ index 50d4595b81f24949011c7565c5e3fc8c26c86019..8de1653e3fbf29e9de550a1976344bd8 @Override protected float getStandingEyeHeight(Pose pose, EntityDimensions dimensions) { diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -index 76c4110c54c8a883fd015a434c7b101fa3fbb18b..a675e5ebf5d8ee2ff7dfc86fe93293f1366b886a 100644 +index 8de03a1d05888308b64007d78dc01f6be58fd730..f5c07942038a51400e6cdbaee264ad869ebe8b7b 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -258,6 +258,11 @@ public final class LeavesConfig { +@@ -266,6 +266,11 @@ public final class LeavesConfig { entityStripRaytracing = getBoolean("settings.performance.strip-raytracing-for-entity", entityStripRaytracing); } diff --git a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch b/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch index 46f4ee69..54815e2a 100644 --- a/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch +++ b/patches/server/0027-Optimize-random-calls-in-chunk-ticking.patch @@ -93,14 +93,14 @@ 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 a675e5ebf5d8ee2ff7dfc86fe93293f1366b886a..f01a5349f59a98cb80b06d6b48d23bcd6cc59eb3 100644 +index f5c07942038a51400e6cdbaee264ad869ebe8b7b..a5f51eefcff48e5a5e44b5143f80b87be06676c3 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -263,6 +263,11 @@ public final class LeavesConfig { +@@ -271,6 +271,11 @@ public final class LeavesConfig { checkSpookySeasonOnceAnHour = getBoolean("settings.performance.check-spooky-season-once-an-hour", checkSpookySeasonOnceAnHour); } -+ public static boolean optimizeChunkTicking = true; ++ public static boolean optimizeChunkTicking = false; + private static void optimizeChunkTicking() { + optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking); + } diff --git a/patches/server/0028-Skip-POI-finding-if-stuck-in-vehicle.patch b/patches/server/0028-Skip-POI-finding-if-stuck-in-vehicle.patch index 377c1df6..2094c23b 100644 --- a/patches/server/0028-Skip-POI-finding-if-stuck-in-vehicle.patch +++ b/patches/server/0028-Skip-POI-finding-if-stuck-in-vehicle.patch @@ -18,10 +18,10 @@ 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 f01a5349f59a98cb80b06d6b48d23bcd6cc59eb3..4112467e6e72b31ec0963d69800da758c089a0a0 100644 +index a5f51eefcff48e5a5e44b5143f80b87be06676c3..f00104ea447d83f4fa94352296b9ae78cd46b765 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -268,6 +268,11 @@ public final class LeavesConfig { +@@ -276,6 +276,11 @@ public final class LeavesConfig { optimizeChunkTicking = getBoolean("settings.performance.optimize-chunk-ticking", optimizeChunkTicking); } diff --git a/patches/server/0029-Early-return-optimization-for-target-finding.patch b/patches/server/0029-Early-return-optimization-for-target-finding.patch index 114a0031..01d1dd8d 100644 --- a/patches/server/0029-Early-return-optimization-for-target-finding.patch +++ b/patches/server/0029-Early-return-optimization-for-target-finding.patch @@ -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 4112467e6e72b31ec0963d69800da758c089a0a0..2da10eaf3dc4fce1edf65fe4068f5c9e30df3b17 100644 +index f00104ea447d83f4fa94352296b9ae78cd46b765..5a56cae5ef2a256b5b70e8b0bebdea4a88431f0b 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -272,6 +272,11 @@ public final class LeavesConfig { +@@ -280,6 +280,11 @@ public final class LeavesConfig { private static void skipPOIFindingInVehicle() { skipPOIFindingInVehicle = getBoolean("settings.performance.skip-poi-find-in-vehicle", skipPOIFindingInVehicle); } diff --git a/patches/server/0030-Use-thread-unsafe-random-for-mob-spawning.patch b/patches/server/0030-Use-thread-unsafe-random-for-mob-spawning.patch index ab6d616f..d52b5cf0 100644 --- a/patches/server/0030-Use-thread-unsafe-random-for-mob-spawning.patch +++ b/patches/server/0030-Use-thread-unsafe-random-for-mob-spawning.patch @@ -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 2da10eaf3dc4fce1edf65fe4068f5c9e30df3b17..f7f2c18112fc711edda300753ce2f465fe75ba7f 100644 +index 5a56cae5ef2a256b5b70e8b0bebdea4a88431f0b..c0b01e0aee7fcb66f2940225069366ef02b6ef2a 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -278,6 +278,11 @@ public final class LeavesConfig { +@@ -286,6 +286,11 @@ public final class LeavesConfig { entityTargetFindingOptimization = getBoolean("settings.performance.entity-target-find-optimization", entityTargetFindingOptimization); } diff --git a/patches/server/0031-Config-to-disable-method-profiler.patch b/patches/server/0031-Config-to-disable-method-profiler.patch index f0af76c1..46c1a7f3 100644 --- a/patches/server/0031-Config-to-disable-method-profiler.patch +++ b/patches/server/0031-Config-to-disable-method-profiler.patch @@ -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 f7f2c18112fc711edda300753ce2f465fe75ba7f..bf0cf0bc2e26c58fb4bef13258947e0021e9ace5 100644 +index c0b01e0aee7fcb66f2940225069366ef02b6ef2a..306415241dbe86eac20b2011ac7676dbca032644 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -283,6 +283,11 @@ public final class LeavesConfig { +@@ -291,6 +291,11 @@ public final class LeavesConfig { useMoreThreadUnsafeRandom = getBoolean("settings.performance.use-more-thread-unsafe-random", useMoreThreadUnsafeRandom); } diff --git a/patches/server/0032-Throttle-goal-selector-during-inactive-ticking.patch b/patches/server/0032-Throttle-goal-selector-during-inactive-ticking.patch index fb5818a3..7671a1b9 100644 --- a/patches/server/0032-Throttle-goal-selector-during-inactive-ticking.patch +++ b/patches/server/0032-Throttle-goal-selector-during-inactive-ticking.patch @@ -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 bf0cf0bc2e26c58fb4bef13258947e0021e9ace5..111787b63f67b1fdcac559faf1cc0eb7d6f0984e 100644 +index 306415241dbe86eac20b2011ac7676dbca032644..85d13feec033d3939dbbe8f1684aa408796a1706 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -288,6 +288,11 @@ public final class LeavesConfig { +@@ -296,6 +296,11 @@ public final class LeavesConfig { disableMethodProfiler = getBoolean("settings.misc.disable-method-profiler", disableMethodProfiler); } diff --git a/patches/server/0033-Skip-cloning-loot-parameters.patch b/patches/server/0033-Skip-cloning-loot-parameters.patch index 0960bb88..8c86305f 100644 --- a/patches/server/0033-Skip-cloning-loot-parameters.patch +++ b/patches/server/0033-Skip-cloning-loot-parameters.patch @@ -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 111787b63f67b1fdcac559faf1cc0eb7d6f0984e..1e7b428f4e8fef77bdc8eae43216fe113484fdcc 100644 +index 85d13feec033d3939dbbe8f1684aa408796a1706..d14eb8bf345552559708bd028bfe5c76d1de3720 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -293,6 +293,11 @@ public final class LeavesConfig { +@@ -301,6 +301,11 @@ public final class LeavesConfig { throttleInactiveGoalSelectorTick = getBoolean("settings.performance.inactive-goal-selector-disable", throttleInactiveGoalSelectorTick); } diff --git a/patches/server/0034-Reduce-entity-allocations.patch b/patches/server/0034-Reduce-entity-allocations.patch index 20f6b261..12fb2b52 100644 --- a/patches/server/0034-Reduce-entity-allocations.patch +++ b/patches/server/0034-Reduce-entity-allocations.patch @@ -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 1e7b428f4e8fef77bdc8eae43216fe113484fdcc..afdb9c047d9f06c6dee5cec24393d5dd5bc9546b 100644 +index d14eb8bf345552559708bd028bfe5c76d1de3720..ddb1ed98be6bcdcd6604025c7996432d613697d8 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -298,6 +298,11 @@ public final class LeavesConfig { +@@ -306,6 +306,11 @@ public final class LeavesConfig { skipCloneLootParameters = getBoolean("settings.performance.skip-clone-loot-parameters", skipCloneLootParameters); } diff --git a/patches/server/0035-Remove-lambda-from-ticking-guard.patch b/patches/server/0035-Remove-lambda-from-ticking-guard.patch index ee0d2662..6765e81a 100644 --- a/patches/server/0035-Remove-lambda-from-ticking-guard.patch +++ b/patches/server/0035-Remove-lambda-from-ticking-guard.patch @@ -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 afdb9c047d9f06c6dee5cec24393d5dd5bc9546b..5c35fe757b7dfffb7570a36e49f13fa2e4680a3a 100644 +index ddb1ed98be6bcdcd6604025c7996432d613697d8..cfc8289915c95596991661e42fe5894aac9225c2 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -303,6 +303,11 @@ public final class LeavesConfig { +@@ -311,6 +311,11 @@ public final class LeavesConfig { reduceEntityAllocations = getBoolean("settings.performance.reduce-entity-allocations", reduceEntityAllocations); } diff --git a/patches/server/0036-Remove-iterators-from-inventory-contains.patch b/patches/server/0036-Remove-iterators-from-inventory-contains.patch index 44cc642a..6b943062 100644 --- a/patches/server/0036-Remove-iterators-from-inventory-contains.patch +++ b/patches/server/0036-Remove-iterators-from-inventory-contains.patch @@ -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 5c35fe757b7dfffb7570a36e49f13fa2e4680a3a..8b4095c0e8797482bca3800ad9dfc4f894e63f85 100644 +index cfc8289915c95596991661e42fe5894aac9225c2..2c4b7a4c69721bfdd6cf8b9f06663dc3ad875fe3 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -308,6 +308,11 @@ public final class LeavesConfig { +@@ -316,6 +316,11 @@ public final class LeavesConfig { removeTickGuardLambda = getBoolean("settings.performance.remove.tick-guard-lambda", removeTickGuardLambda); } diff --git a/patches/server/0037-Remove-streams-from-getting-nearby-players.patch b/patches/server/0037-Remove-streams-from-getting-nearby-players.patch index 1af14dbe..2eeaff03 100644 --- a/patches/server/0037-Remove-streams-from-getting-nearby-players.patch +++ b/patches/server/0037-Remove-streams-from-getting-nearby-players.patch @@ -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 8b4095c0e8797482bca3800ad9dfc4f894e63f85..d797792d4c26ba70c08e0b96f0a611c379b07105 100644 +index 2c4b7a4c69721bfdd6cf8b9f06663dc3ad875fe3..b4555c7beabd15666be6869432d0cb92484a8df8 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -313,6 +313,11 @@ public final class LeavesConfig { +@@ -321,6 +321,11 @@ public final class LeavesConfig { removeInventoryContainsIterators = getBoolean("settings.performance.remove.inventory-contains-iterators", removeInventoryContainsIterators); } diff --git a/patches/server/0038-Remove-streams-and-iterators-from-range-check.patch b/patches/server/0038-Remove-streams-and-iterators-from-range-check.patch index c18f83ce..48a77c83 100644 --- a/patches/server/0038-Remove-streams-and-iterators-from-range-check.patch +++ b/patches/server/0038-Remove-streams-and-iterators-from-range-check.patch @@ -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 d797792d4c26ba70c08e0b96f0a611c379b07105..1c36dd6bdaa0bc11b0a7e082fdcd2061c19a333b 100644 +index b4555c7beabd15666be6869432d0cb92484a8df8..9845b7397c7c3a1e0229d40c054353c4a489e542 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -318,6 +318,11 @@ public final class LeavesConfig { +@@ -326,6 +326,11 @@ public final class LeavesConfig { removeGetNearPlayerStreams = getBoolean("settings.performance.remove.get-nearby-players-streams", removeGetNearPlayerStreams); } diff --git a/patches/server/0039-Async-Pathfinding.patch b/patches/server/0039-Async-Pathfinding.patch index 84f23ed3..5c56b7fe 100644 --- a/patches/server/0039-Async-Pathfinding.patch +++ b/patches/server/0039-Async-Pathfinding.patch @@ -756,16 +756,20 @@ 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 1c36dd6bdaa0bc11b0a7e082fdcd2061c19a333b..1203a5efe08cf6b3606f12c60672bd933718d52a 100644 +index 9845b7397c7c3a1e0229d40c054353c4a489e542..9636d6b7494c937071ea685dad9da06acba6149b 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -323,6 +323,11 @@ public final class LeavesConfig { +@@ -331,6 +331,15 @@ public final class LeavesConfig { removeRangeCheckStreams = getBoolean("settings.performance.remove.range-check-streams-and-iterators", removeRangeCheckStreams); } + public static boolean asyncPathfinding = false; ++ private static boolean asyncPathfindingLock = false; + private static void asyncPathfinding() { -+ asyncPathfinding = getBoolean("settings.performance.async-pathfinding", asyncPathfinding); ++ if (!asyncPathfindingLock) { ++ asyncPathfinding = getBoolean("settings.performance.async-pathfinding", asyncPathfinding); ++ asyncPathfindingLock = true; ++ } + } + public static final class WorldConfig { diff --git a/patches/server/0040-Cache-climbing-check-for-activation.patch b/patches/server/0040-Cache-climbing-check-for-activation.patch index 83c89a22..7def6104 100644 --- a/patches/server/0040-Cache-climbing-check-for-activation.patch +++ b/patches/server/0040-Cache-climbing-check-for-activation.patch @@ -46,11 +46,11 @@ 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 1203a5efe08cf6b3606f12c60672bd933718d52a..2d2cb73b4f8295ce5d60f3089c999bf4c5917a9a 100644 +index 9636d6b7494c937071ea685dad9da06acba6149b..9dc2a8d9de3207d56a6c6567f18ec3286010610e 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -328,6 +328,11 @@ public final class LeavesConfig { - asyncPathfinding = getBoolean("settings.performance.async-pathfinding", asyncPathfinding); +@@ -340,6 +340,11 @@ public final class LeavesConfig { + } } + public static boolean cacheClimbCheck = true; diff --git a/patches/server/0041-Use-aging-cache-for-biome-temperatures.patch b/patches/server/0041-Use-aging-cache-for-biome-temperatures.patch index 205a7699..e8259f4b 100644 --- a/patches/server/0041-Use-aging-cache-for-biome-temperatures.patch +++ b/patches/server/0041-Use-aging-cache-for-biome-temperatures.patch @@ -102,16 +102,20 @@ 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 2d2cb73b4f8295ce5d60f3089c999bf4c5917a9a..f2b028c2905d6a1c83d45280ace377a03f6f4598 100644 +index 9dc2a8d9de3207d56a6c6567f18ec3286010610e..fa323a0348536b4e356a0f796131f2b364a1cb6d 100644 --- a/src/main/java/top/leavesmc/leaves/LeavesConfig.java +++ b/src/main/java/top/leavesmc/leaves/LeavesConfig.java -@@ -333,6 +333,11 @@ public final class LeavesConfig { +@@ -345,6 +345,15 @@ public final class LeavesConfig { cacheClimbCheck = getBoolean("settings.performance.cache-climb-check", cacheClimbCheck); } + public static boolean biomeTemperaturesUseAgingCache = true; ++ private static boolean biomeTemperaturesUseAgingCacheLock = false; + private static void biomeTemperaturesUseAgingCache() { -+ biomeTemperaturesUseAgingCache = getBoolean("settings.performance.biome-temperatures-use-aging-cache", biomeTemperaturesUseAgingCache); ++ if (!biomeTemperaturesUseAgingCacheLock) { ++ biomeTemperaturesUseAgingCache = getBoolean("settings.performance.biome-temperatures-use-aging-cache", biomeTemperaturesUseAgingCache); ++ biomeTemperaturesUseAgingCacheLock = true; ++ } + } + public static final class WorldConfig { diff --git a/patches/server/0042-Reduce-entity-fluid-lookups-if-no-fluids.patch b/patches/server/0042-Reduce-entity-fluid-lookups-if-no-fluids.patch new file mode 100644 index 00000000..e92fc1c1 --- /dev/null +++ b/patches/server/0042-Reduce-entity-fluid-lookups-if-no-fluids.patch @@ -0,0 +1,234 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Sat, 20 Aug 2022 22:52:31 +0800 +Subject: [PATCH] Reduce entity fluid lookups if no fluids + +This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) + +diff --git a/src/main/java/net/minecraft/world/entity/Entity.java b/src/main/java/net/minecraft/world/entity/Entity.java +index 2a55e56b80e2835ca8b3975f3b34e0087d385717..b52eed1005bc118d3dc7f74daabceec574a59349 100644 +--- a/src/main/java/net/minecraft/world/entity/Entity.java ++++ b/src/main/java/net/minecraft/world/entity/Entity.java +@@ -3990,16 +3990,18 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + } + + public boolean updateFluidHeightAndDoFluidPushing(TagKey tag, double speed) { +- if (this.touchingUnloadedChunk()) { ++ if (!top.leavesmc.leaves.LeavesConfig.reduceEntityFluidLookup && this.touchingUnloadedChunk()) { // Leaves - cost of a lookup here is the same cost as below, so skip + return false; + } else { + AABB axisalignedbb = this.getBoundingBox().deflate(0.001D); +- int i = Mth.floor(axisalignedbb.minX); +- int j = Mth.ceil(axisalignedbb.maxX); +- int k = Mth.floor(axisalignedbb.minY); +- int l = Mth.ceil(axisalignedbb.maxY); +- int i1 = Mth.floor(axisalignedbb.minZ); +- int j1 = Mth.ceil(axisalignedbb.maxZ); ++ // Leaves start - rename ++ int minBlockX = Mth.floor(axisalignedbb.minX); ++ int maxBlockX = Mth.ceil(axisalignedbb.maxX); ++ int minBlockY = Mth.floor(axisalignedbb.minY); ++ int maxBlockY = Mth.ceil(axisalignedbb.maxY); ++ int minBlockZ = Mth.floor(axisalignedbb.minZ); ++ int maxBlockZ = Mth.ceil(axisalignedbb.maxZ); ++ // Leaves end + double d1 = 0.0D; + boolean flag = this.isPushedByFluid(); + boolean flag1 = false; +@@ -4007,38 +4009,123 @@ public abstract class Entity implements Nameable, EntityAccess, CommandSource { + int k1 = 0; + BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(); + +- for (int l1 = i; l1 < j; ++l1) { +- for (int i2 = k; i2 < l; ++i2) { +- for (int j2 = i1; j2 < j1; ++j2) { +- blockposition_mutableblockposition.set(l1, i2, j2); +- FluidState fluid = this.level.getFluidState(blockposition_mutableblockposition); ++ // Leaves start - based off CollisionUtil.getCollisionsForBlocksOrWorldBorder ++ if (top.leavesmc.leaves.LeavesConfig.reduceEntityFluidLookup) { ++ final int minSection = io.papermc.paper.util.WorldUtil.getMinSection(this.level); ++ final int maxSection = io.papermc.paper.util.WorldUtil.getMaxSection(this.level); ++ final int minBlock = minSection << 4; ++ final int maxBlock = (maxSection << 4) | 15; + +- if (fluid.is(tag)) { +- double d2 = (double) ((float) i2 + fluid.getHeight(this.level, blockposition_mutableblockposition)); ++ // special cases: ++ if (minBlockY > maxBlock || maxBlockY < minBlock) { ++ // no point in checking ++ return false; ++ } + +- if (d2 >= axisalignedbb.minY) { +- flag1 = true; +- d1 = Math.max(d2 - axisalignedbb.minY, d1); +- if (flag) { +- Vec3 vec3d1 = fluid.getFlow(this.level, blockposition_mutableblockposition); ++ int minYIterate = Math.max(minBlock, minBlockY); ++ int maxYIterate = Math.min(maxBlock, maxBlockY); + +- if (d1 < 0.4D) { +- vec3d1 = vec3d1.scale(d1); +- } ++ int minChunkX = minBlockX >> 4; ++ int maxChunkX = maxBlockX >> 4; ++ ++ int minChunkZ = minBlockZ >> 4; ++ int maxChunkZ = maxBlockZ >> 4; ++ ++ for (int currChunkZ = minChunkZ; currChunkZ <= maxChunkZ; ++currChunkZ) { ++ int minZ = currChunkZ == minChunkZ ? minBlockZ & 15 : 0; // coordinate in chunk ++ int maxZ = currChunkZ == maxChunkZ ? maxBlockZ & 15 : 16; // coordinate in chunk ++ ++ for (int currChunkX = minChunkX; currChunkX <= maxChunkX; ++currChunkX) { ++ int minX = currChunkX == minChunkX ? minBlockX & 15 : 0; // coordinate in chunk ++ int maxX = currChunkX == maxChunkX ? maxBlockX & 15 : 16; // coordinate in chunk ++ ++ net.minecraft.world.level.chunk.ChunkAccess chunk = this.level.getChunkIfLoadedImmediately(currChunkX, currChunkZ); ++ if (chunk == null) { ++ return false; // if we're touching an unloaded chunk then it's false ++ } ++ ++ net.minecraft.world.level.chunk.LevelChunkSection[] sections = chunk.getSections(); ++ ++ for (int currY = minYIterate; currY < maxYIterate; ++currY) { ++ net.minecraft.world.level.chunk.LevelChunkSection section = sections[(currY >> 4) - minSection]; + +- vec3d = vec3d.add(vec3d1); +- ++k1; ++ if (section == null || section.hasOnlyAir() || section.fluidStateCount == 0) { // if no fluids, nothing in this section ++ // empty ++ // skip to next section ++ currY = (currY & ~(15)) + 15; // increment by 15: iterator loop increments by the extra one ++ continue; ++ } ++ ++ net.minecraft.world.level.chunk.PalettedContainer blocks = section.states; ++ ++ for (int currZ = minZ; currZ < maxZ; ++currZ) { ++ for (int currX = minX; currX < maxX; ++currX) { ++ FluidState fluid = blocks.get(currX & 15, currY & 15, currZ & 15).getFluidState(); ++ ++ if (fluid.is(tag)) { ++ blockposition_mutableblockposition.set((currChunkX << 4) + currX, currY, (currChunkZ << 4) + currZ); ++ double d2 = (double) ((float) currY + fluid.getHeight(this.level, blockposition_mutableblockposition)); ++ ++ if (d2 >= axisalignedbb.minY) { ++ flag1 = true; ++ d1 = Math.max(d2 - axisalignedbb.minY, d1); ++ if (flag) { ++ Vec3 vec3d1 = fluid.getFlow(this.level, blockposition_mutableblockposition); ++ ++ if (d1 < 0.4D) { ++ vec3d1 = vec3d1.scale(d1); ++ } ++ ++ vec3d = vec3d.add(vec3d1); ++ ++k1; ++ } ++ // CraftBukkit start - store last lava contact location ++ if (tag == FluidTags.LAVA) { ++ this.lastLavaContact = blockposition_mutableblockposition.immutable(); ++ } ++ // CraftBukkit end ++ } ++ } + } +- // CraftBukkit start - store last lava contact location +- if (tag == FluidTags.LAVA) { +- this.lastLavaContact = blockposition_mutableblockposition.immutable(); ++ } ++ } ++ } ++ } ++ } else { ++ for (int l1 = minBlockX; l1 < maxBlockX; ++l1) { ++ for (int i2 = minBlockY; i2 < maxBlockY; ++i2) { ++ for (int j2 = minBlockZ; j2 < maxBlockZ; ++j2) { ++ blockposition_mutableblockposition.set(l1, i2, j2); ++ FluidState fluid = this.level.getFluidState(blockposition_mutableblockposition); ++ ++ if (fluid.is(tag)) { ++ double d2 = (double) ((float) i2 + fluid.getHeight(this.level, blockposition_mutableblockposition)); ++ ++ if (d2 >= axisalignedbb.minY) { ++ flag1 = true; ++ d1 = Math.max(d2 - axisalignedbb.minY, d1); ++ if (flag) { ++ Vec3 vec3d1 = fluid.getFlow(this.level, blockposition_mutableblockposition); ++ ++ if (d1 < 0.4D) { ++ vec3d1 = vec3d1.scale(d1); ++ } ++ ++ vec3d = vec3d.add(vec3d1); ++ ++k1; ++ } ++ // CraftBukkit start - store last lava contact location ++ if (tag == FluidTags.LAVA) { ++ this.lastLavaContact = blockposition_mutableblockposition.immutable(); ++ } ++ // CraftBukkit end + } +- // CraftBukkit end + } + } + } + } + } ++ // Leaves end + + if (vec3d.length() > 0.0D) { + if (k1 > 0) { +diff --git a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +index b0c9fce9d4e06cac139e341d218d0b6aac1f1943..f53fee91b78ba4c1e17360a40d5a94febd11eb21 100644 +--- a/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java ++++ b/src/main/java/net/minecraft/world/level/chunk/LevelChunkSection.java +@@ -27,6 +27,7 @@ public class LevelChunkSection { + public final PalettedContainer states; + // CraftBukkit start - read/write + private PalettedContainer> biomes; ++ public short fluidStateCount; // Leaves + public final com.destroystokyo.paper.util.maplist.IBlockDataList tickingList = new com.destroystokyo.paper.util.maplist.IBlockDataList(); // Paper + + public LevelChunkSection(int i, PalettedContainer datapaletteblock, PalettedContainer> palettedcontainerro) { +@@ -198,6 +199,7 @@ public class LevelChunkSection { + + if (!fluid.isEmpty()) { + --this.tickingFluidCount; ++ --this.fluidStateCount; // Leaves + } + + if (!state.isAir()) { +@@ -212,6 +214,7 @@ public class LevelChunkSection { + + if (!fluid1.isEmpty()) { + ++this.tickingFluidCount; ++ --this.fluidStateCount; // Leaves + } + + this.updateKnownBlockInfo(x | (z << 4) | (y << 8), iblockdata1, state); // Paper +@@ -260,6 +263,7 @@ public class LevelChunkSection { + if (fluid.isRandomlyTicking()) { + this.tickingFluidCount = (short) (this.tickingFluidCount + 1); + } ++ this.fluidStateCount++; // Leaves + } + + }); +diff --git a/src/main/java/top/leavesmc/leaves/LeavesConfig.java b/src/main/java/top/leavesmc/leaves/LeavesConfig.java +index fa323a0348536b4e356a0f796131f2b364a1cb6d..f2e6d4879afbf8cef5440fc615512e92b61d8085 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 { + } + } + ++ public static boolean reduceEntityFluidLookup = true; ++ private static void reduceEntityFluidLookup() { ++ reduceEntityFluidLookup = getBoolean("settings.performance.reduce-entity-fluid-lookup", reduceEntityFluidLookup); ++ } ++ + public static final class WorldConfig { + + public final String worldName; diff --git a/patches/server/0043-Reduce-chunk-loading-lookups.patch b/patches/server/0043-Reduce-chunk-loading-lookups.patch new file mode 100644 index 00000000..7ee249a6 --- /dev/null +++ b/patches/server/0043-Reduce-chunk-loading-lookups.patch @@ -0,0 +1,59 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: violetc <58360096+s-yh-china@users.noreply.github.com> +Date: Sun, 21 Aug 2022 08:29:15 +0800 +Subject: [PATCH] Reduce chunk loading & lookups + +This patch is Powered by Pufferfish(https://github.com/pufferfish-gg/Pufferfish) + +diff --git a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +index f22e615dba31619c97bf58930da060476a52facf..c330e65310821248409655953b88717f634b0db5 100644 +--- a/src/main/java/net/minecraft/world/entity/monster/EnderMan.java ++++ b/src/main/java/net/minecraft/world/entity/monster/EnderMan.java +@@ -317,11 +317,28 @@ public class EnderMan extends Monster implements NeutralMob { + private boolean teleport(double x, double y, double z) { + BlockPos.MutableBlockPos blockposition_mutableblockposition = new BlockPos.MutableBlockPos(x, y, z); + +- while (blockposition_mutableblockposition.getY() > this.level.getMinBuildHeight() && !this.level.getBlockState(blockposition_mutableblockposition).getMaterial().blocksMotion()) { +- blockposition_mutableblockposition.move(Direction.DOWN); ++ // Leaves start - single chunk lookup ++ BlockState iblockdata; ++ if (top.leavesmc.leaves.LeavesConfig.reduceChuckLoadAndLookup) { ++ net.minecraft.world.level.chunk.LevelChunk chunk = this.level.getChunkIfLoaded(blockposition_mutableblockposition); ++ if (chunk == null) { ++ return false; ++ } ++ ++ while (blockposition_mutableblockposition.getY() > this.level.getMinBuildHeight() && !chunk.getBlockState(blockposition_mutableblockposition).getMaterial().blocksMotion()) { ++ blockposition_mutableblockposition.move(Direction.DOWN); ++ } ++ ++ iblockdata = chunk.getBlockState(blockposition_mutableblockposition); ++ } else { ++ while (blockposition_mutableblockposition.getY() > this.level.getMinBuildHeight() && !this.level.getBlockState(blockposition_mutableblockposition).getMaterial().blocksMotion()) { ++ blockposition_mutableblockposition.move(Direction.DOWN); ++ } ++ ++ iblockdata = this.level.getBlockState(blockposition_mutableblockposition); + } ++ // Leaves end - single chunk lookup + +- BlockState iblockdata = this.level.getBlockState(blockposition_mutableblockposition); + boolean flag = iblockdata.getMaterial().blocksMotion(); + 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 +--- 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 { + reduceEntityFluidLookup = getBoolean("settings.performance.reduce-entity-fluid-lookup", reduceEntityFluidLookup); + } + ++ public static boolean reduceChuckLoadAndLookup = true; ++ private static void reduceChuckLoadAndLookup() { ++ reduceChuckLoadAndLookup = getBoolean("settings.performance.reduce-chuck-load-and-lookup", reduceChuckLoadAndLookup); ++ } ++ + public static final class WorldConfig { + + public final String worldName;