A minimal client implementation for Minecraft 1.19.4 (protocol version 762).
Features:
- Authenticated server login
- Server list pings
- Offline mode servers
- Packet encryption and compression
- Lightweight (no dependencies)
Requires:
- Java 11+
Maven
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependency>
<groupId>com.github.OfficialDonut</groupId>
<artifactId>MinimalMinecraftClient</artifactId>
<version>Tag</version>
</dependency>
Gradle
allprojects {
repositories {
...
maven { url 'https://jitpack.io' }
}
}
dependencies {
implementation 'com.github.OfficialDonut:MinimalMinecraftClient:Tag'
}
See full examples in src/test.
Account account = ...
Client client = new Client();
InboundPacket packet = client.login(account, "localhost", 25565);
if (packet.getPacketID() == 2) { // login sucess packet
while (true) {
packet = client.receive();
switch (packet.getPacketID()) {
case 0x23: // keep alive
long id = packet.readLong();
OutboundPacket keepAlivePacket = new OutboundPacket(0x12);
keepAlivePacket.writeLong(id);
client.send(keepAlivePacket);
break;
case 0x19: // disconnect
System.out.println("Disconnected: " + packet.readString());
return;
}
}
}
Client client = new Client();
InboundPacket packet = client.ping("localhost", 25565);
if (packet.getPacketID() == 0) { // status response
System.out.println("Status: " + packet.readString());
}
This project is licensed under the MIT License.