cmllib / cmllib.core Goto Github PK
View Code? Open in Web Editor NEW.NET Minecraft Launcher Library. All Version, Auth, Forge, Java, Crossplatform
License: MIT License
.NET Minecraft Launcher Library. All Version, Auth, Forge, Java, Crossplatform
License: MIT License
I tried to install FabricMC using CMLauncher and FabricVersionLoader.
But an error appears when executing this piece of code:
launcher.GetVersion("fabric-loader-0.11.6-1.16.5")
Full code:
if (!Directory.Exists(path))
{
Directory.CreateDirectory(path);
}
var launcher = new CMLauncher(path);
System.Net.ServicePointManager.DefaultConnectionLimit = 256;
FabricVersionLoader fabric = new FabricVersionLoader();
launcher.VersionLoader = fabric;
launcher.FileChanged += FileChanged;
fabric.LoaderVersion = "0.11.6";
MVersion ver = new MVersion("");
ver = launcher.GetVersion("fabric-loader-0.11.6-1.16.5");
(await launcher.CreateProcessAsync(ver, new MLaunchOption
{
Session = new MLogin().Authenticate("","").Session,
MaximumRamMb = 1024
})).Start();
I have my own authorization system, when I log in, I get a UUID, Username, Access Token.
How do I fit them into the launch?
Reading the documentation, I didn't understand anything, I'm a noob in c#.
if you have a version of Minecraft for example 1.16
as a local version.
getting the versions via
var infos = MLauncher.UpdateVersions();
foreach (var item in infos)
{
if (item.MType == MVersionType.Release)
MC_Versions.Items.Add(item.Name);
}
will result in 1.16 to not show up in the list...
I don't expect that this is the expected behavior and its kind of annoying.
Unexpected EOF (ICSharpZip) exception when using the method CmLauncher.CreateProcess, may be cause while extracting natives from JAR file (I have my specific JAR file)
Bug was fixed when downgrading to 3.3.1
It would be nice if you would implement a feature that can load all available versions of minecraft into an array. So the users always have the newest versions of minecraft available to choose.
How can I display the output of minecraft (like logs, etc) in the console window and prevent it from closing?
Is it possible to link progressBar to launch game process?
var launcher = new CMLauncher(path());
var launchOption = new MLaunchOption
{
MaximumRamMb = memory,
Session = session,
};
var process = launcher.CreateProcess("1.7.10", "10.13.4.1614-1.7.10", launchOption);
process.Start();
I'm trying to hide the launcher when the game starts and open it after the game closes, after closing the game the function process.Exited doesn't work.
var process = await launcher.CreateProcessAsync(startVersion, launchOption); process.Start(); this.Hide(); process.Exited += (s1, e1) => { this.Show(); };
Describe the bug
If you login using microsoft, autologin doesn't relogin to a microsoft account.
Logs
No logs.
Environment
Additional context
I don't know.
Hi and sorry for bother again.
I trying to install forge 1.16.1 like this way:
var process = launcher.CreateProcess("1.16.1", "32.0.39", launchOption);
but i got this issue:
ignore the config[]
, they are my launcher configs
When using with 1.12.2 version it downloads and open fine!!
1.16.1 forge version: http://files.minecraftforge.net/maven/net/minecraftforge/forge/index_1.16.1.html
If I have a Minecraft .JAR file and .JSON file located at 2 different urls, I was wondering if I could run it using a method. I've tried downloading it, storing it to a folder but I don't know how I would run it.
Describe the solution you'd like
I would want like a way to run it using CmlLib as this would be really useful for Auto Updaters as then they could get their jar file from a link and immediately run it.
Describe alternatives you've considered
I couldnt think of any alternative.
Additional context
I'm trying to make a launcher for a Minecraft PvP Client, I have a link to the JAR file and JSON file but I dont know how to run it.
Please Add In Microsoft Login And Update The Win Forms To Newest As Had Issues With Username's Having Spaces In
Hello there,
How do I start the game without internet? (I logged in to the crack) when I do with these codes, I get an error if I don't have internet.
and I have another problem,
I am getting Java Virtual Machine error on 1.15+ versions. However, such an error does not occur when I use Minecraft Launcher. Could the Java version being used not support it?
(Translated)
Hey is it possible for you to make it possible to be able to use this structure:
.
I know I can set a path for the client data (for example to the 1.12.2 Vanilla dir) but can you add possibility to set custom libraries location like we can do for assets?
Is your feature request related to a problem? Please describe.
no
Describe the solution you'd like
I would love to be able to change the client brand, because some plugins can get your client brand and it would be pretty nice if i could set the brand to something like "Cml Client":
Describe alternatives you've considered
modifying the version to display a client brand you want
Additional context
none
can't launch forge 1.17.1 in 3.3.2
I can launch vanilla versions with no problems, but when I tried Optifine/fabric game crashes with this:
Backend API: ERROR NoClassDefFoundError: Could not initialize class org.lwjgl.glfw.GLFW
Any clue?
Launching with Optifine broken in v3.3.3
[13:16:18] [main/INFO]: Loading tweak class name optifine.OptiFineTweaker
[13:16:18] [main/INFO]: Using primary tweak class name optifine.OptiFineTweaker
[13:16:18] [main/INFO]: Calling tweak class optifine.OptiFineTweaker
OptiFineTweaker: acceptOptions
OptiFineTweaker: injectIntoClassLoader
OptiFine ClassTransformer
OptiFine ZIP file: D:\AppData\Roaming.meloncher\minecraft\libraries\optifine\Optifine\1.12.2_HD_U_G6_pre1\Optifine-1.12.2_HD_U_G6_pre1.jar
OptiFineTweaker: getLaunchArguments
OptiFineTweaker: getLaunchTarget
[13:16:18] [main/ERROR]: Unable to launch
java.lang.ClassNotFoundException: net.minecraft.client.main.Main
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:186) ~[launchwrapper-of-2.2.jar:2.2]
at java.lang.ClassLoader.loadClass(ClassLoader.java:424) ~[?:1.8.0_51]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:1.8.0_51]
at java.lang.Class.forName0(Native Method) ~[?:1.8.0_51]
at java.lang.Class.forName(Class.java:348) ~[?:1.8.0_51]
at net.minecraft.launchwrapper.Launch.launch(Launch.java:155) [launchwrapper-of-2.2.jar:2.2]
at net.minecraft.launchwrapper.Launch.main(Launch.java:30) [launchwrapper-of-2.2.jar:2.2]
Caused by: java.lang.NullPointerException
at net.minecraft.launchwrapper.LaunchClassLoader.findClass(LaunchClassLoader.java:177) ~[launchwrapper-of-2.2.jar:2.2]
... 6 more
var process = await launcher.CreateProcessAsync("1.19-forge1.19-41.1.0", launchOption);
I got exception
System.Collections.Generic.KeyNotFoundException: "Cannot find 1.19-forge1.19-41.1.0"
I don't understand how to download this version
How to specify user's private key and public key for Chat Signing? Is this process automatically or do I have to add some code? And how to disable multiplayer for banned users? Is this process also automatically or do I have to add some code for this? Please answer me so my launcher can comply with Minecraft's current rules, thank you.
Hello! I am writing a Minecraft launcher in Unity. I have to make an additional socket server to run minecraft. This is a very big "crutch" in the program. Could you please make unity support for CmlLib.Core library?
Changelog has 1.15.2 as it's latest version, but the newest version is 1.16.5
how java 15
CmlLib.Core may not launch version that is not downloaded from mojang launcher or official installer.
ex) CmlLib cannot launch forge downloaded from TLauncher.
Dears, Developers!
My issue is about minecraft launching other launcher example forge. I want to run FabricMC but is not supportable around CmlLib module.
Describe the bug
If .minecraft folder is empty, I get the error on first run:
Could not find a part of the path 'C:\\Users\\USER\\AppData\\Roaming\\.minecraft\\libraries\\net\\minecraftforge\\installertools\\1.2.10\\installertools-1.2.10.jar'.
On second run after .minecraft folder exists and has some related folders and files, I get:
Cannot start process because a file name has not been provided.
I think I tracked this down to being the javaw.exe not being found initially through the JavaChecker class, or there is something wrong with acquiring the forge .jar file. Maybe it is related to the installertools jar?
Logs
Stack Trace for second error:
at System.Diagnostics.Process.Start() at CmlLib.Utils.ProcessUtil.StartWithEvents() at CmlLib.Core.Installer.MForge.startJava(String[] classpath, String mainclass, String[] args) at CmlLib.Core.Installer.MForge.startProcessor(JToken processor, Dictionary mapData) at CmlLib.Core.Installer.MForge.process(JArray processors, Dictionary mapData) at CmlLib.Core.Installer.MForge.InstallForge(String mcversion, String forgeversion) at CmlLib.Core.CMLauncher.CheckForge(String mcversion, String forgeversion, String java) at CmlLib.Core.CMLauncher.CreateProcess(String mcversion, String forgeversion, MLaunchOption option) at .......... (local code)"
This one is resolved by manually providing the Java path, but the game will not open.
Environment (please complete the following information):
Additional context
This is how I have been generating my Process:
Process process = launcher.CreateProcess("1.18", "38.0.10", launchOption);
First error seems it is not downloading all binaries correctly, but that doesn't seem to stop it on the second run.
Seems as if the algorithm may be having trouble detecting the Java installation, but even when supplied with the direct file path, the game does not open.
This library was working for me earlier this year on version 3.1.1
, all I had changed was the version of the game and forge that is passed to the launcher.CreateProcess method.
The game loads up fine if I omit the Forge version and launch a Vanilla instance.
EDIT:
Installing Forge manually and using either CreateProcess
or the updated CreateProcessAsync
method launches Forge successfully, but won't correctly download and install if it does not already exist, even if the flag for checking and downloading is passed as true just in case.
https://www.fembed.com/v/177n0ybj7qrjp865
I showed the error in the link
Is your feature request related to a problem? Please describe.
I've always wanted to see why my minecraft crashes, or see the logs in real-time.
Describe the solution you'd like
See the game logs in real-time and see them when the game crashes/closes,
and also detect when the game crashes/starts
Everytime i try reach process to download Forge 1.7.10-10.13.4.1614 it gives exception
My process var:
var proccess = launcher.CreateProcess("1.7.10", "10.13.4.1614", launchOptions);
Given exception:
System.Net.WebException HResult=0x80131509 Message=The remote server returned an error: (404) Not Found. Source=System StackTrace: at System.Net.HttpWebRequest.GetResponse() at CmlLib.Core.Downloader.MForge.getInstallerStream(String mcversion, String forgeversion) at CmlLib.Core.Downloader.MForge.InstallForge(String mcversion, String forgeversion) at CmlLib.Core.CMLauncher.CheckForge(String mcversion, String forgeversion, String java) at CmlLib.Core.CMLauncher.CreateProcess(String mcversion, String forgeversion, MLaunchOption option) at TestMCLauncher.Form1.buttonPlay_Click(Object sender, EventArgs e) in C:\Users\RehabCZ\Desktop\TestMCLauncher\TestMCLauncher\Form1.cs:line 51 at System.Windows.Forms.Control.OnClick(EventArgs e) at System.Windows.Forms.Button.OnClick(EventArgs e) at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent) at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks) at System.Windows.Forms.Control.WndProc(Message& m) at System.Windows.Forms.ButtonBase.WndProc(Message& m) at System.Windows.Forms.Button.WndProc(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m) at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m) at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam) at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg) at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData) at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context) at System.Windows.Forms.Application.Run(Form mainForm) at TestMCLauncher.Program.Main() in C:\Users\RehabCZ\Desktop\TestMCLauncher\TestMCLauncher\Program.cs:line 19
Currently, MJava cannot install new java version, which is necessary for new versions like 1.17-pre.
We need new java runtime installer
When am starting the minecraft (pressing button) am have error :
System.ArgumentException: 'Invalid Session'
This exception was originally thrown at this call stack:
[External Code]
mctest.Program.button1_Click(object, System.EventArgs) in Program.cs
in line of code: var process = await launcher.CreateProcessAsync("1.8.9", launchOption);
[FIX:
Uninstall all of your Nuget Packages
Reinstall them
Try the launcher
]
Hi there, I've been using CmlLib to create a custom Minecraft Launcher.
I've got everything setup with the UI and the Session Handling but my version wont launch.
This info may help (maybe idk):
Net Framework 4.7.2 (i dont know if im meant to use a different version possibly?)
Project Download (full source and stuff): https://easyupload.io/tcyths [new link]
CmlLib Version: 3.3.1 (Installed from NuGet)
IDE: Visual Studio 2019 (dont think that would matter)
Project Type: Windows Forms
OS: Windows 11
CPU: Intel Core i7-471OMQ @ 2.50Ghz
RAM: 16GB
GPU: Intel HD Graphics 4600 / NVIDIA GTX 860M
In the output when I try to press play, it seems to be doing everything fine but no window shows up.
I also get these in the output:
The thread 0x13f4 has exited with code 0 (0x0).
The thread 0x4380 has exited with code 0 (0x0).
The thread 0x4614 has exited with code 0 (0x0).
The thread 0x42b0 has exited with code 0 (0x0).
The thread 0x984 has exited with code 0 (0x0).
The thread 0x4938 has exited with code 0 (0x0).
The thread 0x2cdc has exited with code 0 (0x0).
The thread 0xeb8 has exited with code 0 (0x0).
The thread 0x28ec has exited with code 0 (0x0).
The thread 0x3a38 has exited with code 0 (0x0).
They kind of seem weird.
I'm hoping that helps resolve this problem!
Describe the bug
A new exploit has been found in minecraft's log4j library, it allows exploiters to execute arbitrary code on other people's computers by sending a pre-made message in the chat.
I would like to see this bug being fixed immidiately (if possible), because the official minecraft launcher seems to have patched it.
Hi,
I am updating from CML to this, and already installed the version 2.0.2, but theres some different results.
new Minecraft(path)
dont return a path string but returns itself, not what your examples says;CMLaunch()
, only MLaunch()
;And some other things...
Can you check whats wrong?
Thanks!!
Hey! I'm making a launcher for modpacks and forge.
I'm adding a combo-box to the menu, and I get all versions with the following code:
foreach (var item in launcher.GetAllVersions())
{
version.Items.Add(item);
}
But, when I go the the GUI, everything starts with "local". I started to replace everything and convert the selection to a string. CMLLib throws an error that says "can't find 'local [versiongohere]", "can't find '[versiongohere]", or "can't find 'release [versiongohere]". Any help?
I have the launcher attached, if you do want to see if anything happened.
In my opinion, it would be nice to get the changelogs of every Minecraft version.
When am pressing the button am getting this error
System.ArgumentException: 'Invalid Session'
code : var process = await launcher.CreateProcessAsync("1.8.9", launchOption);
Describe the bug
When using the following code in version 3.3.5 of CmlLib.Core it throws an exception saying that "fabric-loader-0.13.3-1.16.5" is not found.
string fabricName = "fabric-loader-0.13.3-1.16.5";
// Handle fabric missing
var fabricVersionLoader = new FabricVersionLoader();
var fabricVersions = await fabricVersionLoader.GetVersionMetadatasAsync();
// Install fabric
if (versions.All(x => x.Name != fabricName))
{
try
{
var fabric = fabricVersions.GetVersionMetadata(fabricName); // Throws error (can't find it)
await fabric.SaveAsync(path);
// Update version list
await launcher.GetAllVersionsAsync();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
Environment.Exit(1);
}
}
Environment (please complete the following information):
Additional context
Occurs for other versions of fabric such as the example in the sample code.
I've created a directory for my game path and I've installed the latest version of Fabric into that directory (using the installer). However, when I type in the Fabric version ("fabric-loader-0.10.8-1.16.4") it doesn't launch and says it doesn't exist. This is the file structure in the game path:
versions
mods
I am a little confused here, so help would be appreciated.
I'm trying to make my own launcher with my OWN Parental Control feature, and I'm looking on how to disable multiplayer MANUALLY when launching Minecraft (if parent choose to disable it for their child). Is it possible? Because this is help many parents who don't want their child to play multiplayer on Minecraft, but still want their child to play multiplayer on other games. Because when they change their child's Xbox Account Settings, it will disable multiplayer in MOST Xbox Games.
Hello,
How can I make a mod pack launcher like the ftb launcher that has multiple mod packs in the same folder?
Thx for the answer
Error in https://github.com/CmlLib/CmlLib.Core/wiki/Common-Errors#could-not-create-java-virtual-machine
You write
"In a 32 bit OS Environment, you can't set MaximumRam(XMX) higher than 1024"
But it's
For 32-bit Windows: it'll be <2GB (Windows internals book says 2GB for user processes)
For 32-bit BSD / Linux: <3GB (from the Devil Book)
For 32-bit MacOS X: <4GB (from Mac OS X internals book)
(Source: https://stackoverflow.com/a/7019624)
Logs
?
Environment (please complete the following information):
(Sorry for my bad english)
how?
I'm not native english speeker,
and I'm not good at english.
so there might be many strange english sentences in this repo. (especially README, wiki, source code comments)
if you find any strange sentences, feel free to tell me
comment in this issue, make pull request, make new issue or anything
thanks you
How to install Fabric(like MForge)?
Hey,
I would want to download a .jar from a website and then directly launch Minecraft and use it as a version.
I don't want to keep it in a folder and just launch it instantly.
Can I do that? If not, can you add a feature or a code sample to do that?
Thanks
More easier way to sort and filter version metadatas.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.