Source-checkedLibraries & compatibility

ModConfigEnforcer

by Pfhoenix · for Valheim

Mod Config Enforcer is a utility mod for mod authors. It allows them to support servers setting configs and then enforcing those settings onto connecting clients using their mod.

8.4KDownloads
11 mo agoLast updated
BepInExLoaders
ThunderstoreSource

About ModConfigEnforcer

From Thunderstore

Mod Config Enforcer is a utility mod for mod authors. It allows them to support servers setting configs and then enforcing those settings onto connecting clients using their mod.

UPDATE: Version 4.0 involves enough changes to completely deprecate previous versions. Any mods relying on versions 2.X will no long be supported and will have to update themselves. MCE will now conflict with the Better Networking mod, due to both mods making changes to Valheim's networking subsystem. You can disable MCE's networking optimizations via its new config file. MCE now removes buffer limits for Steam users, making Better Networking unnecessary when using mods that also use MCE. This change was necessary to support the sending of large data packages in an optimized way.

UPDATE: Version 3.0 is a major version change due to breaking backwards compatibility. If you are a user, do not update MCE unless a mod you are using that uses it tells you to. This change is a lot less painful than the version 2 break, and the biggest benefit is the ability for mod authors to now take advantage of MCE syncing their configs without having a hard dependency on MCE. This means for playing by yourself, MCE isn't required to have. Mod authors can now, with a little code, have their mods be "MCE Compatible" with no required downloading or bundling.

Mod Config Enforcer is a utility mod for mod authors. It allows them to support servers setting configs and then enforcing those settings onto connecting clients using their mod. The mod allows mod authors to define config variables that can be local only (no server enforcement) as well as server enforced.

Manual Installation : Download and copy the ModConfigEnforcer.dll to your Valheim\Bepinex\plugins folder.

If you are downloading MCE because another mod relies on it for server config enforcement, you're done! When setup correctly, you will see two new DLL files created in the plugins folder, ZstdNet.dll and libzstd.dll. These files are necessary for MCE to compress and decompress ZPackage data for optimal performance.


Hard dependency usage is still supported as it's the best way to do more complex configuration management with MCE, but it is no longer the only option. MCE v3 now supports config-by-convention, which is very easy to setup and ideal for smaller mods which simply use ConfigEntry objects for their Bepinex config. For a mod to be MCE compatible with automated config discovery, simply follow this example :

public class Plugin : BaseUnityPlugin
{
   // this field is required to exist and be set to an object in order for MCE to process your mod
   object AutomatedConfigDiscovery;
   // this field will be discovered and picked up by MCE
   public ConfigEntry<int> Something;
   // this field will be discovered and picked up by MCE, with the value expected to be a full path to a file you want servers to sync to clients
   public string File_TestFile = "C:\Steam\steamapps\common\Valheim\BepInEx\plugins\testfile.txt";
   // this field will be ignored by MCE and thus not synced from servers to clients
   [NonSerialized]
   public ConfigEntry<bool> OtherVar;
    
   public Awake()
   {
      // setting this here in Awake is required in order to guarantee MCE's automated config discovery finding your mod properly
      AutomatedConfigDiscovery = this;
      // all ConfigEntry fields you want MCE to discover must be bound before Awake ends for your mod
      Something = Config.Bind("Section", "Something", 0, "Description");
      OtherVar = Config.Bind("Section", "Other Var", true, "A config setting that will be ignored by MCE due to the [NonSerialized] attribute on it");
   }
    
   // these are entirely optional. If you don't have them, your mod simply won't get a callback for when these events happen
   void ServerConfigReceived() {}
   void ConfigReloaded() {}

   // if file syncing is desired, this method is required to exist
   void FileChanged() {}
}

If your Plugin class (name isn't required to be "Plugin", just that it extends BaseUnityPlugin, which is required for your mod to work with Valheim anyways), doesn't contain a field named "AutomatedConfigDiscovery" (spelling matters but not capitalization), MCE will not process your mod for automated config discovery. You can set the variable to any object instance you want. The object referenced by the variable will be what MCE scans for ConfigEntries and the callback methods for your mod. Any ConfigEntry fields with the NonSerialized attribute (as demonstrated above) will be ignored by MCE's automated config discovery.

An alternate example is as follows :

public class Plugin : BaseUnityPlugin
{
   // this field is required to exist and be set to an object in order for MCE to process your mod
   public object AutomatedConfigDiscovery;
   public WhateverYouWantToCallThis ConfigStuff = new WhateverYouWantToCallThis();
    
   public Awake()
   {
      // setting this here in Awake is required in order to guarantee MCE's automated config discovery finding your mod properly
      AutomatedConfigDiscovery = ConfigStuff;
      // all ConfigEntry fields you want MCE to discover must be bound before Awake ends for your mod
      Something = Config.Bind("Section", "Something", 0, "Description");
      OtherVar = Config.Bind("Section", "Other Var", true, "A config setting that will be ignored by MCE due to the [NonSerialized] attribute on it");
   }
}
    
public class WhateverYouWantToCallThis
{
   // this field will be discovered and picked up by MCE
   public ConfigEntry<int> Something;
   // this field will be ignored by MCE and thus not synced from servers to clients
   [NonSerialized]
   public ConfigEntry<bool> OtherVar;
    
   // these are entirely optional. If you don't have them, your mod simply won't get a callback for when these events happen.
   void ServerConfigReceived() {}
   void ConfigReloaded() {}
}

For manual mod registration and usage, the following still applies :

Read the full description on Thunderstore →

Highlights

From source data

Loaders

Runs on BepInEx.

Footprint

Rated a light load on a server.

Last update

Its author last shipped an update 11 mo ago.

ModConfigEnforcer on Nxeon

From our catalogue
One-click install
Supported on Nxeon Valheim servers, for BepInEx servers. We download it from Thunderstore, place it, and restart the server.
Server type needed
BepInEx
Server load
light
Smallest plan we suggest
Valheim — 4 GB (4 GB RAM). This follows our own load rating above, not a benchmark.
Latest build
4.0.4, released 2025-11-15

Game versions by loader

LoaderGame versionsNewest
BepInEx

From 6 recorded builds of ModConfigEnforcer.

Recent builds

BuildReleasedGame versionsLoaders
4.0.42025-11-15n/aBepInEx
4.0.12023-05-06n/aBepInEx
4.0.02023-05-05n/aBepInEx
3.0.32023-04-06n/aBepInEx
3.0.22023-04-06n/aBepInEx
3.0.12023-03-12n/aBepInEx

Dependencies

Declared by the newest build that lists any. Required ones are installed with it on one-click installs.

Run ModConfigEnforcer on a Valheim server

Pick a server or deploy a new one above; it is installed in one click.

What kind of mod it is

From the catalog
Listed on Thunderstore as “Core”

Libraries & compatibility

Foundations and fixes other mods build on. Usually installed because something else needs it.

Compatibility

Game
Valheim
Loaders
BepInEx
Requires
One-click install needs a BepInEx server.

Verified at the source

  • ✓ThunderstoreOfficial listing, checked 2026-10-02Open ↗
  • ✓AuthorPfhoenix, as published on Thunderstore
  • ✓LicenseNot published by the sourceFree

ModConfigEnforcer, answered

Generated from the mod’s own source data.

Which loaders does it support?

BepInEx.

Is it free?

Yes. ModConfigEnforcer is free to download from Thunderstore.

How do I add it to my Nxeon server?

Use “Add to a server” on this page, or open NxLabs from your dashboard. We install it, restart your server and switch it on.

NxLabs

Run ModConfigEnforcer on a Valheim server.

Deploy in about a minute from $9.99 a month, then add ModConfigEnforcer in one click.