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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 1 addition & 1 deletion
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

Lines changed: 2 additions & 6 deletions
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

Lines changed: 7 additions & 3 deletions
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) {

0 commit comments

Comments
 (0)