RegionIO/internal/worldgen/features_cannot_replace.go
Daniar Mannanov 790d7e3144 world: replay stage-3 monster rooms
Ports MonsterRoomFeature from bytecode with vanilla draw order and loop
structure: shell validation (solid floor and ceiling, one to five open
side columns), interior cave_air carving, cobblestone walls with the
mossy three-in-four floor roll drawn only where vanilla draws it, chest
placement faced away from its single opaque neighbour with the loot-seed
long consumed even though block entities are not modelled yet, and the
spawner's one-draw mob pick. Writes go through Feature.safeSetBlock
semantics against #minecraft:features_cannot_replace, captured verbatim
from the jar into the embedded datapack data.

The pass slots between geodes and the ores so the rooms' cave_air
pockets exist before ore ellipsoids roll their air-exposure discards.
The committed fixture's four chunks happen to contain no dungeons, so
measured parity holds at 98.028%, but the generator's output can differ
elsewhere: generatorVersion bumps to 22.
2026-08-26 02:49:33 +03:00

26 lines
743 B
Go

package worldgen
import (
_ "embed"
"encoding/json"
)
// features_cannot_replace.json is #minecraft:features_cannot_replace, captured
// verbatim from the 26.1.2 server jar. Features guard their writes through
// Feature.safeSetBlock with this tag: an existing state in the tag stays, an
// existing state outside it may be replaced.
//
//go:embed data/tag/features_cannot_replace.json
var featuresCannotReplaceJSON []byte
// FeaturesCannotReplace returns the block names in
// #minecraft:features_cannot_replace.
func FeaturesCannotReplace() ([]string, error) {
var doc struct {
Values []string `json:"values"`
}
if err := json.Unmarshal(featuresCannotReplaceJSON, &doc); err != nil {
return nil, err
}
return doc.Values, nil
}