Modding:Monkey patching

From Vintage Story Wiki

This page was last verified for Vintage Story version 1.15.

Monkey Patching


Monkey patching (changing code at runtime) in Vintage Story is available through Harmony. With Harmony you can change methods, constructors and properties. Documentation on harmony is available here..

Getting started

To use Harmony in you Vintage Story mod you first have to reference the 0harmony.dll in the Vintage Story lib directory (VintageStory\Lib\0Harmony.dll).

Then you have to create a Harmony-instance by calling the constructor with you a unique identifier, preferrably you modid (this let's harmoy differentiate between different patches and allows other people to patch your patches).

var harmony = new Harmony("MyModId");

Now you are all set to patch everything inside the game like described in the documentation.


  • Just because you can use monkey patching, does not mean you should. Patches are often fragile and break easily (especially if you access internal private methods). So if you can use normal means of modding you probably should.
  • You can't use harmony to patch fields (because they are not called), so in order to change field access you have to patch all calls to this field with patches.

Green Items require C# coding

Getting Started | Mod Types | Simple Examples | Theme Pack

Asset System | Textures | Items | Recipes | Blocks | Entities | Model Creator | Animation Basics | VTML & Icons | Mod Packaging & Release | Modinfo | Debugging


JSON Patching | Advanced JSON Items | The Remapper | Server-Client Considerations | Compatibility with other mods

Setting Up Your Development Environment (General - Windows - Linux)

Advanced Blocks | Advanced Items | Item-Block Interactions | Block Behavior | Block Entities | Particle Effects | World Access | Inventory Handling | Chat Commands | GUIs | Server-Client Networking | Monkey patching (Harmony)

Data Management

Savegame Data Storage | ModConfig File | Chunk Data Storage | Tree Attribute


WorldGen Concepts | Terrain | Ores | Trees | WorldGen API


Shaders and Renderers

Property Overview

Item | Entity | Block | Block Behaviors | Block Classes | Block Entities | Block Entity Behaviors

Workflows & Infrastructure

Modding Efficiency Tips | Mod-engine compatibility | Mod Extensibility | Load Order

Additional Resources

List of server commands | List of client commands | Client startup parameters | Creative Starter Guide | ServerBlockTicking | Bot System | WorldEdit | Cinematic Camera

Example Mods | API Docs | GitHub Repository