From e3e8db3329f6768cbdc758aa1988d8cd97a4324b Mon Sep 17 00:00:00 2001 From: piexel Date: Thu, 15 Oct 2026 13:03:42 +0200 Subject: [PATCH] Reference.PACK_STRUCTURE: a jigsaw structure of the pack Lets a settings class name the pack's structures by key without naming the host's structure class, like PACK_BIOME and PACK_OBJECT. --- DESIGN.md | 2 +- README.md | 2 +- src/main/java/com/volmit/config/Reference.java | 4 +++- src/main/java/com/volmit/host/ValueKinds.java | 2 +- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/DESIGN.md b/DESIGN.md index 9d9d43a0f..ab9bf6c8f 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -728,7 +728,7 @@ biomes, regions, objects, expressions and image maps of the pack, the resource f refer to most. More kinds come when a module needs one and the host can serve it. `@Ref` fits `String` and `ResourceId` and lists, sets and arrays of them, where it applies to the elements. On any other field, a map included, it fails the -load. The pack kinds (`PACK_BIOME`, `PACK_REGION`, `PACK_OBJECT`, `PACK_EXPRESSION`, `PACK_IMAGE_MAP`) fit `String` only: packs name their +load. The pack kinds (`PACK_BIOME`, `PACK_REGION`, `PACK_OBJECT`, `PACK_EXPRESSION`, `PACK_IMAGE_MAP`, `PACK_STRUCTURE`) fit `String` only: packs name their biomes, regions and objects by path without a namespace, such as `desert/dunes`, which a `ResourceId` cannot hold. `BlockState` always names a block, so its fields are block references without `@Ref`; `@Ref(BLOCK)` there is accepted, any other kind fails. diff --git a/README.md b/README.md index 5a89b7e0a..bcabd0aae 100644 --- a/README.md +++ b/README.md @@ -465,7 +465,7 @@ public final class FloraSettings implements IrisFeature { them, so studio offers the right list: `BLOCK`, `ITEM`, `ENTITY`, `BIOME`, `STRUCTURE`, `STRUCTURE_PREFIX` (a structure or a family prefix such as `minecraft:village`), `STRUCTURE_SET`, `TEMPLATE_POOL` (a jigsaw template pool), `POTION_EFFECT`, `ENCHANTMENT`, `LOOT_TABLE` or `SPECIAL_ENTITY` (a mob of another plugin) from the server's registries, `NOISE_STYLE` from the host's noise - styles, or `PACK_BIOME`, `PACK_REGION`, `PACK_OBJECT`, `PACK_EXPRESSION` or `PACK_IMAGE_MAP` of the pack. + styles, or `PACK_BIOME`, `PACK_REGION`, `PACK_OBJECT`, `PACK_EXPRESSION`, `PACK_IMAGE_MAP` or `PACK_STRUCTURE` (a jigsaw structure) of the pack. The pack kinds fit `String` only, in the form packs use (`desert/dunes`), never `ResourceId`. `BlockState` fields name blocks without it. `@Ref` on any other field fails the load. - `@ResourceRef(Keep.class)` says that a `String`, or a list, set or array of them, names a resource of the diff --git a/src/main/java/com/volmit/config/Reference.java b/src/main/java/com/volmit/config/Reference.java index 99bf500a9..7e8c42e1b 100644 --- a/src/main/java/com/volmit/config/Reference.java +++ b/src/main/java/com/volmit/config/Reference.java @@ -42,5 +42,7 @@ public enum Reference { /** An expression of the pack. */ PACK_EXPRESSION, /** An image map of the pack. */ - PACK_IMAGE_MAP + PACK_IMAGE_MAP, + /** A jigsaw structure of the pack. */ + PACK_STRUCTURE } diff --git a/src/main/java/com/volmit/host/ValueKinds.java b/src/main/java/com/volmit/host/ValueKinds.java index 9da5f842e..4bf43af41 100644 --- a/src/main/java/com/volmit/host/ValueKinds.java +++ b/src/main/java/com/volmit/host/ValueKinds.java @@ -47,7 +47,7 @@ final class ValueKinds { private static final Set> DECIMALS = Set.of(float.class, double.class, Float.class, Double.class); private static final String DECLARE_COLLECTION = "declare it as List<...>, Set<...> or Map"; private static final Set PACK_REFERENCES = EnumSet.of(Reference.PACK_BIOME, Reference.PACK_REGION, Reference.PACK_OBJECT, - Reference.PACK_EXPRESSION, Reference.PACK_IMAGE_MAP); + Reference.PACK_EXPRESSION, Reference.PACK_IMAGE_MAP, Reference.PACK_STRUCTURE); private final Function, ObjectKind> objects; private final HostTypes hostTypes;