Skip to content

Commit 3abb4ca

Browse files
committed
Added example for vanilla noise settings
- very large and very small values are now shown in scientific notation
1 parent fabc2d8 commit 3abb4ca

32 files changed

+2851
-34
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ target/
66
*.iml
77

88
# Compiler test
9-
!test/target/
9+
!example/**/target/

README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ density_function_lang.exe main.densityfunction --target-dir target
77
```
88

99
## Examples
10-
See [test/main.densityfunction](test/main.densityfunction).
10+
See [test/main.densityfunction](example/df/main.densityfunction).

test/main.densityfunction renamed to example/df/main.densityfunction

+2-6
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ export zero = 0.0;
99
module overworld {
1010
export base_3d_noise = old_blended_noise(0.25, 0.125, 80.0, 160.0, 8.0);
1111

12-
export continents = flat_cache(shifted_noise("minecraft:shift_x", 0.0, "minecraft:shift_z", 0.25, 0.0, "minecraft:continentalness"));
12+
export continents = flat_cache(shifted_noise("minecraft:continentalness", "minecraft:shift_x", 0.0, "minecraft:shift_z", 0.25, 0.0));
1313
export depth = y_clamped_gradient(-64, 320, 1.5, -1.5) + "minecraft:overworld/offset";
14-
export erosion = flat_cache(shifted_noise("minecraft:shift_x", 0.0, "minecraft:shift_z", 0.25, 0.0, "minecraft:erosion"));
14+
export erosion = flat_cache(shifted_noise("minecraft:erosion", "minecraft:shift_x", 0.0, "minecraft:shift_z", 0.25, 0.0));
1515

1616
include "offset_factor_jaggedness.densityfunction";
1717

@@ -33,10 +33,6 @@ module overworld {
3333
)
3434
}
3535

36-
template apply_surface_slides(input) {
37-
apply_slides(input, -64, 384, 80, 64, -0.078125, 0, 24, 0.1171875)
38-
}
39-
4036
template initial_density(factor, depth) {
4137
4.0 * (depth * factor).quarter_negative()
4238
}

test/minecraft.densityfunction renamed to example/df/minecraft.densityfunction

+7-3
Original file line numberDiff line numberDiff line change
@@ -116,12 +116,12 @@ module df {
116116
template shift_a(arg) { simple_1("minecraft:shift_a", arg) }
117117
template shift_b(arg) { simple_1("minecraft:shift_b", arg) }
118118

119-
template shifted_noise(shift_x, shift_y, shift_z, scale_xz, scale_y, noise) {
119+
template shifted_noise(noise, shift_x, shift_y, shift_z, scale_xz, scale_y) {
120120
{
121121
"type": "minecraft:shifted_noise",
122+
"noise": noise,
122123
"shift_x": shift_x, "shift_y": shift_y, "shift_z": shift_z,
123-
"xz_scale": scale_xz, "y_scale": scale_y,
124-
"noise": noise
124+
"xz_scale": scale_xz, "y_scale": scale_y
125125
}
126126
}
127127

@@ -222,6 +222,10 @@ module df {
222222
)
223223
}
224224

225+
template apply_surface_slides(input) {
226+
apply_slides(input, -64, 384, 80, 64, -0.078125, 0, 24, 0.1171875)
227+
}
228+
225229
module impl {
226230
template lerp_const_start(delta, start, end) { // Requires start to be a constant number
227231
// if (start == 0.0) {

test/target/overworld/continents.json renamed to example/df/target/overworld/continents.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"type": "minecraft:flat_cache",
33
"argument": {
44
"type": "minecraft:shifted_noise",
5+
"noise": "minecraft:continentalness",
56
"shift_x": "minecraft:shift_x",
67
"shift_y": 0.0,
78
"shift_z": "minecraft:shift_z",
89
"xz_scale": 0.25,
9-
"y_scale": 0.0,
10-
"noise": "minecraft:continentalness"
10+
"y_scale": 0.0
1111
}
1212
}

test/target/overworld/erosion.json renamed to example/df/target/overworld/erosion.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,11 @@
22
"type": "minecraft:flat_cache",
33
"argument": {
44
"type": "minecraft:shifted_noise",
5+
"noise": "minecraft:erosion",
56
"shift_x": "minecraft:shift_x",
67
"shift_y": 0.0,
78
"shift_z": "minecraft:shift_z",
89
"xz_scale": 0.25,
9-
"y_scale": 0.0,
10-
"noise": "minecraft:erosion"
10+
"y_scale": 0.0
1111
}
1212
}

test/target/overworld/offset.json renamed to example/df/target/overworld/offset.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -127,12 +127,12 @@
127127
{
128128
"derivative": 0.0,
129129
"location": 0.5954547,
130-
"value": 0.000000029802322
130+
"value": 2.9802322E-8
131131
},
132132
{
133133
"derivative": 0.2534563,
134134
"location": 0.6054547,
135-
"value": 0.000000029802322
135+
"value": 2.9802322E-8
136136
},
137137
{
138138
"derivative": 0.2534563,
@@ -349,12 +349,12 @@
349349
{
350350
"derivative": 0.0,
351351
"location": 0.5954547,
352-
"value": 0.000000029802322
352+
"value": 2.9802322E-8
353353
},
354354
{
355355
"derivative": 0.2534563,
356356
"location": 0.6054547,
357-
"value": 0.000000029802322
357+
"value": 2.9802322E-8
358358
},
359359
{
360360
"derivative": 0.2534563,
@@ -571,12 +571,12 @@
571571
{
572572
"derivative": 0.0,
573573
"location": 0.5954547,
574-
"value": 0.000000029802322
574+
"value": 2.9802322E-8
575575
},
576576
{
577577
"derivative": 0.2534563,
578578
"location": 0.6054547,
579-
"value": 0.000000029802322
579+
"value": 2.9802322E-8
580580
},
581581
{
582582
"derivative": 0.2534563,
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"type": "minecraft:flat_cache",
3+
"argument": {
4+
"type": "minecraft:shifted_noise",
5+
"noise": "minecraft:shift_x",
6+
"shift_x": 0.0,
7+
"shift_y": "minecraft:shift_z",
8+
"shift_z": 0.25,
9+
"xz_scale": 0.0,
10+
"y_scale": "minecraft:ridge"
11+
}
12+
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)