More amethyst and ore migration

This commit is contained in:
JoseDouglas26 2024-06-17 08:30:25 -03:00
parent cbed7e4f04
commit 6cd2443913
5 changed files with 83 additions and 223 deletions

View File

@ -1,54 +0,0 @@
local interval = 10
local chance = 5
local function grow(pos, node)
local def = minetest.registered_nodes[node.name]
local next_gen = def._mcl_amethyst_next_grade
if not next_gen then return end
local dir = minetest.wallmounted_to_dir(node.param2)
local ba_pos = vector.add(pos, dir)
local ba_node = minetest.get_node(ba_pos)
if ba_node.name ~= "mcl_amethyst:budding_amethyst_block" then return end
local swap_result = table.copy(node)
swap_result.name = next_gen
minetest.swap_node(pos, swap_result)
end
minetest.register_abm({
label = "Amethyst Bud Growth",
nodenames = {"group:amethyst_buds"},
neighbors = {"mcl_amethyst:budding_amethyst_block"},
interval = interval,
chance = chance,
action = grow,
})
local all_directions = {
vector.new(1, 0, 0),
vector.new(0, 1, 0),
vector.new(0, 0, 1),
vector.new(-1, 0, 0),
vector.new(0, -1, 0),
vector.new(0, 0, -1),
}
minetest.register_abm({
label = "Spawn Amethyst Bud",
nodenames = { "mcl_amethyst:budding_amethyst_block" },
neighbors = { "air", "group:water" },
interval = 34.135, -- 34.135 is 1/2 of 68.27, which is the average time for one bud to grow 1 stage.
chance = 2,
action = function(pos)
local check_pos = vector.add(all_directions[math.random(1, #all_directions)], pos)
local check_node = minetest.get_node(check_pos)
local check_node_name = check_node.name
if check_node_name ~= "air" and minetest.get_item_group(check_node_name, "water") == 0 then
return
end
local param2 = minetest.dir_to_wallmounted(vector.subtract(pos, check_pos))
local new_node = { name = "mcl_amethyst:small_amethyst_bud", param2 = param2 }
minetest.swap_node(check_pos, new_node)
end,
})

View File

@ -1,145 +0,0 @@
local S = minetest.get_translator(minetest.get_current_modname())
local sounds = mcl_sounds.node_sound_glass_defaults({
footstep = {name = "mcl_amethyst_amethyst_walk", gain = 0.4},
dug = {name = "mcl_amethyst_amethyst_break", gain = 0.44},
})
minetest.register_node("mcl_amethyst:budding_amethyst_block",{
description = S("Budding Amethyst"),
tiles = {"mcl_amethyst_budding_amethyst.png"},
drop = "",
groups = {
pickaxey = 1,
building_block = 1,
dig_by_piston = 1,
},
sounds = sounds,
is_ground_content = true,
_mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5,
})
-- Amethyst Cluster
local bud_def = {
{
size = "small",
description = S("Small Amethyst Bud"),
light_source = 3,
next_stage = "mcl_amethyst:medium_amethyst_bud",
selection_box = { -4/16, -7/16, -4/16, 4/16, -3/16, 4/16 },
},
{
size = "medium",
description = S("Medium Amethyst Bud"),
light_source = 4,
next_stage = "mcl_amethyst:large_amethyst_bud",
selection_box = { -4.5/16, -8/16, -4.5/16, 4.5/16, -2/16, 4.5/16 },
},
{
size = "large",
description = S("Large Amethyst Bud"),
light_source = 5,
next_stage = "mcl_amethyst:amethyst_cluster",
selection_box = { -4.5/16, -8/16, -4.5/16, 4.5/16, -1/16, 4.5/16 },
},
}
for _, def in pairs(bud_def) do
local size = def.size
local name = "mcl_amethyst:" .. size .. "_amethyst_bud"
local tile = "mcl_amethyst_amethyst_bud_" .. size .. ".png"
local inventory_image = "mcl_amethyst_amethyst_bud_" .. size .. ".png"
minetest.register_node(name, {
description = def.description,
drop = "",
tiles = {tile},
inventory_image = inventory_image,
paramtype1 = "light",
paramtype2 = "wallmounted",
drawtype = "plantlike",
use_texture_alpha = "clip",
sunlight_propagates = true,
walkable = false,
light_source = def.light_source,
groups = {
destroy_by_lava_flow = 1,
dig_by_piston = 1,
pickaxey = 1,
deco_block = 1,
amethyst_buds = 1,
attached_node = 1,
},
sounds = sounds,
selection_box = {
type = "fixed",
fixed = def.selection_box
},
_mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5,
_mcl_silk_touch_drop = true,
_mcl_amethyst_next_grade = def.next_stage,
})
end
minetest.register_node("mcl_amethyst:amethyst_cluster",{
description = S("Amethyst Cluster"),
drop = {
max_items = 1,
items = {
{
tools = {"~mcl_tools:pick_"},
items = {"mcl_amethyst:amethyst_shard 4"},
},
{
items = {"mcl_amethyst:amethyst_shard 2"},
},
}
},
tiles = {"mcl_amethyst_amethyst_cluster.png",},
inventory_image = "mcl_amethyst_amethyst_cluster.png",
paramtype2 = "wallmounted",
drawtype = "plantlike",
paramtype1 = "light",
use_texture_alpha = "clip",
sunlight_propagates = true,
walkable = false,
light_source = 7,
groups = {
destroy_by_lava_flow = 1,
dig_by_piston = 1,
pickaxey = 1,
deco_block = 1,
attached_node = 1,
},
sounds = sounds,
selection_box = {
type = "fixed",
fixed = { -4.8/16, -8/16, -4.8/16, 4.8/16, 3.9/16, 4.8/16 },
},
_mcl_hardness = 1.5,
_mcl_blast_resistance = 1.5,
_mcl_silk_touch_drop = true,
})
if minetest.get_modpath("mcl_spyglass") then
minetest.clear_craft({output = "mcl_spyglass:spyglass",})
local function craft_spyglass(ingot)
minetest.register_craft({
output = "mcl_spyglass:spyglass",
recipe = {
{"mcl_amethyst:amethyst_shard"},
{ingot},
{ingot},
}
})
end
if minetest.get_modpath("mcl_copper") then
craft_spyglass("mcl_copper:copper_ingot")
else
craft_spyglass("mcl_core:iron_ingot")
end
end
-- Amethyst Growing
dofile(minetest.get_modpath(minetest.get_current_modname()) .. "/grow.lua")

View File

@ -567,7 +567,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
-- Common spawn (in the center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 7000,
clust_num_ores = 7,
@ -579,7 +579,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
-- Rare spawn (below center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 10000,
clust_num_ores = 6,
@ -589,7 +589,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 12000,
clust_num_ores = 5,
@ -599,7 +599,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 16000,
clust_num_ores = 4,
@ -609,7 +609,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 18000,
clust_num_ores = 3,
@ -621,7 +621,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
-- Rare spawn (above center)
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 10000,
clust_num_ores = 6,
@ -631,7 +631,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 12000,
clust_num_ores = 5,
@ -641,7 +641,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 14000,
clust_num_ores = 4,
@ -651,7 +651,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 18000,
clust_num_ores = 3,
@ -661,7 +661,7 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
})
minetest.register_ore({
ore_type = "scatter",
ore = "mcl_core:stone_with_lapis",
ore = "blocks:lapis_ore",
wherein = stonelike,
clust_scarcity = 28000,
clust_num_ores = 1,
@ -702,11 +702,11 @@ if minetest.settings:get_bool("mcl_generate_ores", true) then
--{ "redstone", 800, 7, 4, deepslate_min, mcl_worlds.layer_to_y(13) },
--{ "redstone", 1000, 4, 3, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
--{ "redstone", 1600, 7, 4, mcl_worlds.layer_to_y(13), mcl_worlds.layer_to_y(15) },
--{ "lapis", 10000, 7, 4, mcl_worlds.layer_to_y(14), deepslate_max },
--{ "lapis", 12000, 6, 3, mcl_worlds.layer_to_y(10), mcl_worlds.layer_to_y(13) },
--{ "lapis", 14000, 5, 3, mcl_worlds.layer_to_y(6), mcl_worlds.layer_to_y(9) },
--{ "lapis", 16000, 4, 3, mcl_worlds.layer_to_y(2), mcl_worlds.layer_to_y(5) },
--{ "lapis", 18000, 3, 2, mcl_worlds.layer_to_y(0), mcl_worlds.layer_to_y(2) },
{ "lapis", 10000, 7, 4, mcl_worlds.layer_to_y(14), deepslate_max },
{ "lapis", 12000, 6, 3, mcl_worlds.layer_to_y(10), mcl_worlds.layer_to_y(13) },
{ "lapis", 14000, 5, 3, mcl_worlds.layer_to_y(6), mcl_worlds.layer_to_y(9) },
{ "lapis", 16000, 4, 3, mcl_worlds.layer_to_y(2), mcl_worlds.layer_to_y(5) },
{ "lapis", 18000, 3, 2, mcl_worlds.layer_to_y(0), mcl_worlds.layer_to_y(2) },
}
for _, o in pairs(ore_mapgen) do
register_ore_mg("blocks:deepslate_"..o[1].."_ore", o[2], o[3], o[4], o[5], o[6])

View File

@ -67,7 +67,7 @@ local function makegeode(pos,def,pr)
for k,v in pairs(minetest.find_nodes_in_area_under_air(p1,p2,{"blocks:amethyst_block","blocks:budding_amethyst"})) do
local r = pr:next(1,50)
if r < 10 then
set_node_no_bedrock(vector.offset(v,0,1,0),{name="mcl_amethyst:amethyst_cluster",param2=1})
set_node_no_bedrock(vector.offset(v,0,1,0),{name="blocks:amethyst_cluster",param2=1})
end
end
return true

View File

@ -1,4 +1,16 @@
local common_defs = {
amethyst = {
_mcl_blast_resistance = 1.5,
_mcl_hardness = 1.5,
_mcl_silk_touch_drop = true,
drawtype = "plantlike",
groups = {attached_node = 1, natural_blocks = 1, pickaxey = 1},
paramtype = "light",
paramtype2 = "wallmounted",
sounds = mcl_sounds.node_sound_glass_defaults(),
sunlight_propagates = true,
walkable = false
},
deepslate = {
_mcl_blast_resistance = 3,
_mcl_hardness = 4.5,
@ -15,18 +27,38 @@ local common_defs = {
}
}
local amethyst_blocks = {
["budding_amethyst"] = {
_mcl_blast_resistance = 1.5,
_mcl_hardness = 1.5,
local amethyst_clusters = {
["amethyst_cluster"] = {
drop = {
items = {
{items = {"items:amethyst_shard 4"}, tool_groups = {"pickaxe"}},
{items = {"items:amethyst_shard 2"}}
},
max_items = 1
},
groups = {handy = 1},
light_source = 5,
selection_box = {fixed = {-0.4375, -0.5, -0.4375, 0.4375, 0.25, 0.4375}, type = "fixed"}
},
["large_amethyst_bud"] = {
drop = "",
groups = {natural_blocks = 1},
sounds = mcl_sounds.node_sound_glass_defaults()
light_source = 4,
selection_box = {fixed = {-0.375, -0.5, -0.375, 0.375, 0.125, 0.375}, type = "fixed"}
},
["medium_amethyst_bud"] = {
drop = "",
light_source = 2,
selection_box = {fixed = {-0.3125, -0.5, -0.3125, 0.3125, -0.125, 0.3125}, type = "fixed"}
},
["small_amethyst_bud"] = {
drop = "",
light_source = 1,
selection_box = {fixed = {-0.25, -0.5, -0.25, 0.25, -0.1875, 0.25}, type = "fixed"}
}
}
for identifier, definitions in pairs(amethyst_blocks) do
voxelibre.register_block(identifier, definitions)
for identifier, definitions in pairs(amethyst_clusters) do
voxelibre.register_block(identifier, table.merge(common_defs.amethyst, definitions))
end
local overworld_ores = {
@ -61,6 +93,21 @@ local overworld_ores = {
["iron"] = {
drop = "items:raw_iron",
groups = {iron_ores = 1, pickaxey = 3}
},
["lapis"] = {
description = "Lapis Lazuli Ore",
drop = {
items = {
{items = {"items:lapis_lazuli 9"}, rarity = 6},
{items = {"items:lapis_lazuli 8"}, rarity = 6},
{items = {"items:lapis_lazuli 7"}, rarity = 6},
{items = {"items:lapis_lazuli 6"}, rarity = 6},
{items = {"items:lapis_lazuli 5"}, rarity = 6},
{items = {"items:lapis_lazuli 4"}}
},
max_items = 1
},
groups = {lapis_ores = 1, pickaxey = 3}
}
}
@ -71,5 +118,17 @@ for identifier, definitions in pairs(overworld_ores) do
identifier = "deepslate_"..identifier
if identifier:find("lapis") then
definitions.description = "Deepslate "..definitions.description
end
voxelibre.register_block(identifier, table.merge(common_defs.deepslate, definitions))
end
voxelibre.register_block("budding_amethyst", {
_mcl_blast_resistance = 1.5,
_mcl_hardness = 1.5,
drop = "",
groups = {dig_by_piston = 1, natural_blocks = 1, pickaxey = 1},
sounds = mcl_sounds.node_sound_glass_defaults()
})