Mods / Early Mod Tool Kit

Category: #Library #Other #QoL #Tweak #Utility
Author: mathgeniuszach
Side: Both
Created: Jul 19th 2023 at 11:56 AM
Last modified: Jan 22nd at 2:59 AM
Downloads: 4304
Follow Unfollow 80

Latest version:
EarlyModToolKit-3.1.0.zip


This is a zip file containing an executable, not a mod you put in the mod folder. Why? Because mods that could modify the title screen were patched out by the devs, so this is the next best thing.

Both a Windows and Linux version are available. Let me know of any issues on Discord.

Description

Early Mod Toolkit is an executable wrapper that launches Vintage Story with several patches to the mod screen and loader. In specific, it adds the ability to browse mods, swap out various mod profiles (for differing servers), update or downgrade mods, and load mods early (before loading into a world) from within the game itself. It also logs the time it takes to run any C# code in a mod. If you want to help localize the mod, you can do so via an early mod as described below.

Got a problem with this wrapper or need to see it updated? Let me know on my Discord! Support me on Patreon or Ko-Fi.

I also recommend checking out Laerinok's ModsUpdater script if you want just the automatic mod updating functionality without all the extra features, or if you're running a server. EMTK also doesn't play well with Maestro's Vintage Launcher, while ModsUpdater does a bit better.

NOTE: This is a zip file contaning an executable, not a mod you put in the mod folder. If you installed Vintage Story automatically, you should just be able to run the linux or windows executable and it will automatically find the game; if this doesn't work for you or if you installed Vintage Story manually, put the Vintagestory executable and any dlls into the place you installed Vintagestory and try running it again.

Usage

Installed Mods page with numbers

In the new mod screen screenshot, here's a list of what each of the numbers mean:

  1. Clicking on this link will open the EMTK page (this page). Occasionally it will say "Update!!!" which means a new update is available.
  2. Adds a new empty mod profile.
  3. Erases the current mod profile.
  4. Renames the current mod profile.
  5. Dropdown for swapping existing profiles.
  6. Clicking on the left side of the mod will open up a new screen showing the mod's versions and description as found on the ModDB. Clicking on the little toggle cells on the right side disable/enable installed mods.
  7. This button opens up the mod browser, for browsing and quickly installing/uninstalling mods with the toggle cells on the right side.
  8. This button checks for any updates of the currently installed mods. In the screen that pops up, turn the toggle cells off for any mod you do not want to update.
  9. In the base game, opens the mod folder.
  10. In the base game, reloads all mods.

Early Mods

To create mods which load on the title screen, add a new json file to your mod zip called "earlymod.json" (dll-only mods not supported). The presence of this file is enough to get the mod and it's assets to load early (for modding language files and textures on the title screen, for example), but you can specify the field (in the json), "ReloadTitle" (boolean) to change if after enabling/disabling the mod the title screen should be reloaded, and you can also specify the field, "LoadOrder" (double), to change the order the mod and its assets get loaded in (smaller numbers go first).

The default json is: {"ReloadTitle": false, "LoadOrder": 0.0}

EMTK also adds two optional static callbacks called on every ModSystem for code mods:

  • static void EarlyLoad(ModContainer mod, ScreenManager sm)
        Called when mods are loaded/reloaded and the mod is not disabled, or when the mod is re-enabled.
        "mod" is the ModContainer this code was found in.
        "sm" is the main ScreenManager object used to swap guis and store a lot of early game methods.
  • static void EarlyUnload()
        Called when mods are reloaded, or if this mod is disabled/removed.
        On reload, unloading occurs in the opposite order of loading.

It's not always feasible for every mod to be "Unloaded" or "Reloaded" with certain changes, but it leads to the best user experience when the user can disable/enable any mods ingame with a runtime reload. If this is not possible, indicate it in your mod description, and guard your EarlyLoad() function with a variable so it only runs once.

Version For Game version Downloads Release date Changelog Download 1-click mod install*
v3.1.0
620 Jan 22nd at 2:59 AM Show EarlyModToolKit-3.1.0.zip
v3.0.5
454 Sep 24th 2023 at 4:24 AM Show EarlyModToolKit-3.0.5.zip
v3.0.4
293 Sep 5th 2023 at 1:41 AM Show EarlyModToolKit-3.0.4.zip
v3.0.3
194 Sep 4th 2023 at 3:27 AM Show EarlyModToolkit-3.0.3.zip
v3.0.2
341 Aug 10th 2023 at 6:59 AM Show EarlyModToolKit-3.0.2.zip
v3.0.1
224 Aug 3rd 2023 at 3:30 AM Show EarlyModToolkit-3.0.1.zip
v3.0.0
206 Aug 1st 2023 at 9:53 PM Show EarlyModToolkit-3.0.0.zip
v2.0.9
212 Jul 30th 2023 at 3:26 AM Show EarlyModToolkit-2.0.9.zip
v2.0.8
214 Jul 27th 2023 at 11:55 PM Show EarlyModToolkit-2.0.8.zip
v2.0.7
235 Jul 24th 2023 at 4:23 AM Show EarlyModToolkit-2.0.7.zip
v2.0.6
239 Jul 21st 2023 at 11:46 PM Show EarlyModToolkit-2.0.6.zip
v2.0.5
158 Jul 21st 2023 at 8:27 PM Show EarlyModToolkit-2.0.5.zip
v2.0.4
173 Jul 21st 2023 at 8:15 PM Show EarlyModToolkit-2.0.4.zip
v2.0.3
181 Jul 21st 2023 at 8:15 AM Show EarlyModToolkit-2.0.3.zip
v2.0.2
213 Jul 19th 2023 at 9:35 PM Show EarlyModToolkit-2.0.2.zip
v2.0.1
170 Jul 19th 2023 at 12:20 PM Show EarlyModToolkit-2.0.1.zip
v2.0.0
177 Jul 19th 2023 at 11:57 AM Show EarlyModToolkit-2.0.0.zip

35 Comments (oldest first | newest first)

💬 AzuliBluespots, Nov 15th at 12:07 PM

Seems like this is crashing on the 1.20 pre versions. Sad

💬 DilanRona, Nov 10th at 9:25 AM

Shows 2 mods as disabled, no name shown. And selected. Any attempt to disable or remove results in a severe crash.

 

Also, when installing new mods, there is no option to prioritise specific Vintage Story versions. More and more of the latest mods are for the prerelease VS, and the mod page on EMTK does not always say what version for VS it is meant, resulting in a game crash when not paying attention.

 

Otherwise a great mod, and is the first one I install when doing a new install for VS

💬 Rivernoodl, Jul 24th at 10:14 PM

I went to launch the game using this mod, but it immediately crashes the game now before it starts.  I'm not sure what is causing it.

💬 AzuliBluespots, Mar 26th at 1:28 PM

I tried to run a certain mod to at least test it, it crashed my game. Sure, those things happen.

But now there's a ghost entry of it in the mod list, saying it couldn't be loaded. Even after deleting the file, it stays. How can I remove that? Where are the load orders saved?

Edit: SOMEHOW it made an empty folder on the vintagestoryData mods folder. That cleared it.

💬 MrRudi, Mar 18th at 5:17 PM

browse wont work for me, it shows 0 mods even if i have some on

💬 BlueSteelAU, Jan 22nd at 11:52 PM

things that are missing:

doesn't display "latest file for: <version>"

backup and restore profile (backs up mods that are in the profile so that after an update if anything goes wrong you have a backup that you can restore

config editor so you can edit the selected mod's config

needs to D/Load all the pictures in the mods description

showing the clickable links to the source files

 

💬 BlueSteelAU, Jan 22nd at 10:59 AM

all I can say is wow finally got it working. i see that there are some errors :( in the command window when i run it

this would be great if they could make all this part of the original game so that we could just run the main original vintage story

 

💬 mathgeniuszachAuthor, Jan 22nd at 3:12 AM

ATree it does! Any asset in the folders "lang", "textures", "sounds", and "music" will be preloaded and overwrite existing vanilla files. An important thing to note is that you must use the "game" namespace in order to replace these assets.

To make sure your mod is being loaded early, check for a line that looks like this in your log: "EMTK: Early External Origins in load order: ...", and make sure it's got your mod included. Also make sure that the mod is enabled, early mods are disabled by default because someone thought it was a security risk (despite the fact that there is no security risk, you are the one who puts mods in the mods folder after all, and loading into any world will cause problems anyway).

For an example of an early mod I was working on to change the title screen, see here:

https://github.com/mathgeniuszach/vintagemods/tree/main/Title%20Screen%20Tweak

💬 A_Tree, Jan 5th at 4:36 AM

Does this allow the editing of things like the gui backdrop texture, or the main menu music? I am trying to edit both but to no success. Tried turning them into an "earlymod" but still no luck.

💬 NatPro38, Oct 20th 2023 at 3:38 PM

No mods are loading in the mod browser. I get the following in the console window when launching EMTK:

EMTK: API request to get mods failed with error: System.NullReferenceException: Object reference not set to an instance of an object.
at EMTK.CustomModCellEntry..ctor() in /home/mgz/Documents/Code/git/vintagemods/Early Mod Toolkit 3/src/ModAPI.cs:line 311
at EMTK.ModAPI.GetMods(Int32 tries) in /home/mgz/Documents/Code/git/vintagemods/Early Mod Toolkit 3/src/ModAPI.cs:line 162

EMTK is allowed in my firewall and I am able to update mods.

OS: Win10 x64

💬 mathgeniuszachAuthor, Oct 7th 2023 at 1:58 AM

Kaofan EMTK is not a server mod, it's exclusively a client-side mod-wrapper. It uses the ingame GUI so it wouldn't make sense if it could run on a server.

Clients running on Linux use EMTK the same way Windows users do, except they use the Linux binary instead of the Windows one. If you want to ensure that EMTK can find the Vintagestory executable, put the EMTK binary and dll file in the same folder as the Vintagestory binary.

I recommend checking out Laerinok's ModsUpdater for the mod-updating functionality server-side.

💬 Kaofan, Sep 29th 2023 at 11:01 AM

mathgeniuszach

Any description of how to install this server mod on Linux?

💬 mathgeniuszachAuthor, Sep 4th 2023 at 3:15 AM

Zinloz EMTK 3.0.3 now honors the --dataPath cli argument, but as for extra mod paths, those will function the same way as the base game mod paths - they persist across profiles.

💬 mathgeniuszachAuthor, Sep 4th 2023 at 3:08 AM

Travisplo yes? Nearly every game with mod profiles does it this way. Or they store links to each mod and redownload them when swapping profiles/collections (Steam workshop games). Minecraft launchers do it this way, why should I do any different when the amount of potential space gain is questionable at best? There's no need to spend the time space-optimizing this as there's no real demand to do so, mods are small enough that a few copies of some mods is okay.

💬 Travisplo, Sep 4th 2023 at 2:02 AM

Is there meant to be multiple copies of each mod for each profile? That seems a bit messy.

💬 Zinloz, Aug 20th 2023 at 1:56 PM

Same question as Xandyr78. You can change the datapath by adding this to your VS shortcut:

--dataPath "D:\Vintage Story\Data"

And this for the mod path:

--addModPath "D:\Vintage Story\Data\Mods"

I'm not seeing a way to change this in EMTK. Can we get support for args on the launcher, please? Was hoping  .runtimeconfig would do it but no luck.

💬 mathgeniuszachAuthor, Aug 3rd 2023 at 9:21 PM

Xandyr78 the .NET7 build uses whatever "GamePaths.DataPath" is. If you somehow managed to redirect the main game from using that, then you would have redirected EMTK as well. Unless there's some method of redirection that occurs only in runtime that I don't know about.

💬 Ryuu, Aug 3rd 2023 at 6:46 PM

Works, thanks! Side note though: if you attempt to update the client while running EMT, it will say the vintagestory.exe is still running. Maybe make a note that the user will need to save the temp location the client update exe was downloaded to and then run said update exe while vintagestory.exe is not running so that an update to the client can be performed. Cannot remember if it does this outside of EMT but it does require these steps to be performed when running EMT.

💬 Xandyr78, Aug 3rd 2023 at 5:18 AM

I have my dataPath for VS redirect to a folder that isn't the default %appdata% directory...is there a way to adjust/install this so that it doesn't just dump a whole new datapath into my C: drive?

💬 mathgeniuszachAuthor, Aug 3rd 2023 at 2:50 AM

Ryuu Fixed in 3.0.1.

💬 Ryuu, Aug 2nd 2023 at 11:19 PM

I have properly used .net7 version and it runs the .net7 client; however, it's installing mods to the .net4 directory and not .net7 directory.

.net7 directory: %appdata%\VintagestoryDataNet7\
.net4 directory: %appdata%\VintagestoryData\

Please look into fixing this.

Using mod v3.0.0 and had to C&P zip contents to my Vintage Story .Net7 client which I had taken out of %appdata% and added it to c:\games\VintageStory  (both on the same drive) since it was not auto-detecting my install directory for the client.

Again, I can run the game but it's detecting the config files and installing mods in the .net4 directory instead of .net7 despite me having installed the .net7 version of EMT from the v3.0.0 zip file.

💬 mathgeniuszachAuthor, Jul 24th 2023 at 4:25 AM

WeedusFetus That'd be cool, but mods, their authors, or their users don't really provide that data anywhere. I'd have to train an AI or something to parse comments, but even that wouldn't be reliable enough.

💬 WeedusFetus, Jul 23rd 2023 at 11:57 AM

Is there any plan for a conflict feature in the future, to show us which mods might have issues with eachother?

💬 slartibartfast, Jul 21st 2023 at 2:58 PM

:-) It is working! Fantastic. Mostly. I confirm that updating, browsing, and installing new mods works well. (IMHO, the best part of the app)

Issues:

1) Crashes if you create a new profile when you have a large number if mods. (I think) Fixed in 2.0.6

2 ) There may be something funny with the parser in the browser. It seems to work well mostly, however if you select expanded foods 1.6.6 it will crash (Some unhandled charactor on that page in forum?
).

💬 mathgeniuszachAuthor, Jul 21st 2023 at 8:15 AM

slartibartfast Does 2.0.3 work for you? Someone came onto discord and helped me fix a potentially similar issue

💬 slartibartfast, Jul 19th 2023 at 11:52 PM

Yes, this is net4 VS. windows 11. Nvidia rtx 2060

I am sorry, I will just wait and keep trying with future updates.

💬 mathgeniuszachAuthor, Jul 19th 2023 at 10:19 PM

slartibartfast Only other thing I can say if you don't have any more info is the exe is .NET4 only, not .NET7. DanaCraluminum has helped to get it working on Windows, so I know it works there.

💬 slartibartfast, Jul 19th 2023 at 10:10 PM

Sadly I have the same issue with 2.0.2, I have even removed the mods from the roaming folder. VS 1.8.6 is installed C:\Program Files\Vintagestory\

the only data the log files generate is the same output in client-main.txt

There really isn't more info than that I can provide I don't think.

I place your app in the Vintagestory installed folder. from any other directory I get an unhandled exception that it can not find VintagestoryAPI

Sorry, I am not setup for discord. have to recall what I made for a password from years ago. But, if I got on there I don't think I could be of any more help.

💬 mathgeniuszachAuthor, Jul 19th 2023 at 10:06 PM
💬 slartibartfast, Jul 19th 2023 at 9:51 PM
💬 mathgeniuszachAuthor, Jul 19th 2023 at 9:35 PM

slartibartfast this issue is fixed now in 2.0.2.

💬 mathgeniuszachAuthor, Jul 19th 2023 at 8:40 PM

slartibartfast could you hop into the discord and provide more info about your problem?

💬 slartibartfast, Jul 19th 2023 at 5:11 PM

I would love to try this but I get...

C:\Program Files\Vintagestory>EarlyModToolkit-2.0.1.exe
EMTK: Pre-Querying ModDB in a separate thread!
EMTK: Patching for early mods!
EMTK: Patching complete!
EMTK: Awaiting EMTK update checker...
19.7.2023 13:09:34 [Client Notification] Client logger started.
19.7.2023 13:09:34 [Client Notification] Game Version: v1.18.6 (Stable)
19.7.2023 13:09:34 [Client Notification] Screens:
19.7.2023 13:09:34 [Client Notification] 0: {X=0,Y=0,Width=1536,Height=864}, \\.\DISPLAY1 (primary)
19.7.2023 13:09:35 [Client Notification] Exiting game now. Server running=False. Exit reason: Game crashed

💬 mathgeniuszachAuthor, Jul 19th 2023 at 12:21 PM

I immediately noticed an issue with the update checker that would prevent the launcher from working, fixed in 2.0.1

💬 WeedusFetus, Jul 19th 2023 at 12:18 PM

Looks amazing!! Testing now!! Was dumb and didnt read the .net7 part, cant wait for that, but will test on a different build later! Edit; did end up testing, works perfectly and immediately, great job!

(edit comment delete)