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.
This commit is contained in:
piexel committed 2026-10-15 13:03:42 +02:00
1 parent f44b31edd0
commit e3e8db3329
4 files changed
+6 -4

No files matched your search

+1 -1
View File
@@ -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.
+1 -1
View File
@@ -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
@@ -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
}
@@ -47,7 +47,7 @@ final class ValueKinds {
private static final Set<Class<?>> DECIMALS = Set.of(float.class, double.class, Float.class, Double.class);
private static final String DECLARE_COLLECTION = "declare it as List<...>, Set<...> or Map<String, ...>";
private static final Set<Reference> 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<Class<?>, ObjectKind> objects;
private final HostTypes hostTypes;