Provided performance optimization for Oritech.
Here are the optimization details:
| No. | Vanilla | Change | Effect |
|---|---|---|---|
| 1 | Powered furnace calls getRecipeFor(SMELTING) every tick; even an empty input scans all smelting recipes | Caches by input item + components + count; empty input returns empty | Idle/repeated inputs go from O(all smelting recipes) to O(1) |
| 2 | Furnace GUI getProgress() / getRecipeDuration() re-query recipes on every call | Reuses the cache from #1 | No per-tick full scan while the GUI is open |
| 3 | MachineBlockEntity.getRecipe() re-runs getRecipeFor every tick; full scan when nothing matches | Per-machine input-signature cache for the getRecipeFor result | Repeated lookups become O(1); fewer scans for idle machines |
| 4 | Centrifuge / cooler / refinery / tainted refinery getRecipe() call getRecipesFor (full scan) every tick | Caches the recipe list by input signature; fluid filtering still runs per tick | Removes the full scan; only matching against a small list remains |
| 5 | Centrifuge getNormalRecipe() re-runs getRecipeFor every tick | Caches by input signature | No repeated scan when no fluid addon is installed |
| 6 | Whenever the pulverizer has ≥9 small dust, every craft calls getRecipesFor(CRAFTING), scanning all crafting recipes in the pack | Caches the recipe list by small dust item + components | Eliminates the high-frequency full crafting-table scan |
| 7 | Item pipes scan every target's slots with IntStream.range(0, slots).allMatch even when not rendering items | Skips the scan for non-rendering pipes | Eliminates wasted slot iteration |
| 8 | Static blockedUntil entries are removed only when the source is visited | Expired entries are cleaned every 200 ticks | Prevents slow accumulation in long-lived saves |
| 9 | DynamicEnergyStorage with maxInsert=0 still reports supportsInsertion() = true | Returns false when maxInsert <= 0 | Generators and output-only storages are no longer treated as valid pipe targets |
| 10 | Every energy pipe interface computes targets.hashCode() every tick | Caches the hash per Set instance + size, mixed with identityHashCode | Removes O(target count) hashing per interface per tick |
| 11 | Energy pipes call transfer for every target even when it is full | Skips full or non-insertable targets | Fewer no-op capability lookups and transfer calls |
| 12 | No cache invalidation on recipe reloads | Bumps epoch and clears caches on server reload/start/stop and client recipe updates | No stale recipes after /reload or rejoining |