func growTree(chunk *chunk.Chunk, r *rand.Rand, x, y, z int32) { if x&0xF == x && z&0xF == z { return } if x&0xF < 2 || x&0xF > 13 || z&0xF < 2 || z&0xF > 13 { return } chunk.SetBlock(x, y-1, z, block.Dirt) height := r.Int31n(5) + 3 for Y := y; Y < y+height; Y++ { chunk.SetBlock(x, Y, z, block.Log) } for X := x - 2; X <= x+2; X++ { for Z := z - 2; Z <= z+2; Z++ { for Y := y + height - 2; Y <= y+height+2; Y++ { if chunk.GetBlock(X, Y, Z) == block.Air { chunk.SetBlock(X, Y, Z, block.Leaves) } } } } }