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,7 +1,7 @@
package com.volmit;
import com.volmit.block.BlockState;
import com.volmit.config.OptionsMetadata;
import com.volmit.host.OptionsMetadata;
import com.volmit.resource.PackResources;
import com.volmit.resource.ResourceId;
import com.volmit.service.LocateResult;
@@ -30,6 +30,7 @@ import static org.junit.jupiter.api.Assertions.*;
class VanillaStructureValuesTest {
private static final ResourceId VILLAGES = ResourceId.parse("minecraft:villages");
private static final ResourceId CITY = ResourceId.parse("minecraft:ancient_city");
private static final ResourceId CASTLE = ResourceId.parse("test:castle");
@Test
void jigsawOverridesKeepThePacksJsonNamesAndDefaults() {
@@ -137,22 +138,22 @@ class VanillaStructureValuesTest {
public void aLocatorPlacesWhatItCanLocateUnlessItSaysMore() {
StructureLocator locator = new StructureLocator() {
@Override
public Set<String> structures(PackResources pack) {
return Set.of("castle", "tower");
public Set<ResourceId> structures(PackResources pack) {
return Set.of(CASTLE, ResourceId.parse("test:tower"));
}
@Override
public Set<String> locatable(PackWorld world) {
return Set.of("castle");
public Set<ResourceId> locatable(PackWorld world) {
return Set.of(CASTLE);
}
@Override
public LocateResult locate(PackWorld world, String key, int fromX, int fromZ, int maxRadiusChunks) {
public LocateResult locate(PackWorld world, ResourceId structure, int fromX, int fromZ, int maxRadiusChunks) {
return LocateResult.NOT_FOUND;
}
};
assertEquals(Set.of("castle"), locator.placed(null));
assertEquals(Set.of(CASTLE), locator.placed(null));
}
@Test