StructureFit.log(): a vanilla structure fit knows the log of the module it was handed to; each provider gets its own fit

This commit is contained in:
piexel committed 2026-10-10 14:25:14 +02:00
1 parent e0ffe04a0d
commit a707b237cf
2 files changed
+10 -4

No files matched your search

+2 -2
View File
@@ -289,8 +289,8 @@ private static void decorate(ChunkStageContext context) {
| `error(message, cause)` | A failure the module caught and cannot recover from. The host logs it and reports `cause` like its own failures. A null `cause` only logs. |
- A message is plain text, never a format string.
- `context.log()` (stage bodies, object generators), `world.log()` (services and lifecycle hooks, which get a world as
their argument) and `registry.log()` (while `register` runs) are the same module's log. Keep the registry's log in a
- `context.log()` (stage bodies, object generators), `fit.log()` (vanilla structure fits), `world.log()` (services and
lifecycle hooks, which get a world as their argument) and `registry.log()` (while `register` runs) are the same module's log. Keep the registry's log in a
field when `packLoaded`, which has no world, needs to log. `registry.log()` outside `register` throws.
- Do not use `System.out`, `System.getLogger` or a logging library of your own: the host cannot label or report them.
@@ -1,5 +1,6 @@
package com.volmit.vanilla;
import com.volmit.ModuleLog;
import com.volmit.block.BlockState;
import com.volmit.mantle.BlockBox;
import com.volmit.resource.ResourceId;
@@ -13,12 +14,17 @@ import java.util.function.Supplier;
/** The starts the platform places in one chunk while it decorates it, and the chunk's blocks, for modules that fit
* those starts into the terrain ({@link com.volmit.service.VanillaStructures#beforePieces},
* {@link com.volmit.service.VanillaStructures#afterPieces}). Heights are above the dimension's bottom (0 = bottom) unless
* a method says otherwise. One fit is handed to every provider for the chunk; it is valid only while they run, on one
* thread.
* a method says otherwise. Each provider gets its own fit of the chunk, over the same blocks and scoped to its module, which
* is valid only while the providers run, on one thread.
*/
public interface StructureFit {
PackWorld world();
/** The log of the module this fit was handed to; the same as {@code world().log()}, which a host overrides where a fit has no world. */
default ModuleLog log() {
return world().log();
}
/** The seed of the platform's world, which the platform's own structure randomness derives from. */
long seed();