Measure cross-chunk ore replay

This commit is contained in:
Daniar Mannanov 2026-08-11 13:50:14 +03:00
parent 9ffd2b19ba
commit e2f496fafc
3 changed files with 205 additions and 0 deletions

View file

@ -1,5 +1,7 @@
package world
import "fmt"
// decorationSource is a source chunk whose feature pass may inspect or write a
// target chunk. Vanilla FEATURES has a one-chunk block-state write radius.
type decorationSource struct {
@ -19,3 +21,21 @@ func decorationSources(targetX, targetZ int32) []decorationSource {
}
return sources
}
// replayScheduledOres replays each source center in deterministic order into a
// shared region. The region must contain the target's radius-two base terrain;
// source passes themselves may write only within their own radius-one window.
// This is an explicit canonical order for isolated generation. It must not
// replace the production path until parity evidence confirms that it matches
// vanilla's chunk-status scheduling order.
func (r *decorationRegion) replayScheduledOres(seed int64, targetX, targetZ int32) error {
for _, source := range decorationSources(targetX, targetZ) {
if err := r.setSource(source.X, source.Z); err != nil {
return err
}
if err := r.placeScheduledOres(seed); err != nil {
return fmt.Errorf("world: replay source (%d,%d): %w", source.X, source.Z, err)
}
}
return nil
}