RegionIO/internal/world/temp_cells_test.go
Daniar Mannanov 120531c13d world: place ruined portal pieces into the region replay
PlaceRuinedPortalPiece runs the template through the decoded processor
stack — positional Legacy streams per cell drive the gold-to-air,
lava-to-magma, netherrack-to-magma and block-age mossiness rolls, the
features-cannot-replace guard skips protected cells, and template lava
stays when it lands in existing lava. Drip columns below the portal
draw from a documented approximation of the shared decoration stream;
spreadNetherrack is not needed for the underground setups.

The placement chain is now proven end to end: chunk (1,0) reproduces
vanilla's saved start (portal_6, CLOCKWISE_90, NONE, air pocket at
(16,12,0)) and the fixture parity ticks up to 98.033% with biomes and
heightmaps still exact. generatorVersion bumps to 23.
2026-08-26 15:26:42 +03:00

54 lines
1.5 KiB
Go

package world
import (
"testing"
"regionio/internal/worldgen"
)
func TestTempPortalCells(t *testing.T) {
od, err := worldgen.LoadOverworldFinalDensity(12345)
if err != nil {
t.Fatal(err)
}
fluidPicker := worldgen.OverworldFluidPicker(od.SeaLevel)
veins := worldgen.NewOreVeinifier(od)
carver, err := worldgen.NewCarver(od, 12345)
if err != nil {
t.Fatal(err)
}
initCarverReplaceable(carver.ReplaceableBlocks())
var chunks []*Chunk
for cx := int32(-1); cx <= 3; cx++ {
for cz := int32(-2); cz <= 2; cz++ {
chunks = append(chunks, generateVanillaWithoutDecoration(od, fluidPicker, veins, carver, 12345, cx, cz))
}
}
region, err := newDecorationRegion(chunks)
if err != nil {
t.Fatal(err)
}
if err := region.replayScheduledOres(od, 12345, 1, 0); err != nil {
t.Fatal(err)
}
chunk := region.chunks[[2]int32{1, 0}]
// Vanilla markers: obsidian (17,13,3) & (21,13,3); gold (19,18,3).
for _, p := range [][3]int{{17, 13, 3}, {21, 13, 3}, {19, 18, 3}, {19, 14, 3}, {20, 15, 3}} {
lx, lz := p[0]-16, p[2]
t.Logf("cell (%d,%d,%d): ours=%s", p[0], p[1], p[2], stateLabel(chunk.GetBlock(lx, p[1], lz)))
}
// Count portal-ish states in the chunk.
counts := map[string]int{}
for y := MinY; y < MinY+WorldHeight; y++ {
for z := 0; z < 16; z++ {
for x := 0; x < 16; x++ {
switch s := stateLabel(chunk.GetBlock(x, y, z)); s {
case "minecraft:obsidian", "minecraft:crying_obsidian", "minecraft:gold_block",
"minecraft:netherrack", "minecraft:magma_block":
counts[s]++
}
}
}
}
t.Logf("portal-ish counts: %v", counts)
}