Commit Graph
65 Commits
Author SHA1 Message Date
piexel ee7bb11790 VanillaStructures service replaces the vanilla structure hook; fit values leave the API
The hook's rule, starts and setup move to a @Service(ALL) VanillaStructures with default methods. adjustment and the
fit value types (VanillaStructureAdjustment, VanillaStructureFit, StructureTerrain, StructureStilts, YBand) are gone:
modules keep their fit vocabulary as settings. New neutral questions: shift (vertical move of a platform start),
reach (how far around its pieces a module changes terrain for a start), beforePieces/afterPieces around the platform
placing a chunk's starts. StructureFit hands a module the chunk's starts (pieces, junctions, processed template cells,
template columns, legacy template air, platform terrain adaptation and step, the start's memo), the chunk's live
blocks as a BlockAccess, the surface heights and the platform's natural block. VanillaStructureStart carries a
StartMemo instead of a fit; the host keeps it with the start's ownership record.
2026-10-10 02:53:51 +02:00
piexel b82c292dcb Settings features declare a short JSON key and may declare a root option
@Feature(key) is required: a plain field name, unique per target across all
modules and the host's own JSON fields (ModuleHost.reservingFields, back for
keys). A clash refuses the pack load naming the key, the target and both
claimants. @Feature(root) declares that the JSON under the key is one option's
value, so a settings class has exactly one shape; FeatureSchema carries it.
2026-10-09 23:16:52 +02:00
piexel 1707bb95f6 Merge branch 'wave2/e2' 2026-10-09 22:33:28 +02:00
piexel de35bbedb6 Merge branch 'wave2/d' 2026-10-09 22:33:28 +02:00
piexel 140df97040 Merge branch 'wave2/e1' 2026-10-09 22:33:28 +02:00
piexel 3633c105b4 Document the loot, drop, entity and sapling services and the item and entity values 2026-10-09 22:26:05 +02:00
piexel 93f1768174 Add the EntitySpawns service and EntitySpec 2026-10-09 22:16:35 +02:00
piexel 94be126d25 Document the vanilla structure hook's starts, adjustments and setup
README (the three methods, an example start, the fit value types, the new Reference kinds), DESIGN (why starts are
a hook method, why the platform's own starts get a second per-structure method, fit values as value types, setup
before a world exists), CONTRACTS (types, adapter requirements; the planner item leaves Open).
2026-10-09 22:07:29 +02:00
piexel 27ffdb08bd Add the SaplingGrowth service 2026-10-09 22:05:41 +02:00
piexel ad581be494 Add ItemDrop, ItemRegistry and the Loot and BlockDrops services 2026-10-09 22:02:47 +02:00
piexel ba96e0cbc2 ObjectsAt.placedBy: the biomes and regions whose settings place an object 2026-10-09 20:51:05 +02:00
piexel c90ce5ce47 Vanilla structure hook: starts, adjustments and setup, with the fit value types they carry
VanillaStructureHook gains three default methods: starts(chunkX, chunkZ, context) for the platform
structures a module starts itself, adjustment(structure, underground, context) for what it changes
about the platform's own starts, and setup(context) for structure set frequencies and protecting the
platform's own definitions from installed data packs. Values: VanillaStructureStart,
VanillaStructureStartContext, VanillaStructureFit, VanillaStructureAdjustment, VanillaStructureSetup,
and the settings-shaped StructureTerrain, StructureStilts, YBand and JigsawOverrides with the JSON
Iris already reads. Reference gains STRUCTURE_PREFIX and STRUCTURE_SET.
2026-10-09 20:50:59 +02:00
piexel 668d46bd91 Let built-in modules describe the classes Iris's own classes hold (registerHeldType) 2026-10-09 20:46:24 +02:00
piexel 46676fd99b Fix the ModuleHost javadoc after the removal of reserved fields 2026-10-09 20:34:29 +02:00
piexel 435d3798fd Add PaletteSpec, PaletteSampler and BlockRegistry.palette 2026-10-09 20:28:54 +02:00
piexel 0f05676b7a Add @MinItems for list, set and array options and describe it in the pack schema 2026-10-09 20:26:31 +02:00
piexel 3c05cfea0a Add the warmUp lifecycle hook and LifecycleRunner.warmUp 2026-10-09 20:22:29 +02:00
piexel f6c078aade Remove feature aliases, the one-option shorthand and reserved host fields
A setting has one JSON key, its feature id, and one shape, its settings object.
Aliases were the only reason for reserved host fields (ids contain ':', host
fields never do), so ModuleHost.reservingFields goes too.
2026-10-09 20:19:08 +02:00
piexel 99a914633d Merge wave1/a2 2026-10-09 14:44:29 +02:00
piexel adb848bf9f Merge wave1/a1 2026-10-09 14:43:33 +02:00
piexel b808f610c6 Merge wave1/b 2026-10-09 14:43:33 +02:00
piexel 20d504bd28 Say that a missing image map fails noise building, as Iris's image noise does, instead of falling back 2026-10-09 14:42:33 +02:00
piexel b20a3cf719 Give modules per-world state, lifecycle hooks and services: PackWorld with its state store, InvocationContext.world(), ModuleLifecycle, @Service with Providers ALL, FIRST and ONE, ObjectsAt and StructureLocator, and the host's WorldStates, LifecycleRunner and catalog lookups 2026-10-09 14:32:54 +02:00
piexel 84969c74bd Add value types for settings (BlockSpec, NoiseStyle, StyledRange, Range, BlockPosition, Object as any JSON), host-built noise through PackResources.noise(), and VanillaStructureHook for the platform's own structures 2026-10-09 14:20:10 +02:00
piexel 42d31a9ce4 Stop reserving namespaces, let a jar list several modules and add ModuleJarCheck for builds that write module jars
ReservedNamespaces and ModuleHost.reservingNamespaces are gone: a pack module may use any
namespace, iris included. A module id is still loaded once, and the duplicate error now names
the origin and class of both modules, so two modules of one jar can be told apart.

A jar lists one module class per line in META-INF/services/com.volmit.IrisModule and loads all
of them in that order; each class must still be defined in the jar. A jar with several modules
is excused by the optional packages of all of them.

ModuleJarCheck runs the load's class checks on one jar without loading it.
2026-10-09 14:08:33 +02:00
piexel ef4b640867 Let modules declare pack resource kinds and validators: ResourceKind, PackResources.ids, @ResourceRef, the validation API and folders the host reserves 2026-10-08 20:36:10 +02:00
piexel 09afee8ae3 Make Y the height above the dimension's bottom everywhere in the API: document it, and drop GenerationContext.originY, which is always 0 now 2026-10-08 14:50:04 +02:00
piexel 33fc9adca9 Add PackBiome and PackRegion so modules can look up pack biomes and regions through PackResources 2026-10-08 13:34:26 +02:00
piexel 50f51db8b2 Run each mantle stage as its own pass and let mantle stages work out their reach per pack
MantleRunner.generate(stage, inputs, seed) runs one mantle stage for one chunk. The host runs every
mantle stage as its own pass in resolved order, so a stage sees what earlier stages wrote into the
chunks around it. Activation still follows requires(...): the runner collects the settings of the stage
and of everything it requires, and only those. Because the stages of one chunk now run in different
invocations, mantle stages have no output (Stage.mantle declares Void) and pass data on through
mantle layers.

A mantle stage whose reach depends on the pack declares reach(PackReach). The host works it out once
per pack load from PackSettings, every entry the dimension and its regions and biomes declare, with
ResolvedStage.reachBlocks(settings); a negative result fails naming the stage. Placement and chunk
stages may not declare one, and ResolvedGraph.reach() throws for a mantle pipeline that has one.
VeinModule now sizes its reach from the pack's longest vein.
2026-10-08 12:35:04 +02:00
piexel 97ac2a2982 Read settings per column with every level as its own entry, add the mantle pipeline, host types and the one-option shorthand
Settings no longer resolve to one value per type. FeatureSettings.at(type, x, z) returns one entry per
level that declares the type at that column (dimension, region, surface biome, placement), each with
its level, source and value; levels stack and a module decides what several mean. Conditional stage
bodies receive every configured entry. Chunk and mantle runners collect a chunk's settings themselves,
so a stage runs when any column of the chunk configures it.

Work that writes the mantle or reaches beyond its chunk moves to a new MANTLE pipeline (Stage.mantle,
MantleRunner) that the host runs around a chunk before it generates. Chunk stages may no longer declare
a reach or mantle writes and see the mantle read-only.

Built-in settings may hold host types the host describes itself (ModuleHost.describingHostTypesIn,
ValueKind.HostKind); pack modules cannot. FeatureSchema.shorthand() names the only option of settings
packs may write as a bare value.
2026-10-08 11:31:03 +02:00
piexel 09df1af88e Add BlockState.parse, the inverse of key(), for hosts that read block states from JSON 2026-10-06 14:07:32 +02:00
piexel c5a54558fa Let the host choose the jar copy directory and the logger of pack loads
ModuleHost.copyingJarsTo(directory) and loggingTo(logger) replace the fixed
java.io.tmpdir and System.getLogger. A System.LoggerFinder would not work
for a plugin, whose classes are not on the system class loader.
2026-10-06 14:04:11 +02:00
piexel a325640d5d Key settings by feature id, order options as declared and declare stage reach
- Packs write settings under the feature id. @Feature(field) becomes an
  optional alias that only built-in modules may set, so existing pack JSON
  keeps loading; a pack module setting one fails the load. Reserved host
  fields now only constrain aliases. FeatureSchema exposes key and alias.
- Pack snippet names live under their module's folder
  (snippet/<namespace>/<path>/...); snippet names are folder paths.
- OptionsMetadata lists options in declaration order, read from the class
  file, a superclass's first.
- @Ref(PACK_BIOME|PACK_REGION|PACK_OBJECT) fits String only.
- Stage definitions declare reach(blocks) and writesMantle(layers);
  ResolvedGraph.reach() collects the pipeline and per-layer maximum, and
  the load fails on an unregistered or mistyped layer.
2026-10-06 13:59:28 +02:00
piexel b12e7a8c49 Document how modules describe settings for studio and what the host renders 2026-10-06 12:17:04 +02:00
piexel 3465f8d390 Describe module settings for studio as LoadedPack.schema()
PackSchema (com.volmit.host.schema) is a JSON-free description of every catalogued
settings type: features with their module, JSON field and targets, every reachable
class once by name (cycles end at the name), options with value kind, description,
required, bounds, defaults read from a no-argument instance and @Ref references,
plus object generator settings and snippets. Everything is in a fixed order.

The pack load fails, naming class, field and module, on unsupported field types,
@Ref on fields that are not text, classes without a working no-argument constructor
and snippet names that are not folder names or are used twice. GrassSettings.block
becomes a BlockState, a block reference without @Ref.
2026-10-06 12:14:34 +02:00
piexel 93c755ffe4 Add FeatureRegistry.registerSettings and the @Ref annotation for value references
Modules register settings types that no stage names in when(...) explicitly; the
id must be the module's id or below it, and repeating it or also naming the type
in when(...) changes nothing. A type its owner registered may be named by any
module. OptionsMetadata.Option now carries its field and @Ref reference.
2026-10-06 12:06:46 +02:00
piexel 8b7accd19d Add WorldRandom.pick and shuffle so stages need no JDK random APIs
pick(items) is items.get(nextInt(items.size())) and throws on an empty
list. shuffle(items) is Fisher-Yates from the last index down, swapping
i with nextInt(i + 1). RandomAccess lists swap through List.set; other
lists are shuffled in an array copy and written back through their
ListIterator, with the same result. Both are pinned to the Python
reference, including draw counts.
2026-10-06 11:48:44 +02:00
piexel 525c372fc5 Document WorldRandom, id ownership for feature ids and mantle keys, and accumulating ModuleHost
DESIGN describes WorldRandom's algorithms per method, why it does not
implement RandomGenerator, why StrictMath suffices for the gaussian and how
the pinned values are produced. README and CONTRACTS name it as the
generator stages and object generators see. The namespace rule now reads
that feature ids and mantle keys are the module id or below it, with the
new error text, and ModuleHost's methods are documented to accumulate.
2026-10-06 11:37:24 +02:00
piexel 1ce0a19abb Give stages WorldRandom, a SplitMix64 generator whose every method IrisApi defines
java.util.Random fixes only some of its methods; the ranged RandomGenerator
defaults module authors reach for are left to the JDK, so an update could
change existing worlds. WorldRandom does not implement RandomGenerator and
exposes a curated set (ints, longs, ranges, booleans, floats, doubles,
gaussian, chance) with Lemire bounds and the polar gaussian on StrictMath.
StageContext, ObjectGenerationContext and BlockPalette now use it.

StageRandom becomes StageStreams; the seed derivation is unchanged. Every
method is pinned to values from an independent Python reference in
src/test/reference.
2026-10-06 11:36:13 +02:00
piexel d5aad57ad9 Require object feature ids, mantle keys and settings ids to be the owning module's id or below it
Object feature ids and mantle keys a module registers must now equal its
module id or start with it and '/', the rule stage ids already follow,
instead of only sharing its namespace. A settings type named in when(...)
needs a feature id that at least one module naming it owns in the same
sense, so another module may still condition on it, as moss can on
iris:snow. ModuleInfo.ownsId states the rule; stageIdPrefix becomes
idPrefix since it now prefixes more than stages. Errors name the module
and its origin and suggest an owned id.
2026-10-05 22:15:59 +02:00
piexel 77e4ab4710 Make ModuleHost.reservingFields add to earlier reservations and check field names when built
reservingFields replaced the reserved fields, unlike exposing and
reservingNamespaces, which add. It now merges the given names per
attachment target with those reserved before, so every ModuleHost method
accumulates. Blank field names now fail when the host configuration is
built, like invalid packages and namespaces, instead of at the first
pack load.
2026-10-05 22:14:06 +02:00
piexel 1df8bb3808 Document per-stage random streams, namespace ownership, LoadedPack and jar copies
README, DESIGN and CONTRACTS now describe: the per-stage random stream
contract and why java.util.Random; module-prefixed stage ids, module ids
without '/', reserved namespaces and settings/registration namespaces;
info() read once; LoadedPack and ModuleHost as the host entry point; and
loading from temporary jar copies with stale-copy cleanup.
2026-10-05 21:40:37 +02:00
piexel 333e2f6459 Load pack modules from temporary copies so the original jars stay unlocked
PackModules copies the pack's jars into a fresh iris-pack-modules-*
directory and reads, checks and defines classes from the copies only, so
a load sees one consistent snapshot and the pack class loader never holds
the originals open (on Windows that locked them against rebuilding).
Copies are deleted when the pack closes (after its loader) and on any
load failure. Messages and origins keep naming modules/<jar>, including
an entry class found in another jar of the pack.

Each copy directory holds an owner file with the creating process id. A
later load removes directories whose owner process has exited and that
hold only that file and jars; everything else is left alone.
2026-10-05 21:38:54 +02:00
piexel fe51496ab0 Add LoadedPack and ModuleHost as the host's single entry point for a pack
ModuleHost holds what the host passes to every pack load: built-in
modules (info read once), exposed host packages, reserved JSON fields and
reserved namespaces, validated when built. LoadedPack.load(packRoot, host)
loads the pack's jars, installs them with the built-ins and resolves both
pipelines; on any failure it closes the pack before rethrowing, and
close() releases the pack's class loader. PackModules and LoadedModules
stay available as the lower-level pieces.
2026-10-05 21:35:52 +02:00
piexel 307e488d1a Give every stage its own random stream derived from the invocation seed and stage id
Stages no longer share one RandomGenerator. StageContext.random() is the
running stage's own stream: java.util.Random seeded with
mix(mix(invocationSeed) ^ fnv1a64(utf8(stageId))), mix being the
SplitMix64 finalizer. Adding, removing or reordering modules, or how much
other stages draw, no longer changes a stage's draws. A block stage keeps
one stream across the blocks of its pass.

The host passes a long invocation seed to PlacementRunner.place and
ChunkRunner.generate instead of a RandomGenerator on the inputs;
InvocationContext loses random(), so stages cannot reach a shared stream.
ObjectGenerationContext keeps its own random() for geometry generators.
StageRandom documents the derivation, and a test pins it to values
computed from the specification.
2026-10-05 21:34:19 +02:00
piexel 4cb718f706 Enforce namespace ownership: reserved namespaces and module-prefixed stage ids
- LoadedModules.load takes the host's reserved namespaces (such as iris);
  a pack module whose id uses one fails, naming its jar and the namespace.
- A module defines only stages whose ids start with its own id and '/'.
  Module ids may no longer contain '/', so ids cannot nest and every
  stage id has exactly one possible owner.
- Object feature ids and mantle keys must use the registering module's
  namespace; ModuleRegistry.register(DiscoveredModule) scopes registration.
- A settings type named in when(...) needs a feature id in the namespace
  of some module naming it, so modules can still condition on another
  module's settings.
2026-10-05 21:31:55 +02:00
piexel 6263075ecd Read module info once at discovery and keep it in DiscoveredModule
DiscoveredModule is now a final class holding the module, the ModuleInfo
read when the module was found (pack jar or builtIn) and its origin.
Graph install, load errors, the pack summary and optional-package
filtering use only that stored value.
2026-10-05 21:26:35 +02:00
piexel f5cf4b3ab6 Document the non-exported JDK package error and sun.misc.Unsafe
DESIGN gains the export row at the top of the class check table, why it
comes first, how --add-exports ...=ALL-UNNAMED is honoured and that
qualified exports do not count. CONTRACTS and README name sun.misc.Unsafe
from jdk.unsupported as the supported route, README shows the new error
group and the addExportsTest task.
2026-10-05 21:11:44 +02:00
piexel f6b08a0303 Fail the load when a module uses a JDK package that is not exported to it
A class such as jdk.internal.misc.Unsafe passed the reference check,
because the platform loader finds it, but java.base does not export
jdk.internal.misc to unnamed modules, so the module failed with an
IllegalAccessError once the code ran. It is now a load error with its
own group:

  Module jar modules/user.jar uses classes of JDK packages that are not exported to modules:
    pack.user.User -> jdk.internal.misc.Unsafe (package jdk.internal.misc of java.base is not exported)
  Use the supported alternative where there is one, such as sun.misc.Unsafe from jdk.unsupported
  instead of jdk.internal.misc.Unsafe. Otherwise the server must be started with
  --add-exports <module>/<package>=ALL-UNNAMED.

NonExportedJdkPackages asks the boot layer's platform and boot loader
modules whether they export each package to an unnamed module that no
export names, so qualified exports do not count and a server started
with --add-exports <module>/<package>=ALL-UNNAMED passes, as it would at
run time. Nothing is loaded. sun.misc (jdk.unsupported) and java.lang
stay usable. The check runs first among classes outside the pack: the
module decides access whichever loader finds the class.

The --add-exports case runs in its own JVM, the addExportsTest task
(tag jdk-add-exports), which check depends on; the other tests run
without the flag. TestModuleJar can pass --add-exports to javac.
2026-10-05 21:10:53 +02:00
piexel e34acf2fbb Document optional packages and the unavailable-JDK-module error
README, DESIGN and CONTRACTS describe how a module declares optional
packages in info() (with an example), that they cover only its own jar
and never excuse a load error, why missingClasses() drops excused
classes, and the new error for classes of JDK modules outside the
platform class loader, including the check order and that one error
groups every kind of unusable class.
2026-10-05 21:01:34 +02:00