mirror of
https://github.com/VolmitSoftware/Iris.git
synced 2026-11-27 00:04:42 +00:00
LinkedBiomes: settings name the pack biomes they bring into the layout; CaveBiomes service: the cave biome a module puts at a position and a biome's minimum cave depth
This commit is contained in:
1 parent
6757cbdd0f
commit
25f9ea2f37
5 files changed
+80
-2
No files matched your search
+2
-2
@@ -21,7 +21,7 @@ types that carry them and lists what the Iris adapter still owes.
|
||||
| Pack-load validation and diagnostics | host `StageGraphBuilder`, `ResolvedGraph`, `LoadedModules` |
|
||||
| Reference execution | host `PlacementRunner`, `ChunkRunner`, `MantleRunner` |
|
||||
| Work across chunks and mantle writes | `Stage.mantle`, `MantleStage`, `MantleStageContext`, `MantleGenerationContext`; chunk stages read the mantle only |
|
||||
| Annotated settings | `IrisFeature`, `@Feature` (id, short JSON `key`, optional `root`), config annotations, `OptionsMetadata` |
|
||||
| Annotated settings | `IrisFeature`, `@Feature` (id, short JSON `key`, optional `root`), config annotations, `OptionsMetadata`, `LinkedBiomes` (`treeBiomes`, `usedBiomes`: pack biomes the settings bring into the layout) |
|
||||
| Area a stage writes | `reach(blocks)`, `reach(PackReach)`, `writesMantle(...)` on stage definitions, `PackSettings`, host `StageReach`, `ResolvedStage.reachBlocks`, `PipelineReach` |
|
||||
| Settings described for studio | `@Desc`, `@Required`, `@MinNumber`, `@MaxNumber`, `@MinItems`, `@Snippet`, `@Ref`/`Reference`, `FeatureRegistry.registerSettings`, `FeatureRegistry.registerHeldType`, host `FeatureCatalog.heldTypes()`, host `LoadedPack.schema()` (`PackSchema`, `FeatureSchema`, `ObjectType`, `SchemaOption`, `ValueKind` with `HostKind`), `ModuleHost.describingHostTypesIn` |
|
||||
| Geometry and mantle registration | `FeatureRegistry`, host `ModuleRegistry`, `FeatureCatalog` |
|
||||
@@ -34,7 +34,7 @@ types that carry them and lists what the Iris adapter still owes.
|
||||
| Module-owned pack checks | `Validator`, `ValidationContext`, `Problem`, `Severity`, `Subject`, `FeatureRegistry.registerValidator`, host `FeatureCatalog.validators()` |
|
||||
| Per-world module state | `PackWorld` (`state`), `InvocationContext.world()`, host `WorldStates` |
|
||||
| Module lifecycle across loads, hotloads and reloads | `ModuleLifecycle`, `FeatureRegistry.registerLifecycle`, host `FeatureCatalog.lifecycles()`, `LifecycleRunner` |
|
||||
| Host questions answered by modules | `@Service`, `Providers`, `FeatureRegistry.registerService`, host `FeatureCatalog.services(type)` / `service(type)`; services `ObjectsAt`, `StructureLocator` (`LocateResult`), `SaplingGrowth`, `Loot`, `BlockDrops`, `EntitySpawns`; values `ItemDrop`, `EntitySpec`, `ItemRegistry` (`PackResources.items()`) |
|
||||
| Host questions answered by modules | `@Service`, `Providers`, `FeatureRegistry.registerService`, host `FeatureCatalog.services(type)` / `service(type)`; services `ObjectsAt`, `StructureLocator` (`LocateResult`), `SaplingGrowth`, `Loot`, `BlockDrops`, `EntitySpawns`, `CaveBiomes`; values `ItemDrop`, `EntitySpec`, `ItemRegistry` (`PackResources.items()`) |
|
||||
| Terrain and settings sampling | `TerrainSampler`, `BiomeSample`, `TerrainSample`, `FeatureSettings` |
|
||||
| Dense chunk output | `Hunk<T>`, `GenerationContext.hunk`, reference `ArrayHunk<T>` |
|
||||
| Sparse geometry and transforms | `ObjectGenerator`, `GeneratedObject`, `ObjectTransform`, `ObjectTransformer` |
|
||||
|
||||
@@ -974,6 +974,16 @@ from a sapling, which drops a block has. A module answers such questions through
|
||||
host builds its search area from them through the biome tree it owns). `StructureLocator` (`FIRST`): every structure key a module knows, the ones a world places, and the
|
||||
nearest start of one as a `LocateResult` (`Found`, `NotFound`, `SearchLimitReached`; a sealed interface, so callers
|
||||
switch over every outcome). Keys are pack keys as packs write them and match without regard to case.
|
||||
`CaveBiomes` (`ONE`): the pack biome a module puts at a position whatever the regions say (a band of the deep dark,
|
||||
`overriddenBiome`, the height counted above the dimension's bottom) and how deep below the surface a biome's caves begin
|
||||
(`minDepthBelowSurface`). The host owns the 3D biome of a position (its regions, terrain height and the cave biome stream)
|
||||
and asks this only where a module decides; one provider, since two modules could not both decide the biome of one cave.
|
||||
- **Settings that name biomes.** The host owns the biome tree (a region's biomes and their children) and the set of
|
||||
biomes a dimension reaches, and both must include biomes that module settings name: a cave band's biome, the target of a
|
||||
floating island. Settings say so by implementing `LinkedBiomes` (`treeBiomes`, which join a region's tree and so its terrain
|
||||
generators, and `usedBiomes`, which the dimension reaches without joining), instead of the host reading any module's
|
||||
settings class. `usedBiomes` receives the dimension's own settings, since a name may stand for something the dimension
|
||||
declares (a floating island's `carving` is a band id or a biome key).
|
||||
- **Why not per-world provider instances.** A factory per world (`world -> provider`) would let a provider hold its
|
||||
world, but every service method would then hide which world it answers for, and a host could not ask a pack-level
|
||||
question without a world. Passing the world keeps providers stateless like stage bodies and puts all per-world data
|
||||
|
||||
@@ -295,6 +295,7 @@ final class RuinsObjects implements ObjectsAt {
|
||||
| `Loot` | `ALL` | The loot tables a container draws from at a `Site` (`Table` of the pack, `PlatformTable` with the seed to draw it with), in the order their items are added, and the `ItemDrop`s one table gives there. The host puts them together, tells listeners, creates the stacks and shuffles the container. |
|
||||
| `BlockDrops` | `ALL` | What a module drops for a broken block: `ItemDrop`s, and whether the platform's own drops of the block are replaced. |
|
||||
| `EntitySpawns` | `ALL` | A `Plan` of entities to spawn in a chunk or at a marker, each `Attempt` an `EntitySpec` with the block, light range and surface it needs; how many appeared (`spawned`); what a marker means (`MarkerRule`); one entity of the pack on request. The host checks light, surface and free space, spawns, and applies the spec. |
|
||||
| `CaveBiomes` | `ONE` | The pack biome a module puts at a position whatever the regions say (a band of the deep dark), and how far below the surface a biome's caves begin. The host places the cave biome of a position itself and asks this where a module overrides it. |
|
||||
| `VanillaStructures` | `ALL` | Rules, starts, shifts and reaches for the platform's own structures, and fitting the terrain to the starts in one chunk through the `BlockAccess` the host hands over (see Vanilla structures). |
|
||||
|
||||
```
|
||||
@@ -429,6 +430,12 @@ public final class FloraSettings implements IrisFeature {
|
||||
(nothing could set another), or the load fails. There is no second form: the studio schema renders one shape and a
|
||||
wrong shape fails with a message naming the key and the file.
|
||||
- Options keep the order the class declares them in, a superclass's first.
|
||||
- Settings that bring other pack biomes into the pack's layout implement `LinkedBiomes`: `treeBiomes()` are biomes that join the
|
||||
biome tree of every region the owner is in (the host registers their terrain generators with the region, as it does an
|
||||
owner's children), and `usedBiomes(dimension)` are biomes the settings use besides, which the dimension reaches so their
|
||||
objects, decorators and settings take part in generation. `dimension` is the settings the owner's dimension declares, for
|
||||
settings that name something the dimension declares, such as a band of its caves. The host asks every dimension and biome
|
||||
it reaches and ignores blank keys and keys naming no biome.
|
||||
- Built-in settings may hold classes the host describes itself, such as Iris's palettes, which the host
|
||||
names with `ModuleHost.describingHostTypesIn(...)`. They appear as `HostKind` and pack modules cannot
|
||||
use them.
|
||||
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.volmit.config;
|
||||
|
||||
import com.volmit.IrisFeature;
|
||||
|
||||
import java.util.Collection;
|
||||
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.
|
||||
*/
|
||||
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.
|
||||
*/
|
||||
default Set<String> treeBiomes() {
|
||||
return Set.of();
|
||||
}
|
||||
|
||||
/**
|
||||
* 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 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) {
|
||||
return Set.of();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.volmit.service;
|
||||
|
||||
import com.volmit.world.PackWorld;
|
||||
import java.util.Optional;
|
||||
|
||||
/**
|
||||
* Which biome a module puts underground. The host places the cave biome of a position itself, from the biome its regions give
|
||||
* the column and its terrain; this service tells it where a module overrides that and where a cave biome gives way to the
|
||||
* surface's. A pack has one provider, since two modules deciding the biome of the same cave could not both be right.
|
||||
*/
|
||||
@Service(Providers.ONE)
|
||||
public interface CaveBiomes {
|
||||
/**
|
||||
* The pack biome the module puts at the position whatever the regions say, such as a band of the deep dark. Empty where it
|
||||
* overrides nothing.
|
||||
*
|
||||
* @param y the height above the dimension's bottom
|
||||
* @return the biome key as packs write it
|
||||
*/
|
||||
Optional<String> overriddenBiome(PackWorld world, int x, int y, int z);
|
||||
|
||||
/**
|
||||
* How many blocks below the surface a position must lie for the pack biome {@code biomeKey} to be the cave biome there;
|
||||
* nearer the surface the surface's biome is. 0 for a biome that has no such limit.
|
||||
*/
|
||||
int minDepthBelowSurface(PackWorld world, String biomeKey);
|
||||
}
|
||||
Reference in new issue
Block a user