Split @Ref into @Ref(Reference) and @ResourceRef(Kind.class)

@Ref had two attributes of which exactly one had to be given, checked
only at pack load. One annotation per concept makes a wrong
combination a compile error; giving both still fails the load.
This commit is contained in:
piexel committed 2026-11-06 07:16:25 +01:00
1 parent c577b68c00
commit 264f754297
11 files changed
+89 -70

No files matched your search

@@ -0,0 +1,16 @@
package com.volmit.config;
import java.lang.annotation.*;
/** Says that an option's text names a resource of the pack by its key, {@code @ResourceRef(LootTable.class) String table},
* where the value is the type of a {@link com.volmit.resource.ResourceKind}: a host kind, the constants of
* {@link com.volmit.resource.PackResources}, or a kind some module of the pack registers. Studio then offers the pack's
* keys of that kind. Allowed on {@code String} and {@link com.volmit.resource.ResourceId} options and on lists, sets and
* arrays of them, where it applies to every element; a {@code ResourceId} option holds the id the pack gives the key it
* writes. An option with both this and {@link Ref}, or with either on any other type, fails the pack load.
*/
@Retention(RetentionPolicy.RUNTIME)
@Target(ElementType.FIELD)
public @interface ResourceRef {
Class<?> value();
}