Batch 3 of the API review: extension point, resources by kind

- PackWorld, InvocationContext and PackSettings get extension(type),
  an Optional empty by default: the one door a host's own modules use
  to reach its facades. The runners forward the inputs' extensions;
  the world a module sees (ModuleWorld, built by the host) forwards
  the world's. PackWorld.withLog is gone.
- A chunk stage writes registered mantle layers inside its own chunk
  and reads the rest (ChunkMantle); ReadOnlyMantle and its host() are
  gone.
- PackResources.find(kind, id), require(kind, id), ids(kind) and the
  host kinds BIOMES, REGIONS, OBJECTS replace ResourceKey and
  ResourceKind.key. Services and LinkedBiomes name pack resources by
  ResourceId. @Ref(PACK_*) and @ResourceRef fit ResourceId fields.
- BlockAccess extends BlockView.
- Absent values in ItemDrop, EntitySpec and AmbientEffects.Effect are
  Optionals; StructureFit.Start.key() returns a StartKey.
- Mantle.caverns() becomes isCarved(x, y, z).
- OptionsMetadata and DeclaredFieldOrder move to com.volmit.host.
- README, DESIGN and CONTRACTS updated; ExtensionsTest added.
This commit is contained in:
piexel committed 2026-10-24 00:17:10 +02:00
1 parent 7143908d4b
commit 3a307b5b8e
54 files changed
+821 -398

No files matched your search

@@ -1,6 +1,8 @@
package com.volmit.config;
import com.volmit.IrisFeature;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import java.util.Collection;
import java.util.Set;
@@ -9,15 +11,17 @@ import java.util.Set;
* Implemented by settings that make pack biomes part of a pack's layout besides the ones its regions list: the biome
* that a cave band puts underground, or the target of a floating island. The host asks the settings of every dimension
* and biome it reaches, without knowing the module behind them, so such a biome is loaded, registered and given its own
* settings like any other. Keys are pack biome keys as packs write them; blank keys and keys naming no biome are
* ignored.
* settings like any other. Biomes are named by their ids, {@link PackResources#idOf} of the keys the settings hold; ids
* naming no biome of the pack are ignored.
*/
public interface LinkedBiomes {
/**
* Biomes that join the biome tree of every region the owner is part of, like the owner's children: the host registers
* them with the region, so their terrain generators take part in the region's terrain.
*
* @param pack the pack the settings belong to, which turns their keys into ids
*/
default Set<String> treeBiomes() {
default Set<ResourceId> treeBiomes(PackResources pack) {
return Set.of();
}
@@ -25,10 +29,11 @@ public interface LinkedBiomes {
* Biomes the settings use besides, which a dimension reaches (their objects, decorators and settings take part in
* generation) without joining the region's biome tree.
*
* @param pack the pack the settings belong to, which turns their keys into ids
* @param dimension the settings the owner's dimension declares, for settings that name something the dimension
* declares, such as a band of its caves
*/
default Set<String> usedBiomes(Collection<IrisFeature> dimension) {
default Set<ResourceId> usedBiomes(PackResources pack, Collection<IrisFeature> dimension) {
return Set.of();
}
}