diff --git a/README.md b/README.md index ce1817f64..7208a6aaa 100644 --- a/README.md +++ b/README.md @@ -175,7 +175,7 @@ public void register(FeatureRegistry registry) { } // anywhere the pack's resources are at hand, such as a stage or a validator -Keep keep = resources.require(KEEPS.key(new ResourceId(resources.packId().namespace(), "towers/north"))); +Keep keep = resources.require(KEEPS.key(resources.idOf("towers/north"))); List all = resources.ids(Keep.class); // every keep of the pack, in id order ``` diff --git a/src/main/java/com/volmit/resource/PackResources.java b/src/main/java/com/volmit/resource/PackResources.java index 733ba0319..3e10eb9ea 100644 --- a/src/main/java/com/volmit/resource/PackResources.java +++ b/src/main/java/com/volmit/resource/PackResources.java @@ -28,6 +28,15 @@ public interface PackResources { /** Builds the noise of the {@link com.volmit.noise.NoiseStyle}s the pack's settings describe. */ NoiseFactory noise(); + /** The id the pack's resources have for the one the pack's own files name by {@code packKey}, such as {@code desert/dunes} + * (a biome's key in a region, a settings field naming a biome): {@code overworld:desert/dunes} in the pack + * {@code overworld}. Characters an id cannot hold are replaced the way the host does for its own ids, so use this and + * not {@code new ResourceId(packId().namespace(), packKey)} for a key that may hold them. + */ + default ResourceId idOf(String packKey) { + return new ResourceId(packId().namespace(), packKey); + } + Optional find(ResourceKey key); /** The ids of every resource of the kind {@code type} selects, in id order. A type the host does not serve