- $emit('update:y', y)"
:max="y_limits[1]" :min="y_limits[0]"
diff --git a/src/stores/useLoadedDimensionStore.ts b/src/stores/useLoadedDimensionStore.ts
index 4f3733c..16e7d29 100644
--- a/src/stores/useLoadedDimensionStore.ts
+++ b/src/stores/useLoadedDimensionStore.ts
@@ -209,6 +209,15 @@ export const useLoadedDimensionStore = defineStore('loaded_dimension', () => {
}
})
+ const terrain_density_function = computed(() => {
+ const surface_density_function_id = getCustomDensityFunction("map_simple_terrain", loaded_dimension.noise_settings_id ?? Identifier.create("empty"), settingsStore.dimension)
+ if (surface_density_function_id !== undefined){
+ return new DensityFunction.HolderHolder(Holder.reference(WorldgenRegistries.DENSITY_FUNCTION, surface_density_function_id)).mapAll((random_state.value).createVisitor((noise_generator_settings.value).noise, (noise_generator_settings.value).legacyRandomSource))
+ } else {
+ return undefined
+ }
+ })
+
function getIcon(id: Identifier){
const item = loaded_dimension.structure_icons?.get(id.toString()) ?? Identifier.create(VANILLA_ITEMS[Math.abs(hashCode(id.toString())) % VANILLA_ITEMS.length])
return `https://raw.githubusercontent.com/jacobsjo/mcicons/icons/item/${item.path}.png`
@@ -231,6 +240,6 @@ export const useLoadedDimensionStore = defineStore('loaded_dimension', () => {
return biome_source
}
- return { loaded_dimension, noise_generator_settings, sampler, surface_density_function, reload, getIcon, getBiomeColor, getBiomeSource }
+ return { loaded_dimension, noise_generator_settings, sampler, surface_density_function, terrain_density_function, reload, getIcon, getBiomeColor, getBiomeSource }
})
diff --git a/src/webworker/MultiNoiseCalculator.ts b/src/webworker/MultiNoiseCalculator.ts
index d929bdf..23c3f52 100644
--- a/src/webworker/MultiNoiseCalculator.ts
+++ b/src/webworker/MultiNoiseCalculator.ts
@@ -129,7 +129,7 @@ class MultiNoiseCalculator {
for (let iz = -1; iz < tileSize + 2; iz++) {
const x = ix * step + min_x
const z = iz * step + min_z
- const surface = this.state.surfaceDensityFunction?.compute(DensityFunction.context(x * 4, 0, z * 4)) ?? Number.POSITIVE_INFINITY
+ const surface = this.state.surfaceDensityFunction?.compute(DensityFunction.context(x * 4, this.state.y, z * 4)) ?? Number.POSITIVE_INFINITY
const y = this.state.projectDown ? Math.min(surface, this.state.y) : this.state.y
const biome = this.state.biomeSource?.getBiome(x, y >> 2, z, this.state.sampler!).toString() ?? "minecraft:plains"
const terrain = this.state.terrainDensityFunction?.compute(DensityFunction.context(x * 4, y , z * 4)) ?? Number.POSITIVE_INFINITY