Jump to content

JSON patching, load order and reloading patched files


Recommended Posts

Hello!

In order to make my worldgen mod more compatible I (or rather the ModMaker 3000) made a patch version, instead of replacing the file entirely. However, the patch consists of replacing the entire content of the landforms.json with my own. A couple questions in this regard:

Wouldn't another mod that adds landforms be replaced entirely if run before my mod? If so, how can I make my patch load first, so stuff can be added on top?

Is there a way for the patch to persist through reloading the patched file? Currently, if I reload the landform.json through /wgen regen command, it reloads the stock unpatched landform.json, causing issues. Not ideal if the player or a server owner has to regenerate a chunk for whatever reason, or the landform file gets reloaded for whatever reason.

Link to comment
Share on other sites

No expert here, but playing around with dependencies, and looking at the logs to see how it did mod order...

Looks like it loads the dependencies first, in alphabetical order, and mods which have those dependencies alphabetically at the end. So, if you want a mod to load early, put that mod as a dependency to another mod, and give it the earliest possible filename. "aaaaaaaamymod" would load before anything out there, at least that I've found. Similarly, if you wanted to make sure your change was the one that made it into the game, like changing the recipe for something, calling your mod, "zzzzzzzzmymod", and making it depend on "aaaaaaaamymod" should push it to the end of the load order.

Edited by Thorfinn
Link to comment
Share on other sites

Wouldn't edit for some reason.

Strictly speaking, you don't have to put your mapgen mod as a dependency. Just put it as very early in the alphabetical filename order. The first pass through includes all files which have no dependencies. The second pass through is all the mods which now have all the dependencies satisfied. Though I did not test it, I'm guessing it would continue that process until all mods had been included, that is, the third tranche would be the mods which had the last of their dependencies satisfied in the second tranche, and so on.

Edited by Thorfinn
Link to comment
Share on other sites

Figured alphabetic order could have been a solution, not foolproof but it could work.

I am not sure if the dependency stuff you talk about also works with patches, since they get loaded and applied on world load it seems. I will keep messing around with it I guess.

Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.