#11 Generate amethyst geodes naturally

This commit is contained in:
kay27 2022-02-05 05:34:59 +04:00
parent 6be95762bc
commit 1a78fde1a0
3 changed files with 22 additions and 5 deletions

View File

@ -2,14 +2,18 @@ local radius_min = 3
local radius_max = mcl_mapgen.HALF_BS
local layers = {
{
[100] = "mcl_core:andesite",
[100] = "mcl_blackstone:basalt_polished",
},
{
[100] = "mcl_amethyst:calcite",
},
{
[95] = "mcl_amethyst:amethyst_block",
[5] = "mcl_amethyst:budding_amethyst_block",
[85] = "mcl_amethyst:amethyst_block",
[15] = "mcl_amethyst:budding_amethyst_block",
},
{
[98] = "mcl_amethyst:amethyst_block",
[2] = "mcl_amethyst:budding_amethyst_block",
},
{
[100] = "air",
@ -72,3 +76,16 @@ mcl_structures.register_structure({
name = "amethyst_geode",
place_function = place,
})
local decrease_scan_area = 1
local mapblock_opacity_placement_threshold = 0.9
local threshold = math.floor(((mcl_mapgen.BS - 2 * decrease_scan_area)^3) * mapblock_opacity_placement_threshold)
mcl_mapgen.register_mapgen_block(function(minp, maxp, blockseed)
local y = minp.y
if y < 0 then return end
local pr = PseudoRandom(blockseed + 143)
if pr:next(120) ~= 54 then return end
local opacity_counter = #minetest.find_nodes_in_area(vector.add(minp, decrease_scan_area), vector.subtract(maxp, decrease_scan_area), "group:opaque")
if opacity_counter < threshold then return end
place(minp, nil,pr)
end)

View File

@ -19,6 +19,7 @@ minetest.register_node("mcl_amethyst:amethyst_block",{
_doc_items_longdesc = S("The Block of Amethyst is a decoration block creft from amethyst shards."),
})
-- Budding Amethyst block
minetest.register_node("mcl_amethyst:budding_amethyst_block",{
description = S("Budding Amethyst"),
tiles = {"budding_amethyst.png"},
@ -35,7 +36,6 @@ minetest.register_node("mcl_amethyst:budding_amethyst_block",{
stack_max = 64,
_doc_items_longdesc = S("The Budding Amethyst can grow amethyst"),
})
mcl_wip.register_wip_item("mcl_amethyst:budding_amethyst_block")
-- Amethyst Shard
minetest.register_craftitem("mcl_amethyst:amethyst_shard",{

View File

@ -1,5 +1,5 @@
name = mcl_amethyst
author = Emojiminetest
description = Amethyst related stuff for MCL5
depends = mcl_init, mcl_core, mcl_wip, mcl_mapgen, mcl_structures
depends = mcl_init, mcl_core, mcl_wip, mcl_mapgen, mcl_structures, mcl_blackstone
optional_depends = mcl_spyglass, mcl_copper