Follow @ResourceRef in the export closure and schema

This commit is contained in:
piexel committed 2026-11-06 07:16:27 +01:00
1 parent 4acc1ee2b9
commit 6e1a206013
3 files changed
+7 -7

No files matched your search

@@ -27,7 +27,7 @@ import art.arcane.iris.engine.object.structure.IrisStructure;
import art.arcane.volmlib.util.io.IO;
import art.arcane.volmlib.util.json.JSONObject;
import com.google.gson.Gson;
import com.volmit.config.Ref;
import com.volmit.config.ResourceRef;
import com.volmit.host.ResourceKindRegistration;
import com.volmit.resource.ResourceKind;
@@ -49,7 +49,7 @@ import java.util.TreeSet;
/**
* The resources of the pack's module resource kinds that a pack export has to carry: what the settings of the
* exported dimension, regions and biomes (and anything else handed to {@link #follow}) name by {@code @Ref(kind = ...)},
* exported dimension, regions and biomes (and anything else handed to {@link #follow}) name by {@link ResourceRef},
* {@link IrisStructureRef} or {@link RegistryListResource}, and what those resources name in turn. Core does not know the kinds: it follows the
* references the modules declare on their classes.
*/
@@ -169,9 +169,9 @@ public final class ModuleResourceClosure {
/** The class of the resources the field names by key, or null when it names none. */
private static Class<?> referencedType(Field field) {
Ref reference = field.getAnnotation(Ref.class);
if (reference != null && reference.kind() != void.class) {
return reference.kind();
ResourceRef reference = field.getAnnotation(ResourceRef.class);
if (reference != null) {
return reference.value();
}
if (field.isAnnotationPresent(IrisStructureRef.class)) {
return IrisStructure.class;
@@ -56,7 +56,7 @@ public class PackModuleResourceKindTest {
public final class Keep {
@Desc("Towers on the walls") @MinNumber(1)
private int towers = 4;
@Ref(kind = Keep.class)
@ResourceRef(Keep.class)
private String next = "";
public int towers() { return towers; }
@@ -216,7 +216,7 @@ public class SchemaBuilderParityTest {
assertEquals("@IrisStructureRef completes the keys of Iris's structure model",
"#/definitions/erz" + StructureResources.STRUCTURES.folder(),
properties.getJSONObject("structures").getJSONObject("items").getString("$ref"));
assertEquals("@Ref(kind = PackBiome.class) completes the pack's biome keys", "#/definitions/erzbiomes",
assertEquals("@ResourceRef(PackBiome.class) completes the pack's biome keys", "#/definitions/erzbiomes",
properties.getJSONObject("caveBiomes").getJSONObject("items").getString("$ref"));
assertFalse(properties.has("scale"));
}