CmlLib
English (v4)
English (v4)
  • 🧊CmlLib Projects
  • 🚀CmlLib.Core
    • Home
    • Getting Started
      • Minecraft Launcher
      • Minecraft Path
      • Versions
      • Launch Options
      • Event Handling
    • Login and Sessions
      • Microsoft Xbox Account
      • Offline Account
    • More APIs
      • MinecraftLauncherParameters
      • Rules
      • FileExtractor
      • GameInstaller
      • Java
    • Mod Loader Installers
      • Forge Installer
      • Fabric Installer
      • Quilt Installer
      • LiteLoader Installer
    • Utilities
      • Minecraft Changelogs
    • Resources
      • FAQ
      • Known Issues
      • Sample Launcher
      • License
  • 🔓Auth.Microsoft
    • Home
    • CmlLib.Core.Auth.Microsoft
      • JELoginHandler
      • JELoginHandlerBuilder
      • JEAuthenticator
      • Authentication with MSAL
    • XboxAuthNet.Game
      • OAuth
      • XboxAuth
      • XboxAuthException
      • AccountManager
      • Accounts
    • XboxAuthNet.Game.Msal
      • ClientID
      • MsalClientHelper
      • OAuth
    • CmlLib.Core.Bedrock.Auth
    • Resources
  • 🌐MojangAPI
    • Home
    • Mojang API
    • SecurityQuestion
  • ⚒️Installer.Forge
    • Home
    • Supported Versions
    • Getting Started
    • MForge
    • ForgeVersionLoader
Powered by GitBook
On this page
  • Get game outputs (logs)
  • Launch custom game client
  • log4j2 vulnerability (CVE-2021-44228)
Edit on GitHub
  1. CmlLib.Core
  2. Resources

FAQ

PreviousResourcesNextKnown Issues

Last updated 9 months ago

Get game outputs (logs)

You can read standard output of game process. As CreateProcess method returns Process instance, you can use all APIs of Process. ()

process.StartInfo.CreateNoWindow = false;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardError = true;
process.StartInfo.RedirectStandardOutput = true;
process.EnableRaisingEvents = true;
process.ErrorDataReceived += (s, e) => Console.WriteLine(e.Data);
process.OutputDataReceived += (s, e) => Console.WriteLine(e.Data);

process.Start();
process.BeginErrorReadLine();
process.BeginOutputReadLine();

Above code write all game outputs to console. You can check game logs in console.

Launch custom game client

You need two file: <version_name>.jar, <version_name>.json. Put these files into <game_directory>/versions/<version_name> directory.

Example)

<game_directory>
 | - versions
 |    | - myversion
 |    |    | - myversion.jar
 |    |    | - myversion.json

Make sure that version directory name, jar file name, json file name, and id property in version json file is all same.

If you copy version json file from vanilla version json file, you should remove downloads property in version json file to prevent launcher overwrites your custom version jar file with vanilla version file.

(Example for 1.12.2.json)

1.12.2.json <-> 1.12.2-modified.json

 | {
 |     "assetIndex": {
 |         "id": "1.12",
 |         "sha1": "1584b57c1a0b5e593fad1f5b8f78536ca640547b",
 |         "size": 143138,
 |         "totalSize": 129336389,
 |         "url": "https://launchermeta.mojang.com/v1/packages/1584b57c1a0b5e593fad1f5b8f78536ca640547b/1.12.json"
 |     },
 |     "assets": "1.12",
 |     "complianceLevel": 0,
-|      "downloads": {            <===== REMOVE this property
-|         "client": {
-|             "sha1": "0f275bc1547d01fa5f56ba34bdc87d981ee12daf",
-|             "size": 10180113,
-|             "url": "https://launcher.mojang.com/v1/objects/0f275bc1547d01fa5f56ba34bdc87d981ee12daf/client.jar"
-|         },
-|         "server": {
-|             "sha1": "886945bfb2b978778c3a0288fd7fab09d315b25f",
-|             "size": 30222121,
-|             "url": "https://launcher.mojang.com/v1/objects/886945bfb2b978778c3a0288fd7fab09d315b25f/server.jar"
-|         }
-|    },
*|     "id": "1.12.2-modified", <== make sure id is same as version name
 |     "javaVersion": {
 |         "component": "jre-legacy",
 |         "majorVersion": 8
 |     },

All version which Mojang launcher can launch also can be launched by CmlLib.Core. Make sure that your custom version works well in Mojang launcher before using CmlLib.Core. CmlLib.Core wouldn't able to launch your version if Mojang launcher can't.

Minecraft launched by CmlLib 0.0.1 ~ CmlLib.Core 3.3.3 may have log4j2 vulnerability. It is safe after CmlLib.Core 3.3.4 version.

🚀
reference
log4j2 vulnerability (CVE-2021-44228)