mirror of
https://github.com/HMCL-dev/HMCL.git
synced 2025-03-01 17:25:53 +08:00
Update READMD.md
This commit is contained in:
parent
d1a562452a
commit
0dd2e758e8
52
README.md
52
README.md
@ -5,16 +5,24 @@ GPL v3, see http://www.gnu.org/licenses/gpl.html
|
||||
|
||||
HMCL is a Minecraft launcher which supports Mod management, game customizing, auto installing(Forge, LiteLoader and OptiFine), modpack creating, UI customizing and so on.
|
||||
|
||||
## Downloads
|
||||
|
||||
Binary version can be found here: https://ci.huangyuhui.net/job/HMCL
|
||||
Archives in GitHub releases are built by closed CIs, uploaded here for backup.
|
||||
|
||||
## Contribution
|
||||
|
||||
If you want to submit a pull request, there're some requirements:
|
||||
* IDE: Intellij IDEA.
|
||||
* Compiler: Java 1.8.
|
||||
* Do NOT modify `gradle` files.
|
||||
|
||||
## HMCLCore
|
||||
|
||||
Now HMCLCore is independent and you can use HMCLCore as a library to launch your game.
|
||||
|
||||
### GameRepository
|
||||
|
||||
Create a game repository `repository` to manage a minecraft installation. Like this.
|
||||
```java
|
||||
DefaultGameRepository repository = new DefaultGameRepository(new File(".minecraft").getAbsoluteFile());
|
||||
@ -35,17 +43,23 @@ DefaultLauncher launcher = new DefaultLauncher(
|
||||
.logIn(), // account
|
||||
// or new AccountBuilder.Builder()
|
||||
// .setUsername("someone@xxx.com")
|
||||
// .setPassword("123")
|
||||
// .create(YggdrasilAccountFactory.INSTANCE)
|
||||
// .setPassword("someone's password")
|
||||
// // for Mojang account
|
||||
// .create(new YggdrasilAccountFactory(MojangYggdrasilProvider.INSTANCE))
|
||||
// // for Authlib Injector account
|
||||
// .create(new AuthlibInjectorAccountFactory(
|
||||
// new AuthlibInjectorDownloader(new File("path to save executables of authlib injector"),
|
||||
// () -> MojangYggdrasilProvider.INSTANCE)::getArtifactInfo,
|
||||
// () -> AuthlibInjectorServer.fetchServerInfo("Your authlib injector auth server")))
|
||||
// .logIn()
|
||||
new LaunchOptions.Builder()
|
||||
.setGameDir(repository.getBaseDirectory())
|
||||
.setGameDir(repository.getBaseDirectory()) // directory that the game saves settings to
|
||||
.setMaxMemory(...)
|
||||
.setJava(...)
|
||||
.setJavaArgs(...)
|
||||
.setMinecraftArgs(...)
|
||||
.setHeight(...)
|
||||
.setWidth(...)
|
||||
.setJava(...) // executable of JVM
|
||||
.setJavaArgs(...) // additional Java VM arguments
|
||||
.setMinecraftArgs(...) // additional Minecraft arguments
|
||||
.setHeight(...) // height of game window
|
||||
.setWidth(...) // width of game window
|
||||
...
|
||||
.create(),
|
||||
new ProcessListener() { // listening the process state.
|
||||
@ -68,23 +82,37 @@ If you want the command line, just call `launcher.getRawCommandLine`. Also, `Str
|
||||
### Downloading
|
||||
HMCLCore just owns a simple way to download a new game.
|
||||
```java
|
||||
DefaultDependencyManager dependency = new DefaultDependencyManager(repository, MojangDownloadProvider.INSTANCE, proxy);
|
||||
DefaultDependencyManager dependency = new DefaultDependencyManager(repository, new MojangDownloadProvider(), proxy);
|
||||
```
|
||||
`repository` is your `GameRepository`. `MojangDownloadProvider.INSTANCE` means that we download files from mojang servers. If you want BMCLAPI, `BMCLAPIDownloadProvider.INSTANCE` is just for you. `proxy` is `java.net.Proxy`, if you have a proxy, put it here, or `Proxy.NO_PROXY`.
|
||||
|
||||
Now `GameBuilder` can build a game.
|
||||
```
|
||||
```java
|
||||
Task gameBuildingTask = dependency.gameBuilder()
|
||||
.name("test")
|
||||
.gameVersion("1.12") // Minecraft version
|
||||
.version("forge", "14.21.1.2426") // Forge version
|
||||
.version("liteloader", "1.12-SNAPSHOT-4") // LiteLoader version
|
||||
.version("optifine", "HD_U_C4") // OptiFine version
|
||||
.buildAsync()
|
||||
.buildAsync();
|
||||
```
|
||||
|
||||
Nowadays HMCLCore only supports Forge, LiteLoader and OptiFine auto-installing.
|
||||
`buildAsync` will return a `Task`, you can call `Task.executor()::start` or simply `Task::start` to start this task. If you want to monitor the execution of tasks, you should see `TaskExecutor` and `Task::executor`.
|
||||
|
||||
### Modpack installing
|
||||
|
||||
HMCLCore supports Curse, MultiMC modpack.
|
||||
|
||||
```java
|
||||
// Installing curse modpack
|
||||
new CurseInstallTask(dependency, modpackZipFile, CurseManifest.readCurseForgeModpackManifest(modpackZipFile), "name of the new game");
|
||||
|
||||
// Installing MultiMC modpack
|
||||
new MultiMCModpackInstallTask(dependency, modpackZipFile, MultiMCInstanceConfiguration.readMultiMCModpackManifest(modpackZipFile), "name of the new game");
|
||||
// ** IMPORTANT **: You should read game settings from MultiMCInstanceConfiguration
|
||||
```
|
||||
|
||||
## HMCL
|
||||
JavaFX version of HMCL does not support old APIs.
|
||||
|
||||
No plugin API.
|
Loading…
Reference in New Issue
Block a user