mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-10-27 14:30:14 +00:00
d
This commit is contained in:
1 parent
ad6732812e
commit
b0a5d97e9c
15 files changed
+64
-1871
No files matched your search
@@ -28,13 +28,10 @@ import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
public class INMS {
|
||||
private static final Version CURRENT = Boolean.getBoolean("iris.no-version-limit") ?
|
||||
new Version(Integer.MAX_VALUE, Integer.MAX_VALUE, null) :
|
||||
new Version(26, 1, null);
|
||||
private static final Version CURRENT = new Version(26, 1, 2, "v26_1_R1");
|
||||
|
||||
private static final List<Version> REVISION = List.of(
|
||||
new Version(26, 1, "v26_1_R1"),
|
||||
new Version(21, 11, "v1_21_R7")
|
||||
CURRENT
|
||||
);
|
||||
|
||||
//@done
|
||||
@@ -88,7 +85,7 @@ public class INMS {
|
||||
|
||||
MinecraftVersion detectedVersion = getMinecraftVersion();
|
||||
String serverVersion = detectedVersion == null ? Bukkit.getServer().getVersion() : detectedVersion.value();
|
||||
throw new IllegalStateException("Iris requires Minecraft 1.21.11 or newer. Detected server version: " + serverVersion);
|
||||
throw new IllegalStateException("Iris requires Minecraft 26.1.2. Detected server version: " + serverVersion);
|
||||
}
|
||||
|
||||
private static String getTag(List<Version> versions, String def) {
|
||||
@@ -97,12 +94,8 @@ public class INMS {
|
||||
return def;
|
||||
}
|
||||
|
||||
if (detectedVersion.isNewerThan(CURRENT.major, CURRENT.minor)) {
|
||||
return versions.getFirst().tag;
|
||||
}
|
||||
|
||||
for (Version p : versions) {
|
||||
if (!detectedVersion.isAtLeast(p.major, p.minor)) {
|
||||
if (!detectedVersion.isSameRelease(p.major, p.minor, p.patch)) {
|
||||
continue;
|
||||
}
|
||||
return p.tag;
|
||||
@@ -155,5 +148,5 @@ public class INMS {
|
||||
return codes;
|
||||
}
|
||||
|
||||
private record Version(int major, int minor, String tag) {}
|
||||
private record Version(int major, int minor, int patch, String tag) {}
|
||||
}
|
||||
@@ -187,7 +187,7 @@ public interface INMSBinding {
|
||||
Color getBiomeColor(Location location, BiomeColor type);
|
||||
|
||||
default DataVersion getDataVersion() {
|
||||
return DataVersion.V1_19_2;
|
||||
return DataVersion.V26_1_2;
|
||||
}
|
||||
|
||||
default int getSpawnChunkCount(World world) {
|
||||
|
||||
@@ -12,11 +12,13 @@ final class MinecraftVersion {
|
||||
private final String value;
|
||||
private final int major;
|
||||
private final int minor;
|
||||
private final int patch;
|
||||
|
||||
private MinecraftVersion(String value, int major, int minor) {
|
||||
private MinecraftVersion(String value, int major, int minor, int patch) {
|
||||
this.value = value;
|
||||
this.major = major;
|
||||
this.minor = minor;
|
||||
this.patch = patch;
|
||||
}
|
||||
|
||||
public static MinecraftVersion detect(Server server) {
|
||||
@@ -92,12 +94,13 @@ final class MinecraftVersion {
|
||||
if ("1".equals(parts[0])) {
|
||||
int major = Integer.parseInt(parts[1]);
|
||||
int minor = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
|
||||
return new MinecraftVersion(input, major, minor);
|
||||
return new MinecraftVersion(input, major, minor, 0);
|
||||
}
|
||||
|
||||
int major = Integer.parseInt(parts[0]);
|
||||
int minor = Integer.parseInt(parts[1]);
|
||||
return new MinecraftVersion(input, major, minor);
|
||||
int patch = parts.length > 2 ? Integer.parseInt(parts[2]) : 0;
|
||||
return new MinecraftVersion(input, major, minor, patch);
|
||||
} catch (NumberFormatException ignored) {
|
||||
return null;
|
||||
}
|
||||
@@ -115,10 +118,28 @@ final class MinecraftVersion {
|
||||
return minor;
|
||||
}
|
||||
|
||||
public int patch() {
|
||||
return patch;
|
||||
}
|
||||
|
||||
public boolean isAtLeast(int major, int minor) {
|
||||
return this.major > major || (this.major == major && this.minor >= minor);
|
||||
}
|
||||
|
||||
public boolean isAtLeast(int major, int minor, int patch) {
|
||||
if (this.major != major) {
|
||||
return this.major > major;
|
||||
}
|
||||
if (this.minor != minor) {
|
||||
return this.minor > minor;
|
||||
}
|
||||
return this.patch >= patch;
|
||||
}
|
||||
|
||||
public boolean isSameRelease(int major, int minor, int patch) {
|
||||
return this.major == major && this.minor == minor && this.patch == patch;
|
||||
}
|
||||
|
||||
public boolean isNewerThan(int major, int minor) {
|
||||
return this.major > major || (this.major == major && this.minor > minor);
|
||||
}
|
||||
|
||||
@@ -2,9 +2,6 @@ package art.arcane.iris.core.nms.datapack;
|
||||
|
||||
import art.arcane.iris.spi.IrisLogging;
|
||||
import art.arcane.iris.core.nms.INMS;
|
||||
import art.arcane.iris.core.nms.datapack.v1192.DataFixerV1192;
|
||||
import art.arcane.iris.core.nms.datapack.v1206.DataFixerV1206;
|
||||
import art.arcane.iris.core.nms.datapack.v1213.DataFixerV1213;
|
||||
import art.arcane.iris.core.nms.datapack.v1217.DataFixerV1217;
|
||||
import art.arcane.volmlib.util.collection.KMap;
|
||||
import lombok.AccessLevel;
|
||||
@@ -16,10 +13,6 @@ import java.util.function.Supplier;
|
||||
@Getter
|
||||
public enum DataVersion {
|
||||
UNSUPPORTED("0.0.0", 0, () -> null),
|
||||
V1_19_2("1.19.2", 10, DataFixerV1192::new),
|
||||
V1_20_5("1.20.6", 41, DataFixerV1206::new),
|
||||
V1_21_3("1.21.3", 57, DataFixerV1213::new),
|
||||
V1_21_11("1.21.11", 75, DataFixerV1217::new),
|
||||
V26_1_2("26.1.2", 101, DataFixerV1217::new);
|
||||
private static final KMap<DataVersion, IDataFixer> cache = new KMap<>();
|
||||
@Getter(AccessLevel.NONE)
|
||||
|
||||
@@ -94,7 +94,7 @@ public final class Tasks {
|
||||
} else if (parts.length >= 2) {
|
||||
supportedVersions = parts[1];
|
||||
} else {
|
||||
supportedVersions = "1.21.11";
|
||||
supportedVersions = "26.1.2";
|
||||
}
|
||||
|
||||
if (!(INMS.get() instanceof NMSBinding1X)) {
|
||||
|
||||
Reference in new issue
Block a user