Skip to content

Commit b054f64

Browse files
committed
Add underground water lakes/streams
1 parent 0b5efd6 commit b054f64

5 files changed

Lines changed: 199 additions & 0 deletions

File tree

biomes/abstract/base.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@ features:
2020
- CAVE_GLOW_LICHEN
2121
- TEXTURED_STONE_SLANT
2222
- SPARSE_HORNITOS
23+
- UNDERGROUND_WATER_LAKES
24+
- UNDERGROUND_WATER_STREAMS
2325
- UNDERGROUND_LAVA_LAKES
2426
- UNDERGROUND_LAVA_STREAMS
2527
- CAVE_ENTRANCES
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
id: UNDERGROUND_WATER_LAKES
2+
type: FEATURE
3+
4+
distributor:
5+
type: PADDED_GRID
6+
width: 33
7+
padding: 87
8+
salt: 1146
9+
10+
locator:
11+
type: AND
12+
locators:
13+
- type: RANDOM
14+
amount: 1
15+
height: &range
16+
min: ${meta.yml:deepslate-top} + 5
17+
max: ${meta.yml:ocean-level} - 20
18+
- type: PATTERN
19+
range: *range
20+
pattern:
21+
type: MATCH_SOLID
22+
offset: 0
23+
- type: PATTERN
24+
range: *range
25+
pattern:
26+
type: MATCH_SOLID
27+
offset: 3
28+
- type: PATTERN
29+
range: *range
30+
pattern:
31+
type: MATCH_SOLID
32+
offset: -3
33+
34+
35+
structures:
36+
distribution:
37+
type: CONSTANT
38+
structures: large_underground_water_lake
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
id: UNDERGROUND_WATER_STREAMS
2+
type: FEATURE
3+
4+
distributor:
5+
type: PADDED_GRID
6+
width: 23
7+
padding: 47
8+
salt: 5678
9+
10+
locator:
11+
type: AND
12+
locators:
13+
- type: PATTERN
14+
range: &range
15+
min: ${meta.yml:bottom-y} + 14
16+
max: ${meta.yml:ocean-level} - 20
17+
pattern:
18+
type: MATCH
19+
block: minecraft:air
20+
offset: 1
21+
- type: PATTERN
22+
range: *range
23+
pattern:
24+
type: MATCH_SOLID
25+
offset: 0
26+
- type: PATTERN
27+
range: *range
28+
pattern:
29+
type: MATCH_SOLID
30+
offset: -3
31+
- type: PATTERN
32+
range: *range
33+
pattern:
34+
type: MATCH_SOLID
35+
offset: -5
36+
37+
38+
structures:
39+
distribution:
40+
type: WHITE_NOISE
41+
structures:
42+
- underground_water_stream: 1
43+
- blank: 1
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
num randPrecision = 100;
2+
num radius = 4.5 + randomInt(randPrecision) / randPrecision;
3+
num warp = 3;
4+
num warpFreq = 4;
5+
num squish = 1 + randomInt(randPrecision) / randPrecision;
6+
num radiusSquared = pow(radius, 2);
7+
num yTranslate = 0;
8+
9+
if (!structure(radius, -radius / squish, 0, "is_rock", "NONE") ||
10+
!structure(-radius, -radius / squish, 0, "is_rock", "NONE") ||
11+
!structure(0, -radius / squish, radius, "is_rock", "NONE") ||
12+
!structure(0, -radius / squish, -radius, "is_rock", "NONE")
13+
) fail;
14+
15+
for (num x = -radius - warp; x < radius + warp; x = x + 1) {
16+
for (num y = (-radius - warp) / squish; y < (radius + warp) / squish; y = y + 1) {
17+
for (num z = -radius - warp; z < radius + warp; z = z + 1) {
18+
num warpX = warp * sampler("simplex3",
19+
warpFreq * (x + originX()),
20+
warpFreq * (y + originY() + 1000),
21+
warpFreq * (z + originZ()));
22+
num warpY = warp * sampler("simplex3",
23+
warpFreq * (x + originX()),
24+
warpFreq * (y + originY() + 2000),
25+
warpFreq * (z + originZ()));
26+
num warpZ = warp * sampler("simplex3",
27+
warpFreq * (x + originX()),
28+
warpFreq * (y + originY() + 3000),
29+
warpFreq * (z + originZ()));
30+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < radiusSquared && y < 0) {
31+
str setBlock = "minecraft:stone";
32+
if (originY() < 10) setBlock = "minecraft:deepslate";
33+
if (getBlock(x, y + yTranslate, z) != "minecraft:air") block(x, y + yTranslate, z, setBlock, true);
34+
}
35+
36+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y < 0) {
37+
block(x, y + yTranslate, z, "minecraft:water", true, true);
38+
}
39+
40+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y >= 0) {
41+
block(x, y + yTranslate, z, "minecraft:air", true);
42+
}
43+
}
44+
}
45+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
num randPrecision = 100;
2+
3+
num radius = 4.5 + randomInt(randPrecision) / randPrecision;
4+
num warp = 3;
5+
num warpFreq = 4;
6+
num squish = 1 + randomInt(randPrecision) / randPrecision;
7+
num radiusSquared = pow(radius, 2);
8+
num yTranslate = 0;
9+
10+
num length = 10 + randomInt(12);
11+
12+
// Direction vector
13+
num dx = (randomInt(randPrecision) / randPrecision - 0.5) * 1.5;
14+
num dz = (randomInt(randPrecision) / randPrecision - 0.5) * 1.5;
15+
16+
num mag = sqrt(pow2(dx) + pow2(dz));
17+
dx = dx / mag;
18+
dz = dz / mag;
19+
20+
if (!structure(radius, -radius / squish, 0, "is_rock", "NONE") ||
21+
!structure(-radius, -radius / squish, 0, "is_rock", "NONE") ||
22+
!structure(0, -radius / squish, radius, "is_rock", "NONE") ||
23+
!structure(0, -radius / squish, -radius, "is_rock", "NONE") ||
24+
!structure(dx * (length / 2) + radius, -radius / squish, dz * (length / 2), "is_rock", "NONE") ||
25+
!structure(dx * (length / 2) - radius, -radius / squish, dz * (length / 2), "is_rock", "NONE") ||
26+
!structure(dx * (length / 2), -radius / squish, dz * (length / 2) + radius, "is_rock", "NONE") ||
27+
!structure(dx * (length / 2), -radius / squish, dz * (length / 2) - radius, "is_rock", "NONE") ||
28+
!structure(dx * (-length / 2) + radius, -radius / squish, (dz * (-length / 2)), "is_rock", "NONE") ||
29+
!structure(dx * (-length / 2) - radius, -radius / squish, (dz * (-length / 2)), "is_rock", "NONE") ||
30+
!structure(dx * (-length / 2), -radius / squish, (dz * (-length / 2) + radius), "is_rock", "NONE") ||
31+
!structure(dx * (-length / 2), -radius / squish, (dz * (-length / 2) - radius), "is_rock", "NONE")
32+
) fail;
33+
34+
for(num l = -length/2; l < length/2; l = l + 1) {
35+
num xOffset = dx * l;
36+
num zOffset = dz * l;
37+
38+
for (num x = -radius - warp; x < radius + warp; x = x + 1) {
39+
for (num y = (-radius - warp) / squish; y < (radius + warp) / squish; y = y + 1) {
40+
for (num z = -radius - warp; z < radius + warp; z = z + 1) {
41+
num warpX = warp * sampler("simplex3",
42+
warpFreq * (x + originX()),
43+
warpFreq * (y + originY() + 1000),
44+
warpFreq * (z + originZ()));
45+
num warpY = warp * sampler("simplex3",
46+
warpFreq * (x + originX()),
47+
warpFreq * (y + originY() + 2000),
48+
warpFreq * (z + originZ()));
49+
num warpZ = warp * sampler("simplex3",
50+
warpFreq * (x + originX()),
51+
warpFreq * (y + originY() + 3000),
52+
warpFreq * (z + originZ()));
53+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < radiusSquared && y < 0) {
54+
str setBlock = "minecraft:stone";
55+
if (originY() < 10) setBlock = "minecraft:deepslate";
56+
if (getBlock(x + xOffset, y + yTranslate, z + zOffset) != "minecraft:air" &&
57+
getBlock(x + xOffset, y + yTranslate, z + zOffset) != "minecraft:water") block(x + xOffset, y + yTranslate, z + zOffset, setBlock, true);
58+
}
59+
60+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y < 0) {
61+
block(x + xOffset, y + yTranslate, z + zOffset, "minecraft:water", true, true);
62+
}
63+
64+
if (pow(x + warpX, 2) + pow((y + warpY) * squish, 2) + pow(z + warpZ, 2) < (radiusSquared - 15) && y >= 0) {
65+
block(x + xOffset, y + yTranslate, z + zOffset, "minecraft:air", true);
66+
}
67+
}
68+
}
69+
}
70+
}
71+

0 commit comments

Comments
 (0)