diff --git a/mc/gen/biome_noise.go b/mc/gen/biome_noise.go index 6bea5c1..c15dce8 100644 --- a/mc/gen/biome_noise.go +++ b/mc/gen/biome_noise.go @@ -1,5 +1,7 @@ package gen +import "math" + type NoiseParam int const ( @@ -54,6 +56,10 @@ func BiomeNoiseFromXoroshiro(x Xoroshiro, large bool) (v BiomeNoise) { return } +func peaksAndValleys(weirdness float64) float64 { + return -(math.Abs(math.Abs(weirdness)-0.6666667) - 0.33333334) * 3.0 +} + func (b BiomeNoise) Sample(x, y, z int) (t, h, c, e, d, w float64, combinedData [6]int64, id int) { px := float64(x) pz := float64(z) @@ -66,6 +72,9 @@ func (b BiomeNoise) Sample(x, y, z int) (t, h, c, e, d, w float64, combinedData t = b.Temperature.Sample(px, 0, pz) h = b.Humidity.Sample(px, 0, pz) + off := float64(BiomeDepthSpline.Sample([]float32{float32(c), float32(e), float32(peaksAndValleys(w)), float32(w)})) + 0.015 + d = 1.0 - (float64(y)*4)/128.0 - 83.0/160.0 + off + combinedData = [6]int64{ int64(float32(t) * 10000.0), int64(float32(h) * 10000.0), diff --git a/mc/gen/xoroshiro_test.go b/mc/gen/xoroshiro_test.go index 7803292..bc33882 100644 --- a/mc/gen/xoroshiro_test.go +++ b/mc/gen/xoroshiro_test.go @@ -38,7 +38,7 @@ func TestBiome(t *testing.T) { b := BiomeNoiseFromXoroshiro(x, false) _, _, _, _, _, _, combinedData, _ := b.Sample(-1, -16, 0) - expected := [6]int64{3238, 3521, 2364, 1396, 0, 2202} + expected := [6]int64{3238, 3521, 2364, 1396, 10062, 2202} if combinedData != expected { t.Errorf("combinedData = %v, want %v", combinedData, expected) }