Beginner needs help with porting a mod 1.0 -> B18

Started by bionicjoethehat, June 04, 2019, 11:15:49 AM

Previous topic - Next topic

Mehni

Good job. One addition to the source I saw on GitHub:

When you're adding Labels, you should use the ILGenerator shared through Harmony. Adding your own labels might cause your code to jump to unexpected places. With Harmony's ILGenerator, labels are in their proper place even with multiple patches.

Your method signature would then be
static IEnumerable<CodeInstruction> Transpiler (IEnumerable<CodeInstruction> instructions, ILGenerator generator)
rather than
static IEnumerable<CodeInstruction> Transpiler (IEnumerable<CodeInstruction> instructions)

How you name the ILGenerator parameter has no influence, according to Harmony's wiki.

bionicjoethehat

Thanks for your suggestion!

The label is now added properly.