diff --git a/src/main/java/com/volmit/host/FeatureCatalog.java b/src/main/java/com/volmit/host/FeatureCatalog.java index ac0c753f9..0f663801a 100644 --- a/src/main/java/com/volmit/host/FeatureCatalog.java +++ b/src/main/java/com/volmit/host/FeatureCatalog.java @@ -89,6 +89,14 @@ public final class FeatureCatalog { .toList(); } + /** Every provider of {@code service} with the module that registered it, in the order of {@link #services}, so the host + * can name the module whose provider failed. + */ + public List registrations(Class service) { + requireService(service); + return services.stream().filter(registration -> registration.service() == service).toList(); + } + /** The one provider of {@code service}, a service whose providers are {@link Providers#ONE}, if a module provides it. */ public Optional service(Class service) { if (requireService(service).value() != Providers.ONE) { diff --git a/src/main/java/com/volmit/vanilla/PlatformStart.java b/src/main/java/com/volmit/vanilla/PlatformStart.java index 57eed5226..bc163a3cc 100644 --- a/src/main/java/com/volmit/vanilla/PlatformStart.java +++ b/src/main/java/com/volmit/vanilla/PlatformStart.java @@ -26,6 +26,9 @@ public interface PlatformStart { */ boolean aligned(); + /** The world height of the dimension's bottom, for rules written in world heights, such as a band of world Y. */ + int bottomY(); + /** The height of the terrain's surface at a column, above the dimension's bottom: the highest block of the terrain * the host generated there, fluids ignored. */ diff --git a/src/main/java/com/volmit/world/BlockAccess.java b/src/main/java/com/volmit/world/BlockAccess.java index 3e868791f..a19d6f98c 100644 --- a/src/main/java/com/volmit/world/BlockAccess.java +++ b/src/main/java/com/volmit/world/BlockAccess.java @@ -34,7 +34,9 @@ public interface BlockAccess { * {@link BlockTrait#SOLID} for what the platform counts as solid, {@link BlockTrait#FLUID} for a state holding any * fluid (a source, a flowing fluid, a waterlogged block), {@link BlockTrait#LOG} for logs, wood, stems and hyphae and * {@link BlockTrait#LEAVES} for leaves, by the platform's tags or names. These can differ in corner cases from - * {@link com.volmit.block.BlockRegistry#hasTrait}, which describes blocks the way generation picks them. + * {@link com.volmit.block.BlockRegistry#hasTrait}, which describes blocks the way generation picks them. Other + * traits are not answered: the platform's world has no native question for them, so asking throws + * {@link UnsupportedOperationException}. */ boolean is(BlockState state, BlockTrait trait); diff --git a/src/test/java/com/volmit/host/ModuleRegistryTest.java b/src/test/java/com/volmit/host/ModuleRegistryTest.java index 6e080f80a..ef27a5a28 100644 --- a/src/test/java/com/volmit/host/ModuleRegistryTest.java +++ b/src/test/java/com/volmit/host/ModuleRegistryTest.java @@ -436,6 +436,9 @@ class ModuleRegistryTest { registerAs(registry, "test:alpha", services -> services.registerService(VanillaStructures.class, first)); assertEquals(List.of(first, other), registry.freeze().services(VanillaStructures.class)); + var registrations = registry.freeze().registrations(VanillaStructures.class); + assertEquals(List.of(first, other), registrations.stream().map(ServiceRegistration::provider).toList()); + assertEquals("test:alpha", registrations.getFirst().module().info().id().toString()); } private static MantleCodec codec(int version) {