Added 26.1.2 and 26.2 mod targets

- Mod targets 26.2 and 26.1.2 (inheriting 26.2) with Fabric 0.19.5, Forge 65.1.3 and 64.1.4, NeoForge 26.2.0.89 and 26.1.2.116
- The 26.3 target reads the minecraft26_3 native access rules
- Per-version pack.mcmeta ranges for 26.2 and 26.1.2
- 26.2 and 26.1.2 test overlays and replacements for the pre-26.3 biome, spawn, carver and sign APIs
- NeoForge compiles against the loader's own ASM while the mod jar keeps the bundled ASM
This commit is contained in:
Brian Neumann-Fopiano committed 2026-10-16 11:07:09 -04:00
1 parent 0073002b57
commit 4daae925c6
9 files changed
+624 -2

No files matched your search

+6 -1
View File
@@ -168,13 +168,18 @@ dependencies {
"art.arcane:core:${irisVersion}".toString(),
"art.arcane:spi:${irisVersion}".toString(),
libs.paralithic,
libs.asm,
libs.lru,
libs.caffeine,
'com.fulcrumgenomics:jlibdeflate:0.2.0',
libs.dom4j,
libs.jaxen
]
add('bundle', libs.asm)
add('devBundle', 'org.ow2.asm:asm') {
version {
prefer(libs.versions.asm.get())
}
}
shared.each { Object notation ->
['bundle', 'devBundle'].each { String configuration ->
add(configuration, notation) {
@@ -0,0 +1,89 @@
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.lang.reflect.Method;
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();
doCallRealMethod().when(server).markWorldsDirty();
return server;
}
private static boolean ticks(MinecraftServer server, ServerLevel expected) throws ReflectiveOperationException {
Method worldArray = MinecraftServer.class.getDeclaredMethod("getWorldArray");
worldArray.setAccessible(true);
for (ServerLevel level : (ServerLevel[]) worldArray.invoke(server)) {
if (level == expected) {
return true;
}
}
return false;
}
}