This commit is contained in:
Brian Neumann-Fopiano committed 2026-06-13 22:03:58 -04:00
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)) {
@@ -22,7 +22,7 @@ import static org.mockito.Mockito.mockingDetails;
public class IrisRuntimeSchedulerModeRoutingTest {
@Test
public void autoResolvesToPaperLikeOnPurpurBranding() {
installServer("Purpur", "git-Purpur-2562 (MC: 1.21.11)");
installServer("Purpur", "git-Purpur-2562 (MC: 26.1.2)");
IrisSettings.IrisSettingsPregen pregen = new IrisSettings.IrisSettingsPregen();
pregen.runtimeSchedulerMode = IrisRuntimeSchedulerMode.AUTO;
@@ -32,7 +32,7 @@ public class IrisRuntimeSchedulerModeRoutingTest {
@Test
public void autoResolvesToFoliaWhenBrandingContainsFolia() {
installServer("Folia", "git-Folia-123 (MC: 1.21.11)");
installServer("Folia", "git-Folia-123 (MC: 26.1.2)");
IrisSettings.IrisSettingsPregen pregen = new IrisSettings.IrisSettingsPregen();
pregen.runtimeSchedulerMode = IrisRuntimeSchedulerMode.AUTO;
@@ -42,7 +42,7 @@ public class IrisRuntimeSchedulerModeRoutingTest {
@Test
public void autoResolvesToPaperLikeOnCanvasBranding() {
installServer("Canvas", "git-Canvas-101 (MC: 1.21.11)");
installServer("Canvas", "git-Canvas-101 (MC: 26.1.2)");
IrisSettings.IrisSettingsPregen pregen = new IrisSettings.IrisSettingsPregen();
pregen.runtimeSchedulerMode = IrisRuntimeSchedulerMode.AUTO;
@@ -52,7 +52,7 @@ public class IrisRuntimeSchedulerModeRoutingTest {
@Test
public void explicitModeBypassesAutoDetection() {
installServer("Purpur", "git-Purpur-2562 (MC: 1.21.11)");
installServer("Purpur", "git-Purpur-2562 (MC: 26.1.2)");
IrisSettings.IrisSettingsPregen pregen = new IrisSettings.IrisSettingsPregen();
pregen.runtimeSchedulerMode = IrisRuntimeSchedulerMode.FOLIA;
@@ -10,22 +10,22 @@ import static org.junit.Assert.assertTrue;
public class INMSBindingProbeCodesTest {
@Test
public void skipsSyntheticBukkitBindingWhenNmsIsEnabled() {
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("BUKKIT", false, List.of("v1_21_R7"));
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("BUKKIT", false, List.of("v26_1_R1"));
assertEquals(List.of("v1_21_R7"), probeCodes);
assertEquals(List.of("v26_1_R1"), probeCodes);
}
@Test
public void leavesBukkitFallbackEmptyWhenNmsIsDisabled() {
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("BUKKIT", true, List.of("v1_21_R7"));
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("BUKKIT", true, List.of("v26_1_R1"));
assertTrue(probeCodes.isEmpty());
}
@Test
public void keepsConcreteBindingCodesAsPrimaryProbe() {
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("v1_21_R7", false, List.of("v1_21_R7"));
List<String> probeCodes = NmsBindingProbeSupport.getBindingProbeCodes("v26_1_R1", false, List.of("v26_1_R1"));
assertEquals(List.of("v1_21_R7"), probeCodes);
assertEquals(List.of("v26_1_R1"), probeCodes);
}
}
@@ -18,26 +18,28 @@ public class MinecraftVersionTest {
@Test
public void detectsMinecraftVersionFromPurpurDecoratedVersion() {
Server server = mock(Server.class);
doReturn("git-Purpur-2570 (MC: 1.21.11)").when(server).getVersion();
doReturn("git-Purpur-2570 (MC: 26.1.2)").when(server).getVersion();
doReturn("26.1.2.build.2570-experimental").when(server).getBukkitVersion();
MinecraftVersion version = MinecraftVersion.detect(server);
assertEquals("1.21.11", version.value());
assertEquals(21, version.major());
assertEquals(11, version.minor());
assertEquals("26.1.2", version.value());
assertEquals(26, version.major());
assertEquals(1, version.minor());
assertEquals(2, version.patch());
}
@Test
public void prefersRuntimeMinecraftVersionMethodWhenPresent() {
PaperLikeServer server = mock(PaperLikeServer.class);
doReturn("1.21.11").when(server).getMinecraftVersion();
doReturn("26.1.2").when(server).getMinecraftVersion();
doReturn("26.1.2-2570-e64b1b2 (MC: 26.1.2)").when(server).getVersion();
doReturn("26.1.2.build.2570-experimental").when(server).getBukkitVersion();
MinecraftVersion version = MinecraftVersion.detect(server);
assertEquals("1.21.11", version.value());
assertEquals(21, version.major());
assertEquals(11, version.minor());
assertEquals("26.1.2", version.value());
assertEquals(26, version.major());
assertEquals(1, version.minor());
assertEquals(2, version.patch());
}
@Test
@@ -48,16 +50,18 @@ public class MinecraftVersionTest {
@Test
public void parsesStandardBukkitSnapshotVersion() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("1.21.11-R0.1-SNAPSHOT");
assertEquals("1.21.11", version.value());
assertEquals(21, version.major());
assertEquals(11, version.minor());
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.1.2-R0.1-SNAPSHOT");
assertEquals("26.1.2", version.value());
assertEquals(26, version.major());
assertEquals(1, version.minor());
assertEquals(2, version.patch());
}
@Test
public void comparesMajorBeforeMinor() {
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("1.20.12-R0.1-SNAPSHOT");
assertFalse(version.isAtLeast(21, 11));
assertTrue(version.isNewerThan(20, 11));
MinecraftVersion version = MinecraftVersion.fromBukkitVersion("26.1.2-R0.1-SNAPSHOT");
assertFalse(version.isAtLeast(26, 1, 3));
assertTrue(version.isAtLeast(26, 1, 2));
assertTrue(version.isSameRelease(26, 1, 2));
}
}
@@ -1,28 +1,28 @@
Paper 1.21.11
Paper 26.1.2
/iris create matrix-paper overworld
/iris std o overworld
close Studio world
benchmark create/unload
Purpur 1.21.11
Purpur 26.1.2
/iris create matrix-purpur overworld
/iris std o overworld
close Studio world
benchmark create/unload
Canvas 1.21.11
Canvas 26.1.2
/iris create matrix-canvas overworld
/iris std o overworld
close Studio world
benchmark create/unload
Folia 1.21.11
Folia 26.1.2
/iris create matrix-folia overworld
/iris std o overworld
close Studio world
benchmark create/unload
Spigot 1.21.11
Spigot 26.1.2
/iris create matrix-spigot overworld
/iris std o overworld
close Studio world