### Achievements Optimizer Configuration File Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Example TOML configuration file for the Achievements Optimizer mod. These settings control tick skipping for advancement checks and whether to ignore empty item stacks. Changes require a server restart. ```toml # config/achiopt-common.toml # (auto-generated on first launch) # Number of ticks to skip between advancement inventory checks. # 0 = disabled (vanilla behaviour). Default: 5 # Range: 0 ~ 2147483647 skipTicksAdvancements = 5 # When true, inventory change events caused by an empty ItemStack are # cancelled before any predicate evaluation begins. # Default: true ignoreEmptyStacks = true ``` -------------------------------- ### NeoForge Platform Configuration Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Sets the build platform to NeoForge. This property is typically placed in a platform-specific `gradle.properties` file. ```properties loom.platform = neoforge ``` -------------------------------- ### NeoForge Mod Entry Point Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt The main class for the NeoForge implementation of the Achievements Optimizer mod. It initializes the mod, registers the common configuration spec, and ensures the mod is discovered by NeoForge. ```java // neoforge/src/main/java/com/bigenergy/achiopt/neoforge/AchioptNeoForge.java @Mod(Achiopt.MOD_ID) // MOD_ID = "achiopt" public final class AchioptNeoForge { public AchioptNeoForge(IEventBus eBuss, ModContainer container) { new Achiopt(); Achiopt.init(); // logs "Enabling Achievement Optimizer" container.registerConfig(ModConfig.Type.COMMON, Achiopt.CONFIG_SPEC); } } ``` -------------------------------- ### InventoryChangeTrigger_TriggerInstanceMixin: Fast Matching Algorithm Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Replaces the vanilla multi-predicate matching algorithm in TriggerInstance#matches with an allocation-free approach using a fixed boolean array. This significantly reduces garbage collection pressure. ```java @Inject( method = "matches(Lnet/minecraft/world/entity/player/Inventory;" + "Lnet/minecraft/world/item/ItemStack;III)Z", at = @At("HEAD"), cancellable = true ) private void achiopt$fastMatch(Inventory inventory, ItemStack changed, int full, int empty, int occupied, CallbackInfoReturnable cir) { // Step 1: cheap slot-count check first (fails fast for most triggers) if (!this.slots().matches(full, empty, occupied)) { cir.setReturnValue(false); return; } List req = this.items(); int size = req.size(); // Step 2: no item requirements — trivially passes if (size == 0) { cir.setReturnValue(true); return; } // Step 3: single predicate — test only the changed stack (vanilla fast path) if (size == 1) { cir.setReturnValue(!changed.isEmpty() && req.get(0).test(changed)); return; } // Step 4: multiple predicates — single-pass, allocation-free matching boolean[] matched = new boolean[size]; // stack-allocated for small N int remaining = size; final int len = inventory.getContainerSize(); for (int i = 0; i < len && remaining > 0; i++) { ItemStack s = inventory.getItem(i); if (s.isEmpty()) continue; // skip air slots immediately for (int idx = 0; idx < size; idx++) { if (!matched[idx] && req.get(idx).test(s)) { matched[idx] = true; if (--remaining == 0) break; // all predicates satisfied, stop early } } } cir.setReturnValue(remaining == 0); // Vanilla equivalent used ObjectArrayList + removeIf: // allocates ~(size * 8) bytes of heap per call → GC pressure at scale ``` -------------------------------- ### Accessing Achievements Optimizer Config in Java Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Demonstrates how to retrieve configuration values for `skipTicksAdvancements` and `ignoreEmptyStacks` from the Achievements Optimizer mod in server-side Java code. This allows dynamic adjustment of optimization behavior. ```java // Accessing config values from any server-side code: import com.bigenergy.achiopt.Achiopt; int skip = Achiopt.CONFIG.skipTicksAdvancements.get(); // e.g. 5 boolean ig = Achiopt.CONFIG.ignoreEmptyStacks.get(); // e.g. true // Typical server tick budget comparison (pseudocode): // Vanilla: InventoryChangeTrigger fires ~20 times/sec per player inventory slot change // With mod: fires at most once every `skip` ticks (i.e. once every 250 ms at skip=5) ``` -------------------------------- ### Mixin Registration Configuration Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Declares the mixins for both server and client environments. Ensures build failure if injection targets are not found, guarding against Minecraft updates. ```json { "required": true, "package": "com.bigenergy.achiopt.mixin", "compatibilityLevel": "JAVA_21", "minVersion": "0.8", "mixins": [ "InventoryChangeTrigger_TriggerInstanceMixin", "InventoryChangeTriggerMixin" ], "injectors": { "defaultRequire": 1 } } ``` -------------------------------- ### Fabric Mod Entry Point Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt The main class for the Fabric implementation of the Achievements Optimizer mod. It implements `ModInitializer` and uses Forge Config API Port to register the common configuration, ensuring compatibility with the NeoForge config format. ```java // fabric/src/main/java/com/bigenergy/achiopt/fabric/AchioptFabric.java public final class AchioptFabric implements ModInitializer { @Override public void onInitialize() { new Achiopt(); Achiopt.init(); NeoForgeConfigRegistry.INSTANCE.register( Achiopt.MOD_ID, ModConfig.Type.COMMON, Achiopt.CONFIG_SPEC ); } } ``` -------------------------------- ### Gradle Properties for Version Pinning Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Defines key version numbers for dependencies and the Minecraft version. These are used across the multi-project build. ```properties mod_version = 2.1.0 minecraft_version = 1.21.1 architectury_api_version = 13.0.8 fabric_loader_version = 0.16.10 fabric_api_version = 0.115.1+1.21.1 neoforge_version = 21.1.122 forge_config_api_port_version = 21.1.1 ``` -------------------------------- ### InventoryChangeTriggerMixin: Head Injection for Trigger Cancellation Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Injects at the HEAD of InventoryChangeTrigger#trigger to cancel the entire trigger based on empty stack or tick-skip guards. This prevents unnecessary slot counting and predicate loops. ```java // Injected method signature (vanilla): // void trigger(ServerPlayer player, Inventory inv, ItemStack changed) @Inject( method = "trigger(Lnet/minecraft/server/level/ServerPlayer;" + "Lnet/minecraft/world/entity/player/Inventory;" + "Lnet/minecraft/world/item/ItemStack;)V", at = @At("HEAD"), cancellable = true ) private void achiopt$gate(ServerPlayer player, Inventory inv, ItemStack changed, CallbackInfo ci) { // Guard 1: drop events caused by empty stacks entirely if (Achiopt.CONFIG.ignoreEmptyStacks.get() && changed.isEmpty()) { ci.cancel(); // <-- vanilla trigger body never runs return; } // Guard 2: only process on ticks that are divisible by `skip` int skip = Achiopt.CONFIG.skipTicksAdvancements.get(); if (skip > 0) { int now = player.getServer().getTickCount(); if ((now % skip) != 0) { ci.cancel(); // <-- skips heavy full/empty/occupied slot counting } } } // Effect at skip=5, 4 players, 36-slot inventory, 20 TPS: // Vanilla checks: 20 * 4 * 36 = 2 880 trigger calls/sec (worst case) // With mod: 4 * 4 * 36 = 576 trigger calls/sec (80 % reduction) ``` -------------------------------- ### Fabric Mod JSON Dependencies Source: https://context7.com/bigenergy/achievement-optimizer/llms.txt Specifies the dependencies required for the Fabric mod. This block is part of the `fabric.mod.json` file. ```json "depends": { "fabricloader": ">=0.16.10", "minecraft": "~1.21.1", "java": ">=21", "architectury": ">=13.0.8", "fabric-api": "*", "forgeconfigapiport": "*" } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.