Modded test fixes

- Language asset test locates the directory through the English file
- Structure template test reads the mixin class bytes instead of loading it
- Water spawn test initializes block state caches before running
- Logging policy check runs after the native sources are unpacked
- Native class boundary check runs after classes compile
This commit is contained in:
Brian Neumann-Fopiano
2026-09-29 00:29:26 -04:00
parent 34684da611
commit 7b06cd51ac
4 changed files with 26 additions and 7 deletions
@@ -72,10 +72,10 @@ public class IrisModLanguageAssetsTest {
} }
private Set<String> resourceFiles() throws Exception { private Set<String> resourceFiles() throws Exception {
URL resource = IrisModLanguageAssetsTest.class.getClassLoader().getResource(ROOT); URL resource = IrisModLanguageAssetsTest.class.getClassLoader().getResource(ROOT + "en_us.json");
assertNotNull("Missing mod language resource directory: " + ROOT, resource); assertNotNull("Missing English mod language resource", resource);
assertEquals("Mod language resources must resolve to a directory on disk", "file", resource.getProtocol()); assertEquals("Mod language resources must resolve to a directory on disk", "file", resource.getProtocol());
Path directory = Path.of(resource.toURI()); Path directory = Path.of(resource.toURI()).getParent();
try (Stream<Path> paths = Files.list(directory)) { try (Stream<Path> paths = Files.list(directory)) {
return paths return paths
.filter(Files::isRegularFile) .filter(Files::isRegularFile)
@@ -1,6 +1,7 @@
package art.arcane.iris.modded; package art.arcane.iris.modded;
import org.junit.Test; import org.junit.Test;
import org.objectweb.asm.ClassReader;
import java.io.InputStream; import java.io.InputStream;
import java.nio.charset.StandardCharsets; import java.nio.charset.StandardCharsets;
@@ -62,9 +63,11 @@ public class ModdedStructureTemplateCacheTest {
config = new String(input.readAllBytes(), StandardCharsets.UTF_8); config = new String(input.readAllBytes(), StandardCharsets.UTF_8);
} }
assertTrue(config.contains("\"StructureTemplatePaletteConcurrencyMixin\"")); assertTrue(config.contains("\"StructureTemplatePaletteConcurrencyMixin\""));
assertNotNull(Class.forName( String mixin = "art/arcane/volmlib/nativelib/minecraft26_2/modded/mixin/StructureTemplatePaletteConcurrencyMixin";
"art.arcane.volmlib.nativelib.minecraft26_2.modded.mixin.StructureTemplatePaletteConcurrencyMixin", try (InputStream input = ModdedStructureTemplateCacheTest.class.getClassLoader()
false, .getResourceAsStream(mixin + ".class")) {
ModdedStructureTemplateCacheTest.class.getClassLoader())); assertNotNull(input);
assertEquals(mixin, new ClassReader(input).getClassName());
}
} }
} }
@@ -11,9 +11,12 @@ import art.arcane.iris.generation.decoration.IrisSurface;
import art.arcane.volmlib.util.math.RNG; import art.arcane.volmlib.util.math.RNG;
import net.minecraft.SharedConstants; import net.minecraft.SharedConstants;
import net.minecraft.core.BlockPos; import net.minecraft.core.BlockPos;
import net.minecraft.core.registries.BuiltInRegistries;
import net.minecraft.server.Bootstrap; import net.minecraft.server.Bootstrap;
import net.minecraft.server.level.ServerLevel; import net.minecraft.server.level.ServerLevel;
import net.minecraft.world.level.block.Block;
import net.minecraft.world.level.block.Blocks; import net.minecraft.world.level.block.Blocks;
import net.minecraft.world.level.block.state.BlockState;
import net.minecraft.world.level.block.state.properties.BlockStateProperties; import net.minecraft.world.level.block.state.properties.BlockStateProperties;
import org.junit.BeforeClass; import org.junit.BeforeClass;
import org.junit.Test; import org.junit.Test;
@@ -34,6 +37,11 @@ public class ModdedWaterEntitySpawnTest {
public static void bootstrapMinecraftRegistries() { public static void bootstrapMinecraftRegistries() {
SharedConstants.tryDetectVersion(); SharedConstants.tryDetectVersion();
Bootstrap.bootStrap(); Bootstrap.bootStrap();
for (Block block : BuiltInRegistries.BLOCK) {
for (BlockState state : block.getStateDefinition().getPossibleStates()) {
state.initCache();
}
}
} }
@Test @Test
+8
View File
@@ -37,6 +37,14 @@ tasks.named('processResources').configure {
dependsOn(unpackNativeMinecraftSources) dependsOn(unpackNativeMinecraftSources)
} }
tasks.named('verifyLoggingPolicy').configure {
dependsOn(unpackNativeMinecraftSources)
}
tasks.named('verifyNativeClassBoundary').configure {
dependsOn(tasks.named('classes'))
}
tasks.matching { Task task -> task.name == 'createMinecraftArtifacts' }.configureEach { tasks.matching { Task task -> task.name == 'createMinecraftArtifacts' }.configureEach {
dependsOn(unpackNativeMinecraftSources) dependsOn(unpackNativeMinecraftSources)
} }