Measure the surface water condition against the column's own water

The water condition asked "is this block at or above sea level", which is only
the same question as vanilla's in an ocean. Vanilla asks how far the block sits
below the water directly above it, and there is now water that is nowhere near
y=63: the aquifer puts pools at their own levels, deep underground and up in the
hills. Against sea level every one of those read as dry stone, and the stone
above them read as lakebed.

waterHeight is already tracked down the column, so the condition becomes the
vanilla one: pass when there is no water above at all, otherwise when
blockY (+ stoneDepthAbove where the rule asks for it) clears
waterHeight + offset + surfaceDepth * multiplier. add_stone_depth was parsed and
then ignored; three rules in the overworld tree set it.

NoWaterAbove replaces a bare math.MinInt so a hand-built context cannot default
to "water at y=0" by leaving the field unset.
This commit is contained in:
Master290 2026-07-27 02:05:20 +03:00
parent 21a10ab65e
commit c10719cb78
4 changed files with 98 additions and 18 deletions

View file

@ -32,7 +32,7 @@ const dataVersion26 = 4790
// first time it ran: chunkAt prefers the store over the generator, so the
// already-explored area around spawn keeps its old terrain and every later fix
// looks like it did nothing in exactly the place you are standing.
const generatorVersion = 2
const generatorVersion = 3
// generatorVersionTag is the NBT key holding generatorVersion. It is namespaced
// because it is ours, not part of the vanilla chunk format.

View file

@ -273,18 +273,18 @@ func applySurfaceRule(out *[WorldHeight]uint16, wx, wz, seaLevel, minY int, biom
Rng: colRng,
}
stoneDepthAbove := 0
waterHeight := math.MinInt
waterHeight := worldgen.NoWaterAbove
nextCeilingStoneY := math.MaxInt
for i := top; i >= 0; i-- {
y := minY + i
old := out[i]
if old == StateAir {
stoneDepthAbove = 0
waterHeight = math.MinInt
waterHeight = worldgen.NoWaterAbove
continue
}
if isFluidState(old) {
if waterHeight == math.MinInt {
if waterHeight == worldgen.NoWaterAbove {
waterHeight = y + 1
}
continue