func (fa *MazeArena) Block(bc coords.Block) mapgen.Block { if bc.X >= 32 || bc.X < -32 || bc.Z >= 128 || bc.Z < -128 || bc.Y < 16 { return mapgen.BLOCK_DIRT } val := noise.Perlin(float64(bc.X)/16, float64(bc.Z)/16, fa.seed) isWall := val-math.Floor(val) < 0.05 if bc.Y == 21 && isWall { return mapgen.BLOCK_SPAWN } if bc.Y < 20 && isWall { return mapgen.BLOCK_STONE } return mapgen.BLOCK_AIR }
func (pa *PerlinArena) heightAt(x, z float64) float64 { quality := 2.0 height := 0.0 for i := 0; i < 4; i++ { height += noise.Perlin(x/quality, z/quality, pa.seed) * quality quality *= 4 } pow := math.Pow max := math.Max abs := math.Abs mult := 0.1 * pow(1.05, max(abs(x)-32, 0)+ max(abs(z)-128, 0)) height = height*mult + float64(coords.ChunkHeight)/2 return height }