Upstream has released updates that appear to apply and compile correctly. [Purpur Changes] PurpurMC/Purpur@e86a1b6: Updated Upstream (Paper) PurpurMC/Purpur@962ee30: Updated Upstream (Paper) PurpurMC/Purpur@74d1b4c: Updated Upstream (Paper) PurpurMC/Purpur@e2e8c61: Updated Upstream (Paper) PurpurMC/Purpur@7a01fd8: Updated Upstream (Paper) PurpurMC/Purpur@34c18f0: Updated Upstream (Paper) PurpurMC/Purpur@ca668ab: Updated Upstream (Paper) PurpurMC/Purpur@200178d: Updated Upstream (Paper) PurpurMC/Purpur@9968cbb: Updated Upstream (Paper) PurpurMC/Purpur@db09358: Fix clamp-levels option not being true by default (#1609) PurpurMC/Purpur@f289b6a: Updated Upstream (Paper) PurpurMC/Purpur@959c29d: Fix Tridents giving errors without having an Elytra equipped (#1612) PurpurMC/Purpur@68c1612: Fix villagers not spawning when the `follow-emerald-blocks` option is enabled (#1611) PurpurMC/Purpur@5b75c68: fix `bypass-mob-griefing` not being the inverse of mobgriefing gamerule, closes #1603 PurpurMC/Purpur@55d4309: Updated Upstream (Paper) PurpurMC/Purpur@0601f87: Updated Upstream (Paper) PurpurMC/Purpur@06dde9d: Add Ridable and Attribute options for Creaking mob (#1613) PurpurMC/Purpur@420a1ce: Set the bee's `takes-damage-from-water` option to true by default (#1614) PurpurMC/Purpur@2b6f273: Updated Upstream (Paper) PurpurMC/Purpur@504f311: Updated Upstream (Paper) PurpurMC/Purpur@2b694c9: Updated Upstream (Paper) PurpurMC/Purpur@96d7ef7: Updated Upstream (Paper) PurpurMC/Purpur@e141f68: Updated Upstream (Paper) PurpurMC/Purpur@7f6f667: Updated Upstream (Pufferfish) PurpurMC/Purpur@de20ba9: ignore `minecart.max-speed` config value if using minecart experiment, closes #1618 PurpurMC/Purpur@03062a8: fix ridable mobs not being controllable, closes #1620 PurpurMC/Purpur@0493ac3: Updated Upstream (Paper) PurpurMC/Purpur@16ce24a: fix(ridables/creaking): override tick method in look/move control
74 lines
3.3 KiB
Diff
74 lines
3.3 KiB
Diff
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
|
|
From: AlphaKR93 <dev@alpha93.kr>
|
|
Date: Sun, 27 Oct 2024 00:16:25 +0900
|
|
Subject: [PATCH] Optimize advancement criteria triggering
|
|
|
|
Based on bigenergy/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<InventoryChan
|
|
return InventoryChangeTrigger.TriggerInstance.CODEC;
|
|
}
|
|
|
|
+ // Plazma start - Optimize advancement criteria triggering
|
|
+ public static int idleTick;
|
|
+ private int ticksSkipped;
|
|
+
|
|
+ private boolean shouldTick() {
|
|
+ if (++this.ticksSkipped <= idleTick) return false;
|
|
+
|
|
+ this.ticksSkipped = 0;
|
|
+ return true;
|
|
+ }
|
|
+ // Plazma end - Optimize advancement criteria triggering
|
|
+
|
|
public void trigger(ServerPlayer player, Inventory inventory, ItemStack stack) {
|
|
+ if (idleTick > 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 9e5477d15668488139e431b8289d1fcfac38048c..68a0e7144942022f0665e3124d98add70376d4a4 100644
|
|
--- a/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
+++ b/src/main/java/org/plazmamc/plazma/configurations/GlobalConfiguration.java
|
|
@@ -129,4 +129,16 @@ public class GlobalConfiguration extends ConfigurationPart {
|
|
|
|
}
|
|
|
|
+ public Advancements advancements;
|
|
+ public class Advancements extends ConfigurationPart {
|
|
+
|
|
+ int criteriaTriggerIdleTick = OPTIMIZE ? 5 : 0;
|
|
+
|
|
+ @PostProcess
|
|
+ void post() {
|
|
+ net.minecraft.advancements.critereon.InventoryChangeTrigger.idleTick = this.criteriaTriggerIdleTick;
|
|
+ }
|
|
+
|
|
+ }
|
|
+
|
|
}
|