From d50f8985faed5f017c5b1f7cc417bc17396b0857 Mon Sep 17 00:00:00 2001 From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Wed, 23 Jul 2025 16:50:28 +1400 Subject: [PATCH] Temporarily drop function execution result caching --- ...0268-Cache-function-execution-result.patch | 1 + ...tch => 0268-optimize-no-action-time.patch} | 0 ...int.patch => 0269-optimize-waypoint.patch} | 2 +- ...tion.patch => 0270-Paw-optimization.patch} | 0 ...ig-fixClimbingBypassingCrammingRule.patch} | 2 +- ...72-Skip-inactive-entity-for-execute.patch} | 23 ++------------- ....patch => 0273-Optimise-getEntities.patch} | 0 ...-298464.patch => 0274-fix-MC-298464.patch} | 0 ...stHomeAsWalkTarget-s-poi-finding-to.patch} | 0 ...76-optimize-checkInsideBlocks-calls.patch} | 0 ...{0278-Op-lock.patch => 0277-Op-lock.patch} | 0 .../opt/CacheExecuteCommandResult.java | 28 ------------------- 12 files changed, 6 insertions(+), 50 deletions(-) rename {leaf-server/minecraft-patches/features => leaf-archived-patches/work/server}/0268-Cache-function-execution-result.patch (98%) rename leaf-server/minecraft-patches/features/{0269-optimize-no-action-time.patch => 0268-optimize-no-action-time.patch} (100%) rename leaf-server/minecraft-patches/features/{0270-optimize-waypoint.patch => 0269-optimize-waypoint.patch} (96%) rename leaf-server/minecraft-patches/features/{0271-Paw-optimization.patch => 0270-Paw-optimization.patch} (100%) rename leaf-server/minecraft-patches/features/{0272-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch => 0271-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch} (95%) rename leaf-server/minecraft-patches/features/{0273-Skip-inactive-entity-for-execute.patch => 0272-Skip-inactive-entity-for-execute.patch} (80%) rename leaf-server/minecraft-patches/features/{0274-Optimise-getEntities.patch => 0273-Optimise-getEntities.patch} (100%) rename leaf-server/minecraft-patches/features/{0275-fix-MC-298464.patch => 0274-fix-MC-298464.patch} (100%) rename leaf-server/minecraft-patches/features/{0276-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch => 0275-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch} (100%) rename leaf-server/minecraft-patches/features/{0277-optimize-checkInsideBlocks-calls.patch => 0276-optimize-checkInsideBlocks-calls.patch} (100%) rename leaf-server/minecraft-patches/features/{0278-Op-lock.patch => 0277-Op-lock.patch} (100%) delete mode 100644 leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CacheExecuteCommandResult.java diff --git a/leaf-server/minecraft-patches/features/0268-Cache-function-execution-result.patch b/leaf-archived-patches/work/server/0268-Cache-function-execution-result.patch similarity index 98% rename from leaf-server/minecraft-patches/features/0268-Cache-function-execution-result.patch rename to leaf-archived-patches/work/server/0268-Cache-function-execution-result.patch index be13d122..2e9e32d8 100644 --- a/leaf-server/minecraft-patches/features/0268-Cache-function-execution-result.patch +++ b/leaf-archived-patches/work/server/0268-Cache-function-execution-result.patch @@ -3,6 +3,7 @@ From: HaHaWTH <102713261+HaHaWTH@users.noreply.github.com> Date: Tue, 9 Nov 2077 00:00:00 +0800 Subject: [PATCH] Cache function execution result +TODO: Need to find a better way to identify the entity selector, currently splitting command arguments is a bit brittle. diff --git a/net/minecraft/commands/arguments/EntityArgument.java b/net/minecraft/commands/arguments/EntityArgument.java index 8f6a1788b5ca396b79a638955fc6a6b3a276337f..4acf68e42a9644612608c8521020a989cbdea4a9 100644 diff --git a/leaf-server/minecraft-patches/features/0269-optimize-no-action-time.patch b/leaf-server/minecraft-patches/features/0268-optimize-no-action-time.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0269-optimize-no-action-time.patch rename to leaf-server/minecraft-patches/features/0268-optimize-no-action-time.patch diff --git a/leaf-server/minecraft-patches/features/0270-optimize-waypoint.patch b/leaf-server/minecraft-patches/features/0269-optimize-waypoint.patch similarity index 96% rename from leaf-server/minecraft-patches/features/0270-optimize-waypoint.patch rename to leaf-server/minecraft-patches/features/0269-optimize-waypoint.patch index 6aec3971..9faccfc8 100644 --- a/leaf-server/minecraft-patches/features/0270-optimize-waypoint.patch +++ b/leaf-server/minecraft-patches/features/0269-optimize-waypoint.patch @@ -5,7 +5,7 @@ Subject: [PATCH] optimize waypoint diff --git a/net/minecraft/world/entity/Entity.java b/net/minecraft/world/entity/Entity.java -index bdac75d6c9805af0363d2d183330318ca2ff82da..2b29b0e5334ad9f8b3768e9b198565f093c6d3a4 100644 +index e054c2416919fe8814412e6e06cd82e4ea537c84..a253d714670f932d67e2c44fdf895716b6b595ec 100644 --- a/net/minecraft/world/entity/Entity.java +++ b/net/minecraft/world/entity/Entity.java @@ -5144,6 +5144,7 @@ public abstract class Entity implements SyncedDataHolder, Nameable, EntityAccess diff --git a/leaf-server/minecraft-patches/features/0271-Paw-optimization.patch b/leaf-server/minecraft-patches/features/0270-Paw-optimization.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0271-Paw-optimization.patch rename to leaf-server/minecraft-patches/features/0270-Paw-optimization.patch diff --git a/leaf-server/minecraft-patches/features/0272-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch b/leaf-server/minecraft-patches/features/0271-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch similarity index 95% rename from leaf-server/minecraft-patches/features/0272-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch rename to leaf-server/minecraft-patches/features/0271-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch index b94c7613..c0cf0696 100644 --- a/leaf-server/minecraft-patches/features/0272-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch +++ b/leaf-server/minecraft-patches/features/0271-Fix-Paper-config-fixClimbingBypassingCrammingRule.patch @@ -6,7 +6,7 @@ Subject: [PATCH] Fix Paper config fixClimbingBypassingCrammingRule Waiting for Paper#12793 diff --git a/net/minecraft/world/entity/LivingEntity.java b/net/minecraft/world/entity/LivingEntity.java -index 3a669d98db60bfe19aa0c4b55dc28d06d44f7b88..fdb6527c9d7e18c37e681ea2d8e4428ece49e2ff 100644 +index 5307e80f6e84df7a053e7132883d8338bbd751a0..d6be86981219f0fe0db15d36d9c85e9a56020373 100644 --- a/net/minecraft/world/entity/LivingEntity.java +++ b/net/minecraft/world/entity/LivingEntity.java @@ -3850,7 +3850,7 @@ public abstract class LivingEntity extends Entity implements Attackable, Waypoin diff --git a/leaf-server/minecraft-patches/features/0273-Skip-inactive-entity-for-execute.patch b/leaf-server/minecraft-patches/features/0272-Skip-inactive-entity-for-execute.patch similarity index 80% rename from leaf-server/minecraft-patches/features/0273-Skip-inactive-entity-for-execute.patch rename to leaf-server/minecraft-patches/features/0272-Skip-inactive-entity-for-execute.patch index 5ad9ace7..03a38baa 100644 --- a/leaf-server/minecraft-patches/features/0273-Skip-inactive-entity-for-execute.patch +++ b/leaf-server/minecraft-patches/features/0272-Skip-inactive-entity-for-execute.patch @@ -5,29 +5,12 @@ Subject: [PATCH] Skip inactive entity for execute diff --git a/net/minecraft/commands/arguments/EntityArgument.java b/net/minecraft/commands/arguments/EntityArgument.java -index 4acf68e42a9644612608c8521020a989cbdea4a9..76487244de9caad06696f2f4910c52c09547f775 100644 +index 8f6a1788b5ca396b79a638955fc6a6b3a276337f..43939f516c0270252c8fe3723f95a0dd87061301 100644 --- a/net/minecraft/commands/arguments/EntityArgument.java +++ b/net/minecraft/commands/arguments/EntityArgument.java -@@ -76,7 +76,7 @@ public class EntityArgument implements ArgumentType { - String selectorString = context.getInput().substring(idxStart, idxEnd); - Collection entities = TICK_ENTITY_CACHE.get(selectorString); - if (entities == null) { -- entities = selector.findEntities(context.getSource()); -+ entities = org.dreeam.leaf.config.modules.opt.SkipInactiveEntityForExecute.skipInactiveEntityForExecute ? selector.findEntitiesSkipInactive(context.getSource()) : selector.findEntities(context.getSource()); - TICK_ENTITY_CACHE.put(selectorString, entities); - } - return entities; -@@ -90,14 +90,17 @@ public class EntityArgument implements ArgumentType { - String selectorString = context.getInput().substring(idxStart, idxEnd); - Collection entities = TICK_ENTITY_CACHE.get(selectorString); - if (entities == null) { -- entities = selector.findEntities(context.getSource()); -+ entities = org.dreeam.leaf.config.modules.opt.SkipInactiveEntityForExecute.skipInactiveEntityForExecute ? selector.findEntitiesSkipInactive(context.getSource()) : selector.findEntities(context.getSource()); // Leaf - Skip inactive entity for execute - TICK_ENTITY_CACHE.put(selectorString, entities); - } - return entities; +@@ -66,7 +66,10 @@ public class EntityArgument implements ArgumentType { } - // Leaf end - Cache function getEntity calls + public static Collection getOptionalEntities(CommandContext context, String name) throws CommandSyntaxException { - return context.getArgument(name, EntitySelector.class).findEntities(context.getSource()); + // Leaf start - Skip inactive entity for execute diff --git a/leaf-server/minecraft-patches/features/0274-Optimise-getEntities.patch b/leaf-server/minecraft-patches/features/0273-Optimise-getEntities.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0274-Optimise-getEntities.patch rename to leaf-server/minecraft-patches/features/0273-Optimise-getEntities.patch diff --git a/leaf-server/minecraft-patches/features/0275-fix-MC-298464.patch b/leaf-server/minecraft-patches/features/0274-fix-MC-298464.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0275-fix-MC-298464.patch rename to leaf-server/minecraft-patches/features/0274-fix-MC-298464.patch diff --git a/leaf-server/minecraft-patches/features/0276-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch b/leaf-server/minecraft-patches/features/0275-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0276-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch rename to leaf-server/minecraft-patches/features/0275-Re-route-SetClosestHomeAsWalkTarget-s-poi-finding-to.patch diff --git a/leaf-server/minecraft-patches/features/0277-optimize-checkInsideBlocks-calls.patch b/leaf-server/minecraft-patches/features/0276-optimize-checkInsideBlocks-calls.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0277-optimize-checkInsideBlocks-calls.patch rename to leaf-server/minecraft-patches/features/0276-optimize-checkInsideBlocks-calls.patch diff --git a/leaf-server/minecraft-patches/features/0278-Op-lock.patch b/leaf-server/minecraft-patches/features/0277-Op-lock.patch similarity index 100% rename from leaf-server/minecraft-patches/features/0278-Op-lock.patch rename to leaf-server/minecraft-patches/features/0277-Op-lock.patch diff --git a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CacheExecuteCommandResult.java b/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CacheExecuteCommandResult.java deleted file mode 100644 index d373e168..00000000 --- a/leaf-server/src/main/java/org/dreeam/leaf/config/modules/opt/CacheExecuteCommandResult.java +++ /dev/null @@ -1,28 +0,0 @@ -package org.dreeam.leaf.config.modules.opt; - -import org.dreeam.leaf.config.ConfigModules; -import org.dreeam.leaf.config.EnumConfigCategory; -import org.dreeam.leaf.config.annotations.Experimental; - -public class CacheExecuteCommandResult extends ConfigModules { - - public String getBasePath() { - return EnumConfigCategory.PERF.getBaseKeyName() + ".datapack"; - } - - @Experimental - public static boolean cacheExecuteCommandResult = false; - - @Override - public void onLoaded() { - cacheExecuteCommandResult = config.getBoolean(getBasePath() + ".cache-execute-command-result", cacheExecuteCommandResult, - config.pickStringRegionBased(""" - *** Experimental Feature *** - Cache the result of same execute command in the current and next tick. - Will improve performance on servers with massive datapack functions.""", - """ - *** 实验性功能 *** - 缓存当前和下一 tick 相同的 execute 命令结果. - 将会提升有大量数据包函数的服务器性能.""")); - } -}