Panda's Structure Optimizer

Speeds up structure generation in big modpacks without changing the world: it keeps upgraded structure templates on disk and computes structure starts ahead of players. No datapack changes; works with C2ME.

Source and issue tracker: github.com/Panda-s-Workshop/pandas-structure-optimizer

Panda's Structure Optimizer

Structures generate faster in big modpacks, and the world stays the same.

In a large pack, most of the time structures take goes into three things: upgrading every structure template through the game's data fixers, again in every session; working out the same structure start more than once; and asking for the same terrain heights over and over. Panda's Structure Optimizer keeps what it has already worked out and computes the rest before the chunks are needed. It needs no datapack changes, it works with and without C2ME, and with default settings a seed generates exactly the structures it would without the mod.

Panda's Structure Optimizer is developed with the help of AI.

Requirements

It runs on the server, which in single player is the game itself. Install it on a dedicated server and in single player; players who join a server don't need it. Download the jar for your loader.

  • Minecraft 26.3 and Java 25
  • NeoForge: NeoForge 26.3.0.89 or newer, and pandas_structure_optimizer-<version>-neoforge.jar.
  • Fabric: Fabric Loader 0.19.5 or newer, Fabric API 0.161.0+26.3 or newer (required), and pandas_structure_optimizer-<version>-fabric.jar.
  • No other mods are needed.

Modpack makers: use the CurseForge download, not the GitHub one.

What to expect

The first session fills the template cache, so it gains less. From the second session on, the time spent upgrading templates is nearly gone.

One scripted five-minute flight over new terrain, in a pack of 276 mod files with C2ME and Lithium among them. This is the time the game spent working out structure starts:

Mod off First session (cache empty) Second session (cache warm)
Structure starts, total 160 s 111 s 53 s
Per generated chunk 22 ms 16 ms 7.7 ms
Steps of 1 s or more 32 13 0
Longest single step 11.2 s 12.7 s 0.7 s

The first session's longest step is a huge structure whose template loaded for the first time. These are one pack and one flight path; your numbers depend on your mods and your machine. /structopt stats shows what the mod saved in your own game.

What it does

  • Upgraded-template cache. The first time a template from a mod or data pack loads, its data after every data fixer is written to disk. Later loads, in this session and in the next ones, read that copy and skip the fixers. A changed template is a new entry, and adding, removing or updating any mod starts a fresh cache. The cache is capped (4 GB by default) and removes the least recently used entries first.
  • Background cache builder. A low-priority thread walks every template the pack can place and upgrades the ones that aren't cached yet. It waits while the machine is busy and carries on at the next start.
  • Separate template loads. Vanilla upgrades a template while holding part of its template map, so threads asking for other templates wait. The mod loads each template once, outside the map, and shares the result.
  • Shared structure-start results. The result of each structure attempt is kept for the session, so a start worked out twice (by another mod, or ahead of time) is only computed once. Every request gets its own copy of the start.
  • Starts computed ahead of players. For a player who is moving, the mod finds the structure candidates in the chunks just past the ones the game already needs, and works them out on its own low-priority threads. The result only reaches the world when the chunk worker asks for it; the mod never schedules chunks.
  • Templates loaded ahead. On any terrain, the templates a likely structure will need are loaded before the game asks.
  • Height cache. Terrain-height answers of the vanilla noise generator are kept in a fixed-size cache.
  • Spawn checks skip unfinished chunks. A spawner now skips a chunk that is still generating instead of making the server thread wait for it.
  • Numbers and warnings. /structopt stats shows cache hits, upgrade time avoided and the ten most expensive structures of the session, with what took most of their time. A structure that places rarely and costs a lot gets one log line.
  • Structure coordinator (optional, new worlds only). Keeps structures from different mods from overlapping. It is off by default and only switches on for worlds created after you turn it on.

Same world

Every speed-up reuses or precomputes something vanilla computes anyway. A test generates a 48×48-chunk square on a dedicated server with the mod off and on, then compares every structure start in it: id, chunk, box, every piece and every reference. It finds no difference with default settings, on NeoForge, on NeoForge with C2ME, and on Fabric, with Seafaring Dungeons, Epic Dungeons, ATi Structures, Grim Kingdoms, DDD and Repurposed Structures in the test pack. Only the optional coordinator changes the world.

Terrain mods

Starts computed ahead and the height cache only run on terrain built entirely from Minecraft's own code, because another mod's terrain may answer heights differently on another thread, and a start computed ahead would then not be the one the chunk worker computes. On such a world (UltraTerraForged, for one) the mod says so once in the log and computes nothing ahead. The template cache, shared results and template loads still apply, and templates are still loaded ahead. A terrain mod known to give the same heights on every thread can be added to terrainTrustedPackages.

Configuration

config/pandas_structure_optimizer.json, the same file on both loaders, read when the server starts. A missing key is written back with its default.

Key Default Meaning
templateCacheEnabled true the upgraded-template cache
templateCacheMaxGigabytes 4 its disk cap
templateCacheBuilder true the background cache builder
templateCacheBuilderMaxCpu 0.75 the builder waits while the machine's CPU load is above this
startCacheMaxMegabytes 64 memory for shared structure-start results
lookaheadEnabled true starts computed ahead
lookaheadExtraChunks 8 how far past the needed chunks, along the direction of travel
lookaheadPrefetchMegabytes 32 about how much memory templates loaded ahead may hold
heightCacheEnabled true the height cache
terrainTrustedPackages [] class name prefixes of terrain code that gives the same heights on every thread
spawnProbesSkipUnfinishedChunks true spawn checks skip unfinished chunks
coordinatorNewWorlds false switch the coordinator on for worlds created from now on

The cache lives in .cache/pandas_structure_optimizer/ in the game or server folder. More keys (threads, queue sizes, coordinator priorities) are in the config file and the repository's design document.

Commands

Command Permission What it does
/structopt stats level 2 this session's numbers, in chat and in the log
/structopt cache clear level 3 deletes this mod set's template cache at the next start
/structopt cache rebuild level 3 the builder checks every template again, now
/structopt coordinator status level 2 whether the coordinator is on for this world, and its structure sets

A dedicated server also logs a one-line summary every five minutes.

Compatibility

  • It goes through vanilla's template manager and structure code, so mods that ship structures benefit without any setup. It defines no tags and changes no data packs.
  • Benchmarked in a pack that also has C2ME, Lithium, ModernFix and Structure Layout Optimizer.
  • Mods that swap the template map keep working: the map itself is never replaced.
  • Found a conflict or a slow structure it doesn't help? Open an issue on GitHub with the /structopt stats output.

Search terms

Structure generation speed, structure gen lag, worldgen lag, chunk generation lag, structure optimization, structure optimizer, template cache, structure template cache, data fixer lag, DataFixerUpper, structure starts, jigsaw structures lag, village lag, "Can't keep up" server overloaded, server tick lag, TPS, exploration lag, pregeneration, Chunky, C2ME, Lithium, ModernFix, Structure Layout Optimizer, large modpack performance, server performance, Fabric, NeoForge, Minecraft 26.3.

Panda's Structure Optimizer Team

profile avatar
  • 13
    Followers
  • 28
    Projects
  • 9.2M
    Downloads

Early token investor in MC modding.

More from pandaismyname1View all

  • UltraTerraForged project image

    UltraTerraForged

    Realistic, configurable terrain: continents, winding rivers, coasts, caves and sea floors. An unofficial, AI-assisted continuation of TerraForged and ReTerraForged.

    • 26.6K
    • November 23, 2026
  • The End That Was Promised project image

    The End That Was Promised

    Step through the portal into a living End, not a boss room: thirteen new biomes, the Ancients' ruins, three seals, and the dragon at the end.

    • 162
    • October 30, 2026
  • Teeming project image

    Teeming

    90 new mobs across the Overworld, Nether and End, each with its own trick, a tell to read and a counter to learn.

    • 126
    • October 29, 2026
  • Full Course project image

    Full Course

    No more hunger. Cook for meals that make you stronger: every food from every mod gets a tier from its recipe chain. Four kitchen stations, 36 dishes and feasts to share. NeoForge and Fabric.

    • 228
    • October 27, 2026
  • UltraTerraForged project image

    UltraTerraForged

    Realistic, configurable terrain: continents, winding rivers, coasts, caves and sea floors. An unofficial, AI-assisted continuation of TerraForged and ReTerraForged.

    • 26.6K
    • November 23, 2026
  • The End That Was Promised project image

    The End That Was Promised

    Step through the portal into a living End, not a boss room: thirteen new biomes, the Ancients' ruins, three seals, and the dragon at the end.

    • 162
    • October 30, 2026
  • Teeming project image

    Teeming

    90 new mobs across the Overworld, Nether and End, each with its own trick, a tell to read and a counter to learn.

    • 126
    • October 29, 2026
  • Full Course project image

    Full Course

    No more hunger. Cook for meals that make you stronger: every food from every mod gets a tier from its recipe chain. Four kitchen stations, 36 dishes and feasts to share. NeoForge and Fabric.

    • 228
    • October 27, 2026