From 393e079743ea45a0ae4f7c53e691c01b0e42c13c Mon Sep 17 00:00:00 2001 From: AlphaKR93 Date: Sun, 27 Oct 2024 00:18:44 +0900 Subject: [PATCH] minor optimization --- ...mize-advancement-criteria-triggering.patch | 75 +++++++++++++++++++ 1 file changed, 75 insertions(+) create mode 100644 patches/server/0042-Optimize-advancement-criteria-triggering.patch diff --git a/patches/server/0042-Optimize-advancement-criteria-triggering.patch b/patches/server/0042-Optimize-advancement-criteria-triggering.patch new file mode 100644 index 000000000..885786f10 --- /dev/null +++ b/patches/server/0042-Optimize-advancement-criteria-triggering.patch @@ -0,0 +1,75 @@ +From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 +From: AlphaKR93 +Date: Sun, 27 Oct 2024 00:16:25 +0900 +Subject: [PATCH] Optimize advancement criteria triggering + +Based on Achievements Optimizer +Copyright (C) 2024 bigenergy, Licensed under MIT License + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + + +diff --git a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java +index ebbad97920df3d1645637e646a98e16cb04d361e..a149c949a042e1d1e504d9f5ce0bfa6df92db2fc 100644 +--- a/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java ++++ b/src/main/java/net/minecraft/advancements/critereon/InventoryChangeTrigger.java +@@ -22,7 +22,21 @@ public class InventoryChangeTrigger extends SimpleCriterionTrigger 0 && !this.shouldTick()) return; // Plazma - Optimize advancement criteria triggering ++ + int i = 0; + int j = 0; + int k = 0; +diff --git a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +index 9de9b3f2148216df41258d503fa1de896cca4771..e6352488b0fcb0f0332d3d82614930e9c94eb594 100644 +--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java ++++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java +@@ -134,4 +134,17 @@ public class GlobalConfiguration extends ConfigurationPart { + + } + ++ public Advancements advancements; ++ public class Advancements extends ConfigurationPart { ++ ++ int criteriaTriggerIdleTick = OPTIMIZE ? 5 : 0; ++ public boolean optimizeItemPredicate = OPTIMIZE; ++ ++ @PostProcess ++ void post() { ++ net.minecraft.advancements.critereon.InventoryChangeTrigger.idleTick = this.criteriaTriggerIdleTick; ++ } ++ ++ } ++ + }