Custom Ore Veins

Custom Ore Veins

10k Downloads

[Bug?] Strange generation

Salvard opened this issue ยท 1 comments

commented

Hello,

I'm currently making a personal modpack and I'd like to review the ore generation mechanics using your mod only. But I've come across a bug (or an error on my part) that I can't figure out and it seems to be in the "max_value" and "min_value" of the "toggle".
For the context: I use Kubejs to create the JSONs automatically, I debug with the minimum of enabled mods to avoid possible conflicts (see list at the end) and I always use the same seed.
I also use DeepL for the English translation, sorry...

To begin with, I have completely reworked the toggle's density function in order to generate ores that are better distributed along the x and z axes, while still retaining the notion of a layer via this function:
{ "type": "minecraft:interpolated", "argument": { "type": "minecraft:add", "argument1": { "type": "minecraft:y_clamped_gradient", "from_y": 256, "to_y": -64, "from_value": 0.1, "to_value": -0.1 }, "argument2": { "type": "minecraft:flat_cache", "argument": { "type": "minecraft:noise", "noise": "minecraft:vein_grp_up", "xz_scale": 1, "y_scale": 1 } } } }
With for "minecraft:vein_grp_up":
{ "firstOctave": -8, "amplitudes": [ 0.1 ] }

And to make sure I wasn't making a mistake, I went to Data Pack Generators to visualise the function:
Density Function

To obtain a distribution of this type: (the top corresponds to 256 and the bottom to -64)
Visual Density Function

So the JSON of my vein duo looks like this: (I've set a constant to "ridged" for debugging purposes)
Umbralith : (Black stone)
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_up, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, min_value: -0.05}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: kubejs:umbralith, ore: kubejs:umbralith_hard, raw_ore: kubejs:umbralith_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}
Pronite : (Red stone)
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_up, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, max_value: -0.1}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: kubejs:pronite, ore: kubejs:pronite_hard, raw_ore: kubejs:pronite_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}

But my generation looks like this:
Umbralith_Pronite Nolimit

And when I add a "max_value" and a "min_value" :
Umbralith
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_up, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, min_value: -0.05, max_value: 0.5}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: kubejs:umbralith, ore: kubejs:umbralith_hard, raw_ore: kubejs:umbralith_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}
Pronite
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_up, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, min_value: -0.2, max_value: -0.1}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: kubejs:pronite, ore: kubejs:pronite_hard, raw_ore: kubejs:pronite_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}
Umbralith_Pronite Limit1

But it still gives impossible shapes compared to the "toggle":
Umbralith_Pronite Limit2
Because the "veins" of Pronite should touch the Bedrock

I also have a trio of veins where I've managed to "fix" the problem by adding the "max_value" and a "min_value", but only if I stay between -1 and 1 :
Asurine : (Blue Stone)
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_vca, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, min_value: -0.5, max_value: -0.2}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: create:asurine, ore: create:asurine_hard, raw_ore: create:asurine_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}
VCA Limit

And when I remove the limit:
{dimension: minecraft:overworld, toggle: {density: {type: minecraft:interpolated, argument: {type: minecraft:add, argument1: {type: minecraft:y_clamped_gradient, from_y: 256.0, to_y: -64.0, from_value: 0.1, to_value: -0.1}, argument2: {type: minecraft:flat_cache, argument: {type: minecraft:noise, noise: minecraft:vein_grp_vca, xz_scale: 1.0, y_scale: 1.0}}}}, max_y: 256.0, min_y: -64.0, max_value: -0.2}, ridged: {density: {type: minecraft:interpolated, argument: -0.1}}, stone: create:asurine, ore: create:asurine_hard, raw_ore: create:asurine_hardest, min_ore_chance: 0.25, max_ore_chance: 0.5, raw_ore_chance: 0.1}
VCA NoLimit

So I'd be happy to give you more information if you'd like ๐Ÿ‘
Have a nice evening!


ModList

commented

It doesn't look like your density function imposes a hard limit on "pronite" ores to me, the values can go below -0.1 above Y=0.
f

As to why it doesn't touch the bedrock, it's probably because of your min_y and max_y values. The veins are not cut off abruptly at those coordinates, but they're given a smooth appearance near the limits (particularly in regions with low density), and "near" is defined based on how large the range of Y is. You could lower the min_y even if it's outside the world, and also lower max_y to move the "center". Alternatively, you could add "max_density_intrusion" to the toggle options with a value of 5, to make it so that the veins are only smoothed out within 5 blocks of the limits. If you don't specify it, the value is calculated based on min_y and max_y, which in your case results in 100.
By the way, it's better to specify both min_value and max_value when you use unusual noise or density functions.