From 4755e2440774ef9eb6f0978fa3fe741907e54371 Mon Sep 17 00:00:00 2001 From: piexel Date: Sat, 10 Oct 2026 03:46:12 +0200 Subject: [PATCH] PlatformStart gives the dimension's bottom; the catalog lists every provider of a service with its module A shift rule written in world heights (a band of world Y) needs the bottom to convert the start's bounds, and the host asks each VanillaStructures provider in module order, naming the module when one fails. BlockAccess documents that a structure fit's access answers only the traits the platform's world can answer natively. --- src/main/java/com/volmit/host/FeatureCatalog.java | 8 ++++++++ src/main/java/com/volmit/vanilla/PlatformStart.java | 3 +++ src/main/java/com/volmit/world/BlockAccess.java | 4 +++- src/test/java/com/volmit/host/ModuleRegistryTest.java | 3 +++ 4 files changed, 17 insertions(+), 1 deletion(-) 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) {