Targeted NeoForge 26.3.0.83

- NeoForge builds compile against NeoForge 26.3.0.83
- The NeoForge mod requires NeoForge 26.3.0.65-beta or newer, the first build without the cached world array
- NeoForge server access test covers publishing, removing and restoring runtime levels against the live level map
- README platform table and bug template name the current NeoForge target
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-15 09:21:10 -04:00
1 parent 0ca33068f3
commit 12f30596e5
7 files changed
+91 -6

No files matched your search

+1 -1
View File
@@ -58,7 +58,7 @@ Properties rootProperties = new Properties()
file('../../gradle.properties').withInputStream { InputStream stream -> rootProperties.load(stream) }
String irisVersion = providers.gradleProperty('irisVersion').getOrElse(rootProperties.getProperty('irisVersion', '4.3.3'))
String minecraftVersion = providers.gradleProperty('minecraftVersion').getOrElse(rootProperties.getProperty('minecraftVersion', '26.3'))
String neoForgeVersion = providers.gradleProperty('neoForgeVersion').getOrElse(rootProperties.getProperty('neoForgeVersion', '26.3.0.33-beta'))
String neoForgeVersion = providers.gradleProperty('neoForgeVersion').getOrElse(rootProperties.getProperty('neoForgeVersion', '26.3.0.83'))
Closure<String> irisArtifactName = { String platform, String targetVersion ->
return "Iris v${project.version} [${platform}] ${targetVersion}.jar"
}
@@ -25,7 +25,7 @@ logoFile = "assets/irisworldgen/icon.png"
[[dependencies.irisworldgen]]
modId = "neoforge"
type = "required"
versionRange = "[26.3,26.4)"
versionRange = "[26.3.0.65-beta,26.4)"
ordering = "NONE"
side = "BOTH"
@@ -0,0 +1,85 @@
package art.arcane.volmlib.nativelib.minecraft26_2.neoforge;
import art.arcane.volmlib.nativelib.minecraft26_2.modded.ModdedServerAccess;
import art.arcane.volmlib.nativelib.minecraft26_2.modded.ModdedServerLevels;
import art.arcane.volmlib.nativelib.modded.NativeLoaderOptions;
import net.minecraft.SharedConstants;
import net.minecraft.core.registries.Registries;
import net.minecraft.resources.Identifier;
import net.minecraft.resources.ResourceKey;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.MinecraftServer;
import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.Level;
import org.junit.After;
import org.junit.BeforeClass;
import org.junit.Test;
import java.lang.reflect.Field;
import java.util.LinkedHashMap;
import java.util.function.BooleanSupplier;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertSame;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.doCallRealMethod;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
public class NativeNeoForgeServerAccessTest {
private static final ResourceKey<Level> RUNTIME_DIMENSION =
ResourceKey.create(Registries.DIMENSION, Identifier.fromNamespaceAndPath("irisworldgen", "runtime"));
@BeforeClass
public static void bootstrap() {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
}
@After
public void forgetLevelSnapshot() {
ModdedServerLevels.forget();
}
@Test
public void runtimeLevelsJoinAndLeaveTheServerTickView() throws ReflectiveOperationException {
ModdedServerAccess access = new NativeNeoForgeLoader(
new NativeLoaderOptions("irisworldgen", "treefeller", BooleanSupplier::getAsBoolean)).serverAccess();
MinecraftServer server = serverWithLiveLevelMap();
ServerLevel level = mock(ServerLevel.class);
when(level.dimension()).thenReturn(RUNTIME_DIMENSION);
assertNull(access.putLevelIfAbsent(server, RUNTIME_DIMENSION, level));
assertTrue(access.hasLevel(server, RUNTIME_DIMENSION));
assertTrue(ticks(server, level));
assertSame(level, ModdedServerLevels.level(server, RUNTIME_DIMENSION));
assertSame(level, access.removeLevel(server, RUNTIME_DIMENSION));
assertFalse(access.hasLevel(server, RUNTIME_DIMENSION));
assertFalse(ticks(server, level));
assertNull(ModdedServerLevels.level(server, RUNTIME_DIMENSION));
assertNull(access.putLevel(server, RUNTIME_DIMENSION, level));
assertTrue(ticks(server, level));
assertSame(level, ModdedServerLevels.level(server, RUNTIME_DIMENSION));
}
private static MinecraftServer serverWithLiveLevelMap() throws ReflectiveOperationException {
MinecraftServer server = mock(MinecraftServer.class);
Field levels = MinecraftServer.class.getDeclaredField("levels");
levels.setAccessible(true);
levels.set(server, new LinkedHashMap<ResourceKey<Level>, ServerLevel>());
doCallRealMethod().when(server).getAllLevels();
return server;
}
private static boolean ticks(MinecraftServer server, ServerLevel expected) {
for (ServerLevel level : server.getAllLevels()) {
if (level == expected) {
return true;
}
}
return false;
}
}