diff --git a/api/src/main/java/com/volmit/resource/PlatformRegistries.java b/api/src/main/java/com/volmit/resource/PlatformRegistries.java new file mode 100644 index 000000000..0a0e34faf --- /dev/null +++ b/api/src/main/java/com/volmit/resource/PlatformRegistries.java @@ -0,0 +1,16 @@ +package com.volmit.resource; + +import com.volmit.config.Reference; + +import java.util.Set; + +/** The ids the running platform has registered, as the server has them, data packs and mods included: the entries a + * {@link com.volmit.config.Ref} option names. Read during validation; ids stay valid until the platform reloads them. + */ +public interface PlatformRegistries { + /** Every id the platform registers under {@code registry}, such as {@code minecraft:village_plains} for + * {@link Reference#STRUCTURE}; empty for a reference that is no platform registry ({@link Reference#STRUCTURE_PREFIX}, + * {@link Reference#SPECIAL_ENTITY}, {@link Reference#NOISE_STYLE}) or one the platform lacks. + */ + Set ids(Reference registry); +} diff --git a/api/src/main/java/com/volmit/validation/ValidationContext.java b/api/src/main/java/com/volmit/validation/ValidationContext.java index faa59be49..0f6231898 100644 --- a/api/src/main/java/com/volmit/validation/ValidationContext.java +++ b/api/src/main/java/com/volmit/validation/ValidationContext.java @@ -2,6 +2,9 @@ package com.volmit.validation; import com.volmit.config.PackSettings; import com.volmit.resource.PackResources; +import com.volmit.resource.PlatformRegistries; + +import java.util.Optional; /** The pack one {@link Validator} checks, as the host would load it, and where it reports what it finds. Valid * only while {@link Validator#validate} runs. @@ -17,6 +20,11 @@ public interface ValidationContext { */ PackSettings settings(); + /** The platform's registries as the running server has them; empty when the host validates without a platform, + * such as a build or a data pack compile before the server starts. A check against them is skipped when empty. + */ + Optional platform(); + /** Records {@code problem}. An {@link Severity#ERROR} stops the pack from loading once every validator has run. */ void report(Problem problem); }