Skip to content

Commit

Permalink
Support for Minecraft version 1.19.1/1.19.2
Browse files Browse the repository at this point in the history
  • Loading branch information
akemin-dayo authored Sep 27, 2022
1 parent f004857 commit d860842
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 6 deletions.
16 changes: 11 additions & 5 deletions src/main/java/game/data/registries/RegistryLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -115,13 +115,19 @@ private void getReportsFromServerJar() throws IOException, InterruptedException
String serverUrl = VersionManifestHandler.findServerUrl(version);

/*
* Since newer Minecraft versions use Java 1.16, we can't generate reports if the user is still using an older
* version of Java. To maintain support for older Java versions, this check is only done at this stage.
* Since newer Minecraft versions use Java 17 (1.18+) or Java 16 (1.17.x), we can't generate reports if the user is using
* an incompatible version of Java. To maintain support for older Java versions, this check is only done at this stage.
*/
if (Config.versionReporter().isAtLeast1_17() && getJavaVersion() < 16) {
System.err.println("Cannot run Minecraft version 1.17+ with a Java version below 16. You are currently using Java version " + getJavaVersion() + ".");
if (Config.versionReporter().isAtLeast1_18() && getJavaVersion() < 17) {
System.err.println("Cannot run Minecraft version 1.18+ with a Java version below 17. You are currently using Java version " + getJavaVersion() + ".");
System.err.println("Please consider upgrading your Java version to at least version 17.\n");
System.err.println("If you have already installed a compatible version of Java and are still seeing this message, please ensure that your JAVA_HOME environment variable is set correctly.\n");
throw new UnsupportedMinecraftVersionException("Minecraft version 1.18+ is not supported for Java version " + getJavaVersion());
} else if (Config.versionReporter().isAtLeast1_17() && getJavaVersion() < 16) {
System.err.println("Cannot run Minecraft version 1.17.x with a Java version below 16. You are currently using Java version " + getJavaVersion() + ".");
System.err.println("Please consider upgrading your Java version to at least version 16.\n");
throw new UnsupportedMinecraftVersionException("Minecraft version 1.17 is not supported for java version " + getJavaVersion());
System.err.println("If you have already installed a compatible version of Java and are still seeing this message, please ensure that your JAVA_HOME environment variable is set correctly.\n");
throw new UnsupportedMinecraftVersionException("Minecraft version 1.17.x is not supported for Java version " + getJavaVersion());
}

downloadServerJar(serverUrl);
Expand Down
40 changes: 39 additions & 1 deletion src/main/resources/protocol-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,44 @@
"0x30": "UseItemOn",
"0x31": "UseItem"
}
}
},
"760": {
"version": "1.19.1",
"dataVersion": 3117,
"clientBound": {
"0x00": "AddEntity",
"0x02": "AddPlayer",
"0x07": "BlockEntityData",
"0x09": "BlockUpdate",
"0x10": "ContainerClose",
"0x11": "ContainerSetContent",
"0x1c": "ForgetLevelChunk",
"0x21": "LevelChunkWithLight",
"0x24": "LightUpdate",
"0x25": "Login",
"0x26": "MapItemData",
"0x28": "MoveEntityPos",
"0x29": "MoveEntityPosRot",
"0x2d": "OpenScreen",
"0x3b": "RemoveEntities",
"0x3e": "Respawn",
"0x40": "SectionBlocksUpdate",
"0x50": "SetEntityData",
"0x53": "SetEquipment",
"0x62": "SystemChat",
"0x66": "TeleportEntity"
},
"serverBound": {
"0x0c": "ContainerClose",
"0x10": "Interact",
"0x14": "MovePlayerPos",
"0x15": "MovePlayerPosRot",
"0x16": "MovePlayerRot",
"0x18": "MoveVehicle",
"0x29": "SetCommandBlock",
"0x31": "UseItemOn",
"0x32": "UseItem"
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ void bestMatch() {
versions.put(757, "1.18");
versions.put(758, "1.18");
versions.put(759, "1.19");
versions.put(760, "1.19.1");

versions.forEach((k, v) -> {
assertThat(pvh.getProtocolByProtocolVersion(k).getVersion()).isEqualTo(v);
Expand Down

0 comments on commit d860842

Please sign in to comment.