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 committed 2026-09-29 00:29:26 -04:00
1 parent c20296d106
commit 34684da611
8 files changed
+90

No files matched your search

@@ -0,0 +1,7 @@
{
"pack": {
"description": "Iris client resources and mod data",
"min_format": [88, 0],
"max_format": [107, 1]
}
}
@@ -0,0 +1,45 @@
package art.arcane.iris.modded;
import com.google.gson.JsonObject;
import com.google.gson.JsonParser;
import com.mojang.serialization.JsonOps;
import net.minecraft.SharedConstants;
import net.minecraft.server.Bootstrap;
import net.minecraft.server.packs.PackType;
import net.minecraft.server.packs.metadata.pack.PackMetadataSection;
import org.junit.BeforeClass;
import org.junit.Test;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
public class ModdedPackMetadataTest {
@BeforeClass
public static void bootstrapMinecraftRegistries() {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
}
@Test
public void metadataLoadsClientResourcesAndServerDataForCurrentMinecraft() throws IOException {
try (InputStream resource = ModdedPackMetadataTest.class.getResourceAsStream("/pack.mcmeta")) {
assertNotNull(resource);
try (InputStreamReader reader = new InputStreamReader(resource, StandardCharsets.UTF_8)) {
JsonObject metadata = JsonParser.parseReader(reader).getAsJsonObject();
for (PackType type : PackType.values()) {
PackMetadataSection section = PackMetadataSection.forPackType(type).codec()
.parse(JsonOps.INSTANCE, metadata.get("pack")).getOrThrow();
assertEquals("Iris client resources and mod data", section.description().getString());
assertTrue(type.toString(), section.supportedFormats().isValueInRange(
SharedConstants.getCurrentVersion().packVersion(type)));
}
}
}
}
}