Skip to content

ModernFix

BonsUnleashed edited this page Oct 7, 2026 · 3 revisions

ModernFix

Minecraft 1.20.1 / Forge: this page documents that build and its measurements. For the separate 170-control Minecraft 1.21.1 port, see Minecraft 1.21.1 NeoForge.

Four controls for ModernFix 5.27.77 (mod id modernfix): the stronghold position cache is given back while C2ME is installed, the model-location set is walked in order, each cube definition remembers the cube ModernFix shares for it, and JEI's creative tabs are counted with a hash index. How an option is given back is explained on Radium Re-Reforged. Every switch checks the code it would change against the tested build; another build is left untouched with one WARN line (see How the patches are applied).

Key Target Side Since Kind
modernfix_bake_location_order ModernFix 5.27.77 CLIENT 1.0.30 opt
modernfix_c2me_cache_strongholds ModernFix 5.27.77 with C2ME 0.2.0+alpha.12 BOTH 1.0.22 opt
modernfix_cube_bake_memo ModernFix 5.27.77 (compact_entity_models) CLIENT 1.0.30 opt
modernfix_represented_tabs_index ModernFix 5.27.77 with JEI 15.59.0.212 CLIENT 1.0.30 opt

modernfix_c2me_cache_strongholds

Since: 1.0.22 · Side: BOTH · Mixin: StrongholdCacheOptionTrigger Patched: ModernFix's mixin.perf.cache_strongholds option (no method of ModernFix's is changed)

What upstream did. ModernFix switches off its stronghold position cache whenever C2ME is installed. That cache stores the concentric-ring (stronghold) positions of each dimension in the world folder, so a world load reads them instead of searching biomes for every ring position again.

What the patch does. C2ME 0.2.0+alpha.12 does not touch ring placement in any of its 20 module jars, so with exactly that C2ME build (version-pinned at runtime) the cache is switched back on; with another C2ME version, or when C2ME was not the only reason, it stays off. Nothing changes without C2ME (the cache is already on then).

What stays the same. The positions: the cache is ModernFix's own code with ModernFix's own invalidation.

Measured. With C2ME installed, every ring set of every level was read from the cache ("Using cached stronghold positions" × 10). A miss costs about 5 s of ring search per 128-position set at world load (four sets per load in the pack this was built for). Load-time only.


modernfix_bake_location_order

Since: 1.0.30 · Target: ModernFix 5.27.77 · Side: CLIENT · Kind: opt

Mixin: LocationOrderMixin

ModernFix model-location set walked in order. On every resource load (game start, F3+T, resource pack changes) ModernFix shows the mods' model-bake handlers a list of every model location in the game, about 2.4 million here, kept in a linked hash set. Several mods walk all of it (Alex's Mobs, MrCrayfish's Furniture, Mekanism, Refined Storage), and walking that set means jumping through 48 MB of tables, two cache misses per entry: 0.35 to 0.6 s per mod at start-up. Now the same set also remembers its entries in the order they went in, and a walk reads that list instead. It is still the very same set (adds, lookups, sizes are its own), the walk returns the same entries in the same order, and if anything ever changed the set other than an add, it simply walks the old way again.

Idea: found in our own launch profile (ModernFix's emulated bake event, 6.6 s); no outside mod

Measured: offline, 2,700,159 checks identical (ModernFix's own bake helper and every registry view switch on and off, 120,000 random set operations, 2.3 million entries); one full walk over 2.25 million entries 350 -> 19 ms, the mods' own walks 333-816 -> 21-346 ms (about 1.5 s less per resource load, measured with the game's garbage collector).


modernfix_cube_bake_memo

Since: 1.0.30 · Target: ModernFix 5.27.77 (compact_entity_models) · Side: CLIENT · Kind: opt

Mixin: CubeBakeMemoMixin

ModernFix: each cube definition remembers the cube ModernFix shares for it. ModernFix already gives every bake of the same cube the same shared cube object, but to find it, it built a 15-value key (with 13 boxed numbers) and hashed and compared all of it for every cube on every bake. Each cube definition now remembers the cube it was given, with the texture size and the values that can change (its position, size and visible faces), and hands it back while they are unchanged: the very object ModernFix would find. Any change goes through ModernFix again. It stays off without ModernFix's cube sharing. One rare difference inside the game: if two threads bake equal cubes for the very first time at the same moment, ModernFix ends up with two equal cubes and this switch may keep handing out the other one; they are identical geometry, so nothing looks different. -Dbons_and_furious.modernfixCubeBakeMemo.shadow=true asks ModernFix every time and logs any other object (for testing).

Measured: offline on all 257 vanilla and armour layers, the same cube objects as ModernFix hands out, also after positions, sizes and face sets were changed in place; with vanilla_layer_bake_streamless 6.2 -> 1.3 us and 7.6 -> 2.4 KB per layer bake, and 6.9 -> 1.3 us and 11.5 -> 2.4 KB against the unchanged game code (median of 7 rounds).


modernfix_represented_tabs_index

Since: 1.0.30 · Target: ModernFix 5.27.77 with JEI 15.59.0.212 · Side: CLIENT · Kind: opt

Mixin: RepresentedTabsIndexMixin

ModernFix: JEI's represented creative tabs are counted with a hash index. With ModernFix's JEI-backed creative search, the first search inside a creative tab with a search bar (once per JEI session) decides which tabs JEI represents by asking, for every JEI item stack and every creative tab, whether the tab's items contain it: tens of thousands of stacks times every tab, each check hashing the item and its NBT. Now one pass records which tabs hold an item stack with a given hash, and the same check runs, in the same order, only where it can find a match: a stack can only equal an element with the same hash. Same counts, same result. Tabs whose item set is not vanilla's own kind, and empty stacks, get the full check as before. -Dbons_and_furious.modernfixRepresentedTabsIndex.shadow=true counts both ways and logs any difference (for testing).

Measured: offline on ModernFix's own method with 163 creative tabs (31,000 items) and 30,000 JEI stacks, counts identical for the full scene, 60 random sub-scenes and a tab changed during the count, and the same represented tabs; 2.8% of the checks are still needed; 899 -> 176 ms for the one-time count (median of 5 rounds).

Bons and Furious

Minecraft 1.20.1 / Forge 1.0.34

Compatibility

Controls by mod

Links

Clone this wiki locally