Jump to content

Mod development on Mac


Recommended Posts

Hello everyone, I have been learning how to mod the past two weeks, until I finally released my first mod Bear Trap and I think it would be useful for me to list the things I've learnt about modding on Mac, since I couldn't find many resources online. So, if you currently are or are going to attempt to develop a mod on Mac, please share here all of your tips! From what I could find, there's not many of us, so we should try to pool together all we know to make ours and future modders' life a bit easier.

Here is what I found so far, I will update this as I find out new things.

Content Mods

When zipping, do not select the directory and compress. This will compress it as a folder with your mod folder inside, instead of just its contents. The game will not be able to load the mod and will tell you it cannot find modinfo.json. What you should do instead is select all the contents of your mod folder at the same time and compress those.

IDE

I use Rider but VS Code should work perfectly fine too. Rider allows for hot-swapping code which is great for testing things like GUIs and small adjustments to non-static methods and parameters without restarting the game.

Project Setup

After following the setup instruction described here Setting up your Development Environment, I needed to slightly tweak the template to make it work. Since for some reason launching the Vintagestory unix executable with the --addModPath startup parameter didn't seem to work, I had to first set up a separate Vintage Story installation that I use only for modding (and set its location as the VINTAGE_STORY environment variable), then modify the launch configurations in launchSettings.json to copy the compiled mod to in the internal mods folder of the installation, and update it every time you change your code.

{
  "profiles": {
    "Client": {
      "commandName": "Executable",
      "executablePath": "bash",
      "commandLineArgs": "-c \"for dir in $(ProjectDir)/bin/$(Configuration)/Mods/*; do rsync -a --delete ${dir%/}/ $(VINTAGE_STORY)/Mods/$(basename $dir); done && $(VINTAGE_STORY)/Vintagestory --tracelog\"",
      "workingDirectory": "$(VINTAGE_STORY)"
    },
    "Server": {
      "commandName": "Executable",
      "executablePath": "bash",
      "commandLineArgs": "-c \"for dir in $(ProjectDir)/bin/$(Configuration)/Mods/*; do rsync -a --delete ${dir%/}/ $(VINTAGE_STORY)/Mods/$(basename $dir); done && $(VINTAGE_STORY)/VintagestoryServer --tracelog\"",
      "workingDirectory": "$(VINTAGE_STORY)"
    }
  }
}
Edited by jayu
format
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.