Modded pack metadata

- Modded jars ship pack.mcmeta for client resources and mod data
- Modded jars bundle jlibdeflate and its native libraries
- Artifact check requires pack.mcmeta and the jlibdeflate entries
- Artifact check rejects client language resources without pack.mcmeta
- Test loads the pack metadata against the current Minecraft formats
This commit is contained in:
Brian Neumann-Fopiano
2026-09-29 00:29:26 -04:00
parent c20296d106
commit 34684da611
8 changed files with 90 additions and 0 deletions
@@ -85,6 +85,11 @@ public final class ModdedArtifactVerifier {
throw new GradleException(artifact.getName() + " is missing " + requiredEntry);
}
}
if (jar.getJarEntry("assets/irisworldgen/lang/en_us.json") != null
&& jar.getJarEntry("pack.mcmeta") == null) {
throw new GradleException(artifact.getName()
+ " ships Iris client language resources without pack.mcmeta");
}
Set<String> bundledRuntimeEntries = new LinkedHashSet<>();
Set<String> privateReferenceClasses = new LinkedHashSet<>();
@@ -44,6 +44,28 @@ public class ModdedArtifactVerifierTest {
ModdedArtifactVerifier.verify(artifact, REQUIRED_ENTRIES);
}
@Test
public void rejectsClientLanguagesWithoutPackMetadata() throws Exception {
Map<String, byte[]> entries = validEntries();
entries.put("assets/irisworldgen/lang/en_us.json", "{}".getBytes(StandardCharsets.UTF_8));
File artifact = createArtifact(entries);
GradleException failure = assertThrows(GradleException.class,
() -> ModdedArtifactVerifier.verify(artifact, REQUIRED_ENTRIES));
assertTrue(failure.getMessage().contains("client language resources without pack.mcmeta"));
}
@Test
public void acceptsClientLanguagesWithPackMetadata() throws Exception {
Map<String, byte[]> entries = validEntries();
entries.put("assets/irisworldgen/lang/en_us.json", "{}".getBytes(StandardCharsets.UTF_8));
entries.put("pack.mcmeta", ("{\"pack\":{\"description\":\"Iris\","
+ "\"min_format\":[88,0],\"max_format\":[107,1]}}")
.getBytes(StandardCharsets.UTF_8));
ModdedArtifactVerifier.verify(createArtifact(entries), REQUIRED_ENTRIES);
}
@Test
public void rejectsRelocatedRuntimeReference() throws Exception {
Map<String, byte[]> entries = validEntries();