diff --git a/DESIGN.md b/DESIGN.md index 04b1cf241..3bebefb60 100644 --- a/DESIGN.md +++ b/DESIGN.md @@ -798,6 +798,9 @@ Why these lines: the module's: noise lines up across chunks only when it comes from `worldSeed()`, not a stage's stream. - **`NoiseSampler` moved to `com.volmit.noise`** and gained a two-dimensional `sample(x, z)`: Iris's noise gives different fields in two and three dimensions, and most features sample columns. +- **`PackWorld.minHeight()`**: all heights are above the dimension's bottom, but packs write some settings as absolute + world Y (cave biome bands, floating island altitudes, structure bands). Those are converted by the module with the + platform's Y of the bottom, a default method (0) so a fixture without negative Y needs nothing. - **`NoiseSampler.signed(...)`** is the sample mapped to -1..1 that a host may answer from a per-thread memo of the coordinates it was just asked: a carver adds several fields and tests the sum around zero, and reads the same points of one field again and again, so the memo is the difference between caves that cost what they always did and caves that diff --git a/README.md b/README.md index 7e5022ef8..3e5c88a68 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,9 @@ X and Z are world coordinates. Y is always the height above the dimension's bott of the dimension, whatever its minimum height is in the platform, so Y is never negative. This holds for every API value that carries a height: terrain and biome samples, `BlockBox` bounds of the terrain sampler, block views, placement edits and the mantle, hunks, block palettes and noise samplers. The host -converts to and from the platform's own Y at its boundary; modules never see it. +converts to and from the platform's own Y at its boundary. The one place a module meets the platform's Y is a +setting that names an absolute world Y, as packs write them (a cave biome band between Y -64 and 320): it converts +with `world.minHeight()`, the platform's Y of the dimension's bottom. ## Random streams diff --git a/src/main/java/com/volmit/world/PackWorld.java b/src/main/java/com/volmit/world/PackWorld.java index a944650c1..93f5431f5 100644 --- a/src/main/java/com/volmit/world/PackWorld.java +++ b/src/main/java/com/volmit/world/PackWorld.java @@ -26,6 +26,14 @@ public interface PackWorld { /** The settings of the world's dimension and of every region and biome it can reach, as mantle reaches see them. */ PackSettings settings(); + /** The platform's Y of the dimension's bottom (-64 in the overworld). Every height the API carries is above that + * bottom; settings that name an absolute world Y, as packs write them for the platform, are converted with it: + * {@code heightAboveBottom = worldY - minHeight()}. Zero unless the host's dimensions begin below Y 0. + */ + default int minHeight() { + return 0; + } + /** * The world's one {@code type} instance, created by {@code create} the first time anyone asks for it. Modules keep * their caches and per-world workers here instead of in fields, since stage bodies and services are shared by every