Rein-ILHookHelperAPI icon


Implements a functional-styled DSL for working with ILHooks inside C# syntax.

Last updated a month ago
Total downloads 205
Total rating 1 
Categories Libraries
Dependency string Rein-ILHookHelperAPI-1.0.1
Dependants 0 other mods depend on this mod


Figured I might as well release some of my tooling so others can benefit from it.


This is a library that adds a functional-style DSL for writing IL hooks.

Wtf is a DSL?

DSL = Domain Specific (programming) Language
In this case, its a fancy term for a set of functions that enable a specific style of programming within your C# code.

Wtf does functional-style mean?

Don't worry about it if you don't know.

All you really need to know is that this style makes your IL hooks much, much, much easier to read and write.

Example code

Simple value swap

static void MyILHook(ILContext il) => new ILCursor(il)
    .Goto(x => x.MatchLdcR4(2.65f))

Swap add for custom function

static void MyILHook(ILContext il) => new ILCursor(il)
    .Goto(x => x.MatchAdd())
    .OP_Call<Func<int,int,int>>((lhs, rhs) => lhs * rhs + 14);

Store value from one place, reuse it in another

static void MyILHook(ILContext il) => new ILCursor(il)
    .Goto(MoveType.After, x => x.MatchLdfld<Cheese>(nameof(Cheese.goodLevel)))
    .AddLocal<int>(out var index)
    .Goto(MoveType.After, x => x.MatchLdfld<NotCheese>(nameof(NotCheese.badLevel)))

Spam console with useless text to confuse users

private void MyILHook(ILContext il) => new ILCursor(il)


Initially I told myself I was releasing this to make life easier for some other people but then I spent 2 hours in paint making this horrible icon. Now I actually have no idea why I released this and am instead left with a profound feeling of self-doubt, confusion, and emptiness.



-Fixed nullability of a few cursor functions

Available versions

Please note that the install buttons only work if you have compatible client software installed, such as the Thunderstore Mod Manager. Otherwise use the zip download links instead.

Upload date Version number Downloads Download link  
2021-4-4 1.0.1 143 Version 1.0.1 Install
2021-4-1 1.0.0 62 Version 1.0.0 Install