public static IEnumerable <CodeInstruction> Free_Transpiler(IEnumerable <CodeInstruction> instructions) { CodeMatcher matcher = new CodeMatcher(instructions) .MatchForward(true, new CodeMatch(OpCodes.Ldarg_0), new CodeMatch(i => i.opcode == OpCodes.Call && ((MethodInfo)i.operand).Name == "get_controller"), new CodeMatch(OpCodes.Ldnull), new CodeMatch(i => i.opcode == OpCodes.Call && ((MethodInfo)i.operand).Name == "op_Inequality"), new CodeMatch(OpCodes.Brfalse) ); if (matcher.IsInvalid) { NebulaModel.Logger.Log.Error("Player.Free_Transpiler failed. Mod version not compatible with game version."); return(instructions); } object jumpOperand = matcher.InstructionAt(4).operand; return(matcher .SetOperandAndAdvance(jumpOperand) .InstructionEnumeration()); }