DArkHekRoMaNT 115 Posted October 24, 2020 Report Share Posted October 24, 2020 (edited) A simple library for Vintage Story that makes it easy to add compatibility with other mods for assets. Easy way Spoiler You just need to add your asset to assets/<yourmodid>/compatibility/<othermodid>/<vanilla-path>. They will only be loaded if <othermodid> is loaded. For example: I have a More Variants mod (modid - morevariants), I want to add a patch to support Carry Capacity (modid - carrycapacity) and add recipes for Extra Chests (modid - extrachests). As a result, the assets will look like this: assets morevariants blocktypes patches recipes compatibility carrycapacity patches carryable.json betterchests recipes grid copperchest.json copperlabeledchest.json P.S. If assets/<yourmodid>/<vanilla-path> and assets/<yourmodid>/compatibility/<othermodid>/<vanilla-path> exists then if <othermodid> is loaded, the first asset will be replaced. Advanced (v1.2+) Spoiler You can use dependsOn[] in json-patch for create mod-dependent patch. For example: dependsOn[{"modid": "morerecipes"}] - loaded if enabled morerecipes mod dependsOn[{"modid": "morerecipes", "invert": true}] - loaded if disabled morerecipes mod dependsOn[{"modid": "morerecipes"}, {"modid": "captureanimals"}] - loaded if enabled morerecipes AND captureanimals mods dependsOn[{"modid": "morerecipes"}, {"modid": "captureanimals", "invert": true}] - loaded if enabled morerecipes AND disabled captureanimals Warning! Unlike the easy way, if you use mod-dependent patches, it is advisable to add compatibilitylib in the mod dependencies, otherwise all patches will be loaded without the library installed. How to add to modinfo.json: { "modid": "bestmod", <...> "dependencies": { "game": "1.13.4", <-- minimal game version for your mod "compatibilitylib": "1.2.0" <-- minimal CL version } } Full patch example: [ { "_comment": "If you add enable: false to your recipe, you can simply enable it when the desired mod is loaded", "file": "recipes/grid/best-other-fish-recipe.json", "op": "replace", "path": "/enabled", "value": true, "dependsOn": [{ "modid": "primitivesurvival" }] }, { "_comment": "Otherwise, just disable the recipe when the mod is not loaded", "file": "recipes/grid/best-fish-recipe.json", "op": "add", "path": "/enabled", "value": false, "dependsOn": [{ "modid": "primitivesurvival", "invert": true }] }, { "_comment": "Or when two mods are loaded :P", "file": "recipes/grid/best-fish-recipe-with-acorns.json", "op": "replace", "path": "/enabled", "value": true, "dependsOn": [ { "modid": "primitivesurvival" }, { "modid": "acorns" } ] }, { "_comment": "For simplicity, you can patch all recipes in a folder at once with *", "file": "recipes/grid/morerecipes-disable/*", "op": "add", "path": "/enabled", "value": false, "dependsOn": [{ "modid": "morerecipes" }] } ] Download: ModDB or GitHub Install as a regular mod, just add archive to your mods folder. Edited Monday at 09:30 AM by DArkHekRoMaNT 3 4 Quote Link to post Share on other sites
Bladimiro Herrero 6 Posted October 25, 2020 Report Share Posted October 25, 2020 This is going to simplify things so much! Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted November 10, 2020 Author Report Share Posted November 10, 2020 v1.1: Improved code and behavior when the same asset exists. Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted November 27, 2020 Author Report Share Posted November 27, 2020 (edited) Works on 1.14.0-rc.4 as is. Edited November 27, 2020 by DArkHekRoMaNT Quote Link to post Share on other sites
xCoiotex 2 Posted December 7, 2020 Report Share Posted December 7, 2020 does it works on 1.14.0 release? Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted December 7, 2020 Author Report Share Posted December 7, 2020 4 hours ago, xCoiotex said: does it works on 1.14.0 release? Haven't tested but should work. It is very difficult to break this library anyway. This is a very simple code)) Quote Link to post Share on other sites
Minnigin 19 Posted December 7, 2020 Report Share Posted December 7, 2020 5 hours ago, xCoiotex said: does it works on 1.14.0 release? seems fine so far Quote Link to post Share on other sites
Sukotto82 16 Posted December 21, 2020 Report Share Posted December 21, 2020 so would this work with my Clay+Misc mod or do I need to finish cleaning it up and replacing everything in a more traditional mod form to work? right now it's only released as it is made using the mod maker provided by VS and as result it doesn't transfer textures so I opened the mod zip it created and added the texture folder manually, other than that it is however the mod maker makes it. I haven't gotten any feed back so I don't know if my mod even works for other people as of right now. it works for me but that's because I have the original JSON that I added in the vanilla Roaming > Vintagestory > assets > survival folder and everything is working on my end except the poring of the saw mold and I'm working on that. I'll be re-writing the whole thing in a proper mod folder using the game: reference line and everything but right now it's being hard to make work that way. it works best right in the folders themselves but I'm still learning and working on it. I wish it was as easy as modding 7 days to die and simply have a UIAtlases for my textures and a mod folder with <mymodname> <append xpath="/items"> put all the new items I want to add between here then close it with </append> </mymodname> this would be so much easier but this whole JSON thing is new to me and I'm still trying to figure it out. Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted December 21, 2020 Author Report Share Posted December 21, 2020 (edited) 2 hours ago, Sukotto82 said: Roaming > Vintagestory > assets > survival Don't do this, it will NOT work for other people. Put this file in assets/game in your mod folder. But in general, the library just looks at the assets in the compatibility category and checks for the modid in the list of loaded mods. This should work for vanilla too. Edited December 21, 2020 by DArkHekRoMaNT 1 Quote Link to post Share on other sites
jakecool19 67 Posted January 24 Report Share Posted January 24 This is absolutely brilliantly and works really nicely. I will definitely be using it more for future projects. Quote Link to post Share on other sites
Yvette Forty 1 Posted January 31 Report Share Posted January 31 Okay, I have a lot of mods now and would like a few more but need this, but have been avoiding this because I don't understand this. I have only ever been a designer and dabbled in flash animation a long while ago but am better at graphics than code. So I can't comfortable use something I don't understand. So, can I get a step by step for dummies on how to use this and when to use this mod and what you use and where the assets might be? Sorry... Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted January 31 Author Report Share Posted January 31 @Yvette Forty this is a library for mod devs, usually authors indicate if required. All the player needs to do is just add it to the mods folder like a regular mod. Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted Sunday at 04:10 PM Author Report Share Posted Sunday at 04:10 PM v1.2.0: Added Harmony patch for use dependsOn in json-patches (see readme or first post for more info) 1 Quote Link to post Share on other sites
DArkHekRoMaNT 115 Posted Sunday at 05:44 PM Author Report Share Posted Sunday at 05:44 PM v1.2.1: Fixed inverted skip and skip by default Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.