mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-28 00:34:19 +00:00
Settings features declare a short JSON key and may declare a root option
@Feature(key) is required: a plain field name, unique per target across all modules and the host's own JSON fields (ModuleHost.reservingFields, back for keys). A clash refuses the pack load naming the key, the target and both claimants. @Feature(root) declares that the JSON under the key is one option's value, so a settings class has exactly one shape; FeatureSchema carries it.
This commit is contained in:
1 parent
1707bb95f6
commit
b82c292dcb
30 files changed
+536
-119
No files matched your search
@@ -2,13 +2,25 @@ package com.volmit.config;
|
||||
|
||||
import java.lang.annotation.*;
|
||||
|
||||
/** Identity and JSON attachment for an IrisFeature configuration class. Packs write the settings under
|
||||
* their feature id, such as {@code "example:moss": {...}}, at each of the targets.
|
||||
/** Identity and JSON attachment for an IrisFeature configuration class. The {@code id}, such as
|
||||
* {@code "example:moss"}, is the feature's identity in the stage graph, logs and lookups by class. Packs write
|
||||
* the settings under the short {@code key}, such as {@code "moss": {...}}, at each of the targets.
|
||||
*
|
||||
* <p>The key is a plain JSON field name: not blank, no ':'. It is unique per target across all loaded modules
|
||||
* and the JSON fields the host itself uses at that target, so it must not be a field of a biome, region or
|
||||
* dimension; a clash refuses the pack load, naming both claimants.
|
||||
*
|
||||
* <p>The JSON under the key is an object of the class's options, unless {@code root} names an option. Then the
|
||||
* key holds exactly that option's value, such as a list, and an object is not accepted: with
|
||||
* {@code @Feature(id = "iris:deposit", key = "deposits", root = "generators", ...)} a pack writes
|
||||
* {@code "deposits": [...]}. The class has no other option then, since nothing could set it.
|
||||
*/
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
public @interface Feature {
|
||||
String id();
|
||||
String name();
|
||||
String key();
|
||||
String root() default "";
|
||||
com.volmit.FeatureAttachment.Target[] targets();
|
||||
}
|
||||
Reference in new issue
Block a user