• Stars
    star
    144
  • Rank 250,478 (Top 6 %)
  • Language
    Java
  • License
    MIT License
  • Created about 9 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A powerful open-source library for launching and downloading Minecraft.

JMCCC

Maven Central Gitter

A powerful open-source library for launching and downloading Minecraft.

License

JMCCC is licensed under the MIT license.

Features

  • Launches all versions of Minecraft
  • Scalable authentication
    • Supports Microsoft Account/Mojang Account/Offline, and can be extended
  • Downloads all versions of Minecraft
    • Supports Forge/Liteloader/Fabric/Quilt
      • Supports Liteloader snapshots
      • Supports Fabric/Quilt in Minecraft snapshots
    • Customizable download source
    • Asynchronous task system
    • Supports BIO/NIO
    • Supports caching
      • Can work on top of Ehcache or javax.cache
      • Different strategies for different files
  • Mojang API supports
    • Game profiles lookup
    • Fetches/Uploads textures
    • Fetches account information
    • Fetches name history
    • Blocked servers checking

Quick Start

Dependencies

Dependency Description
dev.3-3:jmccc Minecraft launching feature.
dev.3-3:jmccc-mcdownloader Minecraft downloading feature.
dev.3-3:jmccc-microsoft-authenticator Microsoft Account authentication feature.
dev.3-3:jmccc-mojang-api Mojang API client.
dev.3-3:jmccc-yggdrasil-authenticator Mojang Account authentication feature.

JMCCC RELEASE version has been uploaded to MAVEN CENTRAL:

https://repo1.maven.org/maven2/

If you do need the snapshot repository:

https://s01.oss.sonatype.org/content/repositories/snapshots/

Launching Minecraft

MinecraftDirectory dir = new MinecraftDirectory("/home/user/.minecraft");
Launcher launcher = LauncherBuilder.buildDefault();
launcher.launch(new LaunchOption("1.19.3", MicrosoftAuthenticator.login(it -> System.out.println(it.message)), dir));

You can use Microsoft Account with MicrosoftAuthenticator.login(it -> System.out.println(it.message)), also you can use YggdrasilAuthenticator.password("<email>", "<password>") with Mojang Account or new OfflineAuthenticator("<username>") if you want to use offline authentication.

Downloading Minecraft

MinecraftDirectory dir = new MinecraftDirectory("/home/user/.minecraft");
MinecraftDownloader downloader = MinecraftDownloaderBuilder.buildDefault();
downloader.downloadIncrementally(dir, "1.19.3", new CallbackAdapter<Version>() {
	
	@Override
	public void failed(Throwable e) {
		// when the task fails
	}
	
	@Override
	public void done(Version result) {
		// when the task finishes
	}
	
	@Override
	public void cancelled() {
		// when the task cancels
	}
	
	@Override
	public <R> DownloadCallback<R> taskStart(DownloadTask<R> task) {
		// when a new sub download task starts
		// return a DownloadCallback to listen the status of the task
		return new CallbackAdapter<R>() {

			@Override
			public void done(R result) {
				// when the sub download task finishes
			}

			@Override
			public void failed(Throwable e) {
				// when the sub download task fails
			}

			@Override
			public void cancelled() {
				// when the sub download task cancels
			}

			@Override
			public void updateProgress(long done, long total) {
				// when the progress of the sub download task has updated
			}

			@Override
			public void retry(Throwable e, int current, int max) {
				// when the sub download task fails, and the downloader decides to retry the task
				// in this case, failed() won't be called
			}
		};
	}
});

You can pass a null callback if you don't want to monitor the whole task. You can also return null in taskStart() if you don't want to monitor sub tasks.

Don't forget to shutdown the downloader when you are no longer going to use it.

downloader.shutdown();

Downloading Forge/Liteloader/Fabric/Quilt

MinecraftDirectory dir = new MinecraftDirectory("/home/user/.minecraft");
ForgeDownloadProvider forgeProvider = new ForgeDownloadProvider();
LiteloaderDownloadProvider liteloaderProvider = new LiteloaderDownloadProvider();
MinecraftDownloader downloader = MinecraftDownloaderBuilder.create()
	.providerChain(DownloadProviderChain.create()
		.addProvider(forgeProvider)
		.addProvider(liteloaderProvider))
	.build();

downloader.downloadIncrementally(dir, "1.19.3-forge-44.1.7", new CallbackAdapter<Version>() {...});
downloader.downloadIncrementally(dir, "1.12.2-LiteLoader1.12.2", new CallbackAdapter<Version>() {...});
downloader.downloadIncrementally(dir, "fabric-loader-0.14.13-1.19.3", new CallbackAdapter<Version>() {...});
downloader.downloadIncrementally(dir, "quilt-loader-0.17.11-1.19.3", new CallbackAdapter<Version>() {...});
downloader.download(forgeProvider.forgeVersionList(), new CallbackAdapter<ForgeVersionList>() {...});
downloader.download(liteloaderProvider.liteloaderVersionList(), new CallbackAdapter<LiteloaderVersionList>() {...});

FML options

JMCCC won't add fml options (such as -Dfml.ignoreInvalidMinecraftCertificates=true and -Dfml.ignorePatchDiscrepancies=true) to the command line automatically. If you have problems launching forge, you may need to add these arguments manually. These arguments are already defined in class ExtraArgumentsTemplates.

option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_INVALID_MINECRAFT_CERTIFICATES);
option.extraJvmArguments().add(ExtraArgumentsTemplates.FML_IGNORE_PATCH_DISCREPANCISE);

More Repositories

1

MCCustomSkinLoader

Customize Skin, Cape and Elytra in Minecraft 1.8-1.20.2
Java
481
star
2

CoreModTutor

Minecraft 1.3.2-1.15.2 Vanilla and FML CoreMod Development Tutorial.
156
star
3

CustomSkinLoaderAPI

Docs and extensions for CustomSkinLoader.
Java
26
star
4

MoreCrashInfo

Display more info in crash report.
Java
13
star
5

sekai-calculator

Project SEKAI Calculator for deck power, live score, event point and more.
TypeScript
8
star
6

SekaiMusicMeta

Music Meta Generator for Project Sekai
TypeScript
6
star
7

SekaiMusicChart

Project SEKAI music chart generator
Python
6
star
8

FtpServer

A simple implement of FTP server in C++.
C++
5
star
9

OfflineTweaker

A mod to make WLAN server offline.
Java
5
star
10

SekaiEventPredictor

Event predictor for game Project SEKAI.
TypeScript
5
star
11

RiftTweakLoader

A loader for Rift to load TweakMod
Java
4
star
12

TinyProjects

Some Tiny Projects for practise
C
4
star
13

SekaiDataAnalyse

Data analysing for game Project SEKAI.
TypeScript
4
star
14

CustomSkinServer

Server plugin for minecraft to transport skins.
Java
3
star
15

33KitFrontend

React Frontend for 33Kit
TypeScript
3
star
16

sirius-master

3
star
17

SekaiDataViewer

Viewer for Project Sekai Data.
TypeScript
3
star
18

DigitalLogicCourseWork

Course Work Backup for Digital Logic
Verilog
2
star
19

xfl03.github.io

HTML
2
star
20

TencentMapDemo

Demo for Tencent Map
HTML
2
star
21

AAdebtBackend

Kotlin Spring Boot Backend for AAdebt
Kotlin
2
star
22

xfl03

Config files for my GitHub profile.
2
star
23

YetAnotherHarvest

A Minecraft Bukkit and Spigot plugin to harvest and replant crops by right click.
Java
2
star
24

sirius-calculator

World Dai Star Calculator.
TypeScript
2
star
25

BattleFlightServer

Server For BattleFlight (A HTML5 Game)
Java
1
star
26

QuestionReg

Question is a minecraft server plugin
Java
1
star
27

JmcccGradle

Launch Minecraft Client with JMCCC in Gradle PLugin.
Kotlin
1
star
28

ThaumicWaila

Waila addon for Thaumcraft.
Java
1
star
29

AAdebtFrontend

Vue CLI Frontend for AAdebt
Vue
1
star
30

SimpleCalculator

Simple Calculator in Kotlin
Kotlin
1
star
31

ASMCourseWork

Course Work Backup for Assembly
Assembly
1
star
32

VanillaGradleExample

An simple example for Minecraft Sponge Vanilla Gradle plugin.
Kotlin
1
star
33

33KitBackend

Kotlin Spring Boot Backend for 33 Kit.
Kotlin
1
star