9
0
mirror of https://github.com/Samsuik/Sakura.git synced 2025-12-27 18:59:06 +00:00

fix creating a mechanics target without the minor version

This commit is contained in:
Samsuik
2025-10-25 17:58:03 +01:00
parent 7abe0b920b
commit aee37d8f76

View File

@@ -96,12 +96,14 @@ public record MinecraftMechanicsTarget(short mechanicVersion, byte serverType) {
default -> 0;
};
} else {
// 21.1 -> 1.21.1
// 21.1 -> 1.21.1, 1.18 -> 1.18.0, 2.3 -> 1.2.3
final int first = Integer.parseInt(version[0]);
final int second = Integer.parseInt(version[1]);
if (version.length == 3) {
final int third = Integer.parseInt(version[2]);
mechanicVersion = MinecraftVersionEncoding.encode(first, second, third);
} else if (first == 1) {
mechanicVersion = MinecraftVersionEncoding.v1xy(second, 0);
} else {
mechanicVersion = MinecraftVersionEncoding.v1xy(first, second);
}