How to make minecraft launcher
How to make minecraft launcher
[Гайд] [C#] Рисуем себе пиратский лаунчер [1.5.2 и раньше]
В этом гайде я постораюсь максимально понятно рассказать о создании самого простого пиратского лаунчера, объясняя подробно все части кода.
Тестируем:
Запускаем отладку:
Появляется окошко, как в визуальном редакторе (я его сделал таким):
Вводим в текстовое поле ваш ник и тапаем на кнопку(текст вы можете настроить в «Окне свойств»)
В сингле проверим, с каким ником у нас запустилась игра:
Часто задаваемые вопросы:
Q: Как открыть окно свойств?
A: «Вид»-«Другие окна»-«Окно свойств»
Q: Как поменять текст окна/кнопки?
A: Выделите в визуальном редакторе элемент, текст которого вы хотите заменить, в Окне свойств в строке «Text» меняете текст
Q: Почему на других компьютерах не работает программа?
A: Возможно у них не установлена версия Framework, на которой вы писали приложение(по умолчанию используется самая последняя установленная)
How To Make Your Own Minecraft Launcher
Click “add” near servers you want to add to the launcher and then click Next
(Optional) On this page, you can change the launcher theme
On this page, you can change your launcher name, the folder for game instances on players PCs, and the allocated RAM for Minecraft.
After this click «Install»
To upload files to your game client (for example mods, resource packs, etc), click Manage client files.
Go to the folder “mods”
Click the “upload” button
Click select and select mods you want to add
Как сделать свой лаунчер для Minecraft и запустить на своем сервере игру?
Админы, владеющие собственными серверами Minecraft, часто сталкиваются с проблемой сборки стабильного лаунчера, который позволит быстро и беспрепятственно скачивать обновления, моды, скины. В рамках данной статьи мы расскажем, как сделать свой лаунчер игры Майкрафт.
Что понадобится для создания лаунчера?
Как известно, лаунчер представляет собой программный интерфейс, облегчающий подключение геймеров к серверу игры. Эти приложения автоматически скачивают необходимые файлы и софт.
Для создания качественного лаунчера для сервера потребуется:
Кроме того, лаунчер должен иметь систему авторизации. Инструкцию о том, как ее добавить, найдете ниже.
Подготовка исходников
Создание лаунчера для сервера
Видео: Как сделать свой лаунчер.
При желании устанавливать моды на сервер рекомендуется проделать следующие манипуляции:
Как добавить возможность авторизации?
Это позволит игрокам автоматически заходить на сервер без ввода логина и пароля.
Дальнейшие манипуляции с кодом можно производить по собственному усмотрению. При этом важно знать значения всех строк, поскольку нежелательные изменения могут привести к отказу лаунчера.
CmlLib/MinecraftLauncherLibrary
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
Csharp Minecraft Launcher Library
USE CmlLib.Core
This library will not be developed anymore.
This library is minecraft launcher library for C#.
Support all version, with Forge
Only for Windows (use pml if you want crossplatform)
Email : ksi123456ab@naver.com
Discord : ksi123456ab#3719
This library doesn’t support crossplatform. Only Windows
if you want Cross-Platform Minecraft Launcher Library,
use this python library.
pml github
If you want to learn more features of this library such as to download java runtime or launch with more detailed options, go to wiki
Sample Launcher (CmlLibSample)
Download CmlLibSample.zip file, unzip file and execute CmlLibSample.exe
Required dll : Newtonsoft.Json.dll, DotNetZip.dll, CmlLib.dll
Build CmlLibSample (Sample launcher)
Enter the source code in the order shown below.
1. Prepare
Install Nuget Package ‘CustomMinecraftLauncher’
or download dll files in Release tab (CmlLib.dll, Newtonsoft.Json.dll, DotNetZip.dll) and add reference
write this on the top of your source code:
2. Minecraft Initialize
You should write this code before work.
It set Game Directory that is used to download game files, load profiles, save login session, Launch, etc.
You can’t use relative path.
3. Login
The ‘session’ is login result. note : you can’t use old login using username instead of mojang email.
or you can use offline session :
4. Get Profile Infos
Profile contain various data which launcher need. All Game Versions has its own profile, even old alpha version and forge. You can find it at (GameDirectory)₩versions₩(any-version)₩(version-name).json. MProfileInfo is metadata of profile, containing Name, Profile Path(Url), Type(Release, Snapshot, Old), ReleaseTime. and this code get profile info :
It will return all metadata from mojang web server and your game directory.
but you can choose source :
5. Choose ProfileInfo and Parse
In order to use profile data, you should parse profile.
This simple code will search version from metadatas, and return parsed profile data.
6. Check & Download Game Files
and the handler methods of ChangeFile and ChangeProgress event is :
DownloadAll() method check the existence of game file, and download game file from mojang server if file is not exist or not valid(compare hash).
7. Make game args and Launch
set launch options, and launch it!
8. More Information
launch forge : You don’t need any additional work to launch forge
bugs : go to issue tab
About
Pierce01/MinecraftLauncher-core
Use Git or checkout with SVN using the web URL.
Work fast with our official CLI. Learn more.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
This project is complete for now.
MCLC (Minecraft Launcher Core) is a NodeJS solution for launching modded and vanilla Minecraft without having to download and format everything yourself. Basically a core for your Electron or script based launchers.
Since people seem to use this, I’ve created a Discord server for anyone who needs to get in contact with me or get help!
npm i minecraft-launcher-core
Function | Type | Description |
---|---|---|
launch | Promise | Launches the client with the specified options as a parameter. Returns child the process |
IF YOU’RE NEW TO MCLC, LET IT HANDLE EVERYTHING! DO NOT USE OVERRIDES!
If you are loading up a client outside of vanilla Minecraft or Forge (Optifine and for an example), you’ll need to download the needed files yourself if you don’t provide downloads url downloads like Forge and Fabric. If no version jar is specified, MCLC will default back to the normal MC jar so mods like Fabric work.
This runs an executable with specified launch arguments. Was used to support Forge 1.13 before ForgeWrapper.
MCLC’s authenticator module does not support Microsoft authentication. You will need to use a library like MSMC. If you weant to create your own solution, the following is the authorization JSON object format.
Parameter | Type | Description | Required |
---|---|---|---|
username | String | Email or username | True |
password | String | Password for the Mojang account being used if online mode. | False |
client_token | String | Client token that will be used. If one is not specified, one will be generated | False |
Parameter | Type | Description | Required |
---|---|---|---|
access_token | String | Token being checked if it can be used to login with (online mode). | True |
client_token | String | Client token being checked to see if there was a change of client (online mode). | True |
Parameter | Type | Description | Required |
---|---|---|---|
access_token | String | Token being checked if it can be used to login with (online mode). | True |
client_token | String | Token being checked if it’s the same client that the access_token was created from. | True |
Parameter | Type | Description | Required |
---|---|---|---|
access_token | String | Token being checked if it can be used to login with (online mode). | True |
client_token | String | Token being checked if it’s the same client that the access_token was created from. | True |
Parameter | Type | Description | Required |
---|---|---|---|
username | String | Username used to login with | True |
password | String | Password used to login with | True |
Parameter | Type | Description | Required |
---|---|---|---|
url | String | New URL that MCLC will make calls to authenticate the login. | True |
Event Name | Type | Description |
---|---|---|
arguments | Object | Emitted when launch arguments are set for the Minecraft Jar. |
data | String | Emitted when information is returned from the Minecraft Process |
close | Integer | Code number that is returned by the Minecraft Process |
package-extract | null | Emitted when clientPackage finishes being extracted |
download | String | Emitted when a file successfully downloads |
download-status | Object | Emitted when data is received while downloading |
debug | String | Emitted when functions occur, made to help debug if errors occur |
progress | Object | Emitted when files are being downloaded in order. (Assets, Forge, Natives, Classes) |
What should it look like running from console?
The pid is printed in console after the process is launched.
These are the people that helped out that aren’t listed here!
About
Lightweight module that downloads and runs Minecraft using javascript / NodeJS