Uncover wood api functions and use them in cherry and mangrove wood

This commit is contained in:
PrairieWind 2023-06-17 11:27:45 -06:00 committed by ancientmarinerdev
parent 67078ba3b1
commit 0902e137e3
7 changed files with 86 additions and 372 deletions

View File

@ -1,12 +1,12 @@
# textdomain: mcl_cherry_blossom # textdomain: mcl_cherry_blossom
Cherry Log= Cherry Log=
The trunk of an cherry blossom tree.= The trunk of a cherry blossom tree.=
Stripped Cherry Log= Stripped Cherry Log=
The stripped trunk of an cherry blossom tree.= The stripped trunk of a cherry blossom tree.=
Cherry Bark= Cherry Bark=
This is a decorative block surrounded by the bark of a tree trunk.= This is a decorative block surrounded by the bark of a tree trunk.=
Stripped Cherry Wood= Stripped Cherry Wood=
The stripped wood of an cherry blossom tree.= The stripped wood of a cherry blossom tree.=
Cherry Wood Planks= Cherry Wood Planks=
Cherry Leaves= Cherry Leaves=
Cherry blossom leaves are grown from cherry blossom trees.= Cherry blossom leaves are grown from cherry blossom trees.=

View File

@ -1,190 +1,27 @@
local S = minetest.get_translator(minetest.get_current_modname()) local S = minetest.get_translator(minetest.get_current_modname())
-- Logs -- Logs
minetest.register_node("mcl_cherry_blossom:cherrytree", { mcl_core.register_tree_trunk("cherrytree", S("Cherry Log"), S("Cherry Bark"),
description = S("Cherry Log"), S("The trunk of a cherry blossom tree."),
_doc_items_longdesc = S("The trunk of an cherry blossom tree."), "mcl_cherry_blossom_log_top.png", "mcl_cherry_blossom_log.png", "mcl_cherry_blossom:stripped_cherrytree")
_doc_items_hidden = false,
tiles = {"mcl_cherry_blossom_log_top.png", "mcl_cherry_blossom_log_top.png", "mcl_cherry_blossom_log.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
stack_max = 64,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_cherry_blossom:stripped_cherrytree",
})
minetest.register_node("mcl_cherry_blossom:stripped_cherrytree", { -- Stripped
description = S("Stripped Cherry Log"), mcl_core.register_stripped_trunk("stripped_cherrytree", S("Stripped Cherry Log"), S("Stripped Cherry Wood"),
_doc_items_longdesc = S("The stripped trunk of an cherry blossom tree."), S("The stripped trunk of a cherry blossom tree."), S("The stripped wood of a cherry blossom tree."),
_doc_items_hidden = false, "mcl_cherry_blossom_log_top_stripped.png", "mcl_cherry_blossom_log_stripped.png")
tiles = {"mcl_cherry_blossom_log_top_stripped.png", "mcl_cherry_blossom_log_top_stripped.png", "mcl_cherry_blossom_log_stripped.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
-- Bark
minetest.register_node("mcl_cherry_blossom:cherrytree_bark", {
description = S("Cherry Bark"),
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {"mcl_cherry_blossom_log.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1,axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_cherry_blossom:stripped_cherrytree_bark",
})
minetest.register_node("mcl_cherry_blossom:stripped_cherrytree_bark", {
description = S("Stripped Cherry Wood"),
_doc_items_longdesc = S("The stripped wood of an cherry blossom tree."),
tiles = {"mcl_cherry_blossom_log_stripped.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
stack_max = 64,
groups = {handy=1, axey=1, bark=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
is_ground_content = false,
on_rotate = on_rotate,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
--Planks --Planks
minetest.register_node("mcl_cherry_blossom:cherrywood", { mcl_core.register_wooden_planks("cherrywood", S("Cherry Wood Planks"), {"mcl_cherry_blossom_planks.png"})
description = S("Cherry Wood Planks"),
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = {"mcl_cherry_blossom_planks.png"},
stack_max = 64,
is_ground_content = false,
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 3,
_mcl_hardness = 2,
})
-- Leaves -- Leaves
local stick_chances = {50, 45, 30, 35, 10} mcl_core.register_leaves("cherryleaves", S("Cherry Leaves"),
local sapling_chances = {20, 16, 12, 10} S("Cherry blossom leaves are grown from cherry blossom trees."), {"mcl_cherry_blossom_leaves.png"},
nil, "none", nil, "mcl_cherry_blossom:cherrysapling", false, {50, 45, 30, 35, 10})
local function get_drops(fortune_level)
local drop = {
max_items = 1,
items = {
{
items = {"mcl_cherry_blossom:cherrysapling"},
rarity = sapling_chances[fortune_level + 1] or sapling_chances[fortune_level]
},
{
items = {"mcl_core:stick 1"},
rarity = stick_chances[fortune_level + 1]
},
{
items = {"mcl_core:stick 2"},
rarity = stick_chances[fortune_level + 1]
},
}
}
return drop
end
local l_def = {
description = S("Cherry Leaves"),
_doc_items_longdesc = S("Cherry blossom leaves are grown from cherry blossom trees."),
_doc_items_hidden = false,
drawtype = "allfaces_optional",
waving = 2,
tiles = {"mcl_cherry_blossom_leaves.png"},
color = color,
paramtype = "light",
stack_max = 64,
groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
leaves = 1, deco_block = 1, compostability = 30
},
drop = get_drops(0),
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
after_place_node = function(pos)
mcl_core.make_player_leaves(pos) -- Leaves placed by the player should always be player leaves.
end,
}
minetest.register_node("mcl_cherry_blossom:cherryleaves", l_def)
local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false
o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_cherry_blossom:cherryleaves"}
o_def._mcl_silk_touch_drop = {"mcl_cherry_blossom:cherryleaves"}
minetest.register_node("mcl_cherry_blossom:cherryleaves" .. "_orphan", o_def)
-- Sapling -- Sapling
minetest.register_node("mcl_cherry_blossom:cherrysapling", { mcl_core.register_sapling("cherrysapling", S("Cherry Sapling"),
description = S("Cherry Sapling"), S("Cherry blossom sapling can be planted to grow cherry trees."), tt_help,
_tt_help = tt_help, "mcl_cherry_blossom_sapling.png", {-4/16, -0.5, -4/16, 4/16, 0.25, 4/16})
_doc_items_longdesc = S("Cherry blossom sapling can be planted to grow cherry trees."),
_doc_items_hidden = false,
drawtype = "plantlike",
waving = 1,
visual_scale = 1.0,
tiles = {"mcl_cherry_blossom_sapling.png"},
inventory_image = "mcl_cherry_blossom_sapling.png",
wield_image = "mcl_cherry_blossom_sapling.png",
paramtype = "light",
sunlight_propagates = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-4/16, -0.5, -4/16, 4/16, 0.25, 4/16}
},
stack_max = 64,
groups = {
plant = 1, sapling = 1, attached_node = 1,
deco_block = 1, dig_immediate = 3, dig_by_water = 1, dig_by_piston = 1,
destroy_by_lava_flow = 1, compostability = 30
},
sounds = mcl_sounds.node_sound_leaves_defaults(),
on_construct = function(pos)
--local meta = minetest.get_meta(pos)
--meta:set_int("stage", 0)
-- TODO Uncomment above when wood api is implemented with the current mcl_core tree growth code.
end,
on_place = mcl_util.generate_on_place_plant_function(function(pos, node)
local node_below = minetest.get_node_or_nil({x=pos.x,y=pos.y-1,z=pos.z})
if not node_below then return false end
local nn = node_below.name
return minetest.get_item_group(nn, "grass_block") == 1 or
nn == "mcl_core:podzol" or nn == "mcl_core:podzol_snow" or
nn == "mcl_core:dirt" or nn == "mcl_core:mycelium" or nn == "mcl_core:coarse_dirt"
end),
node_placement_prediction = "",
_mcl_blast_resistance = 0,
_mcl_hardness = 0,
})
-- Door and Trapdoor -- Door and Trapdoor
mcl_doors:register_door("mcl_cherry_blossom:cherrydoor", { mcl_doors:register_door("mcl_cherry_blossom:cherrydoor", {

View File

@ -51,8 +51,9 @@ function mcl_core.make_player_leaves(pos)
end end
-- Register tree trunk (wood) and bark -- Register tree trunk (wood) and bark
local function register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant) function mcl_core.register_tree_trunk(subname, description_trunk, description_bark, longdesc, tile_inner, tile_bark, stripped_variant)
minetest.register_node("mcl_core:"..subname, { local mod = minetest.get_current_modname()
minetest.register_node(mod..":"..subname, {
description = description_trunk, description = description_trunk,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -69,7 +70,7 @@ local function register_tree_trunk(subname, description_trunk, description_bark,
_mcl_stripped_variant = stripped_variant, _mcl_stripped_variant = stripped_variant,
}) })
minetest.register_node("mcl_core:"..subname.."_bark", { minetest.register_node(mod..":"..subname.."_bark", {
description = description_bark, description = description_bark,
_doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."), _doc_items_longdesc = S("This is a decorative block surrounded by the bark of a tree trunk."),
tiles = {tile_bark}, tiles = {tile_bark},
@ -86,17 +87,18 @@ local function register_tree_trunk(subname, description_trunk, description_bark,
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_core:"..subname.."_bark 3", output = mod..":"..subname.."_bark 3",
recipe = { recipe = {
{ "mcl_core:"..subname, "mcl_core:"..subname }, { mod..":"..subname, mod..":"..subname },
{ "mcl_core:"..subname, "mcl_core:"..subname }, { mod..":"..subname, mod..":"..subname },
} }
}) })
end end
-- Register stripped trunk and stripped wood -- Register stripped trunk and stripped wood
local function register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark) function mcl_core.register_stripped_trunk(subname, description_stripped_trunk, description_stripped_bark, longdesc, longdesc_wood, tile_stripped_inner, tile_stripped_bark)
minetest.register_node("mcl_core:"..subname, { local mod = minetest.get_current_modname()
minetest.register_node(mod..":"..subname, {
description = description_stripped_trunk, description = description_stripped_trunk,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -111,7 +113,7 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc
_mcl_hardness = 2, _mcl_hardness = 2,
}) })
minetest.register_node("mcl_core:"..subname.."_bark", { minetest.register_node(mod..":"..subname.."_bark", {
description = description_stripped_bark, description = description_stripped_bark,
_doc_items_longdesc = longdesc_wood, _doc_items_longdesc = longdesc_wood,
tiles = {tile_stripped_bark}, tiles = {tile_stripped_bark},
@ -127,16 +129,17 @@ local function register_stripped_trunk(subname, description_stripped_trunk, desc
}) })
minetest.register_craft({ minetest.register_craft({
output = "mcl_core:"..subname.."_bark 3", output = mod..":"..subname.."_bark 3",
recipe = { recipe = {
{ "mcl_core:"..subname, "mcl_core:"..subname }, { mod..":"..subname, mod..":"..subname },
{ "mcl_core:"..subname, "mcl_core:"..subname }, { mod..":"..subname, mod..":"..subname },
} }
}) })
end end
local function register_wooden_planks(subname, description, tiles) function mcl_core.register_wooden_planks(subname, description, tiles)
minetest.register_node("mcl_core:"..subname, { local mod = minetest.get_current_modname()
minetest.register_node(mod..":"..subname, {
description = description, description = description,
_doc_items_longdesc = doc.sub.items.temp.build, _doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false, _doc_items_hidden = false,
@ -150,7 +153,8 @@ local function register_wooden_planks(subname, description, tiles)
}) })
end end
local function register_leaves(subname, description, longdesc, tiles, color, paramtype2, palette, sapling, drop_apples, sapling_chances, foliage_palette) function mcl_core.register_leaves(subname, description, longdesc, tiles, color, paramtype2, palette, sapling, drop_apples, sapling_chances, foliage_palette)
local mod = minetest.get_current_modname()
local apple_chances = {200, 180, 160, 120, 40} local apple_chances = {200, 180, 160, 120, 40}
local stick_chances = {50, 45, 30, 35, 10} local stick_chances = {50, 45, 30, 35, 10}
@ -219,20 +223,21 @@ local function register_leaves(subname, description, longdesc, tiles, color, par
end, end,
} }
minetest.register_node("mcl_core:" .. subname, l_def) minetest.register_node(mod .. ":" .. subname, l_def)
local o_def = table.copy(l_def) local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false o_def._doc_items_create_entry = false
o_def.groups.not_in_creative_inventory = 1 o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1 o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_core:" .. subname} o_def._mcl_shears_drop = {mod .. ":" .. subname}
o_def._mcl_silk_touch_drop = {"mcl_core:" .. subname} o_def._mcl_silk_touch_drop = {mod .. ":" .. subname}
minetest.register_node("mcl_core:" .. subname .. "_orphan", o_def) minetest.register_node(mod .. ":" .. subname .. "_orphan", o_def)
end end
local function register_sapling(subname, description, longdesc, tt_help, texture, selbox) function mcl_core.register_sapling(subname, description, longdesc, tt_help, texture, selbox)
minetest.register_node("mcl_core:"..subname, { local mod = minetest.get_current_modname()
minetest.register_node(mod..":"..subname, {
description = description, description = description,
_tt_help = tt_help, _tt_help = tt_help,
_doc_items_longdesc = longdesc, _doc_items_longdesc = longdesc,
@ -277,59 +282,59 @@ end
--------------------- ---------------------
register_tree_trunk("tree", S("Oak Wood"), S("Oak Bark"), S("The trunk of an oak tree."), "default_tree_top.png", "default_tree.png", "mcl_core:stripped_oak") mcl_core.register_tree_trunk("tree", S("Oak Wood"), S("Oak Bark"), S("The trunk of an oak tree."), "default_tree_top.png", "default_tree.png", "mcl_core:stripped_oak")
register_tree_trunk("darktree", S("Dark Oak Wood"), S("Dark Oak Bark"), S("The trunk of a dark oak tree."), "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png", "mcl_core:stripped_dark_oak") mcl_core.register_tree_trunk("darktree", S("Dark Oak Wood"), S("Dark Oak Bark"), S("The trunk of a dark oak tree."), "mcl_core_log_big_oak_top.png", "mcl_core_log_big_oak.png", "mcl_core:stripped_dark_oak")
register_tree_trunk("acaciatree", S("Acacia Wood"), S("Acacia Bark"), S("The trunk of an acacia."), "default_acacia_tree_top.png", "default_acacia_tree.png", "mcl_core:stripped_acacia") mcl_core.register_tree_trunk("acaciatree", S("Acacia Wood"), S("Acacia Bark"), S("The trunk of an acacia."), "default_acacia_tree_top.png", "default_acacia_tree.png", "mcl_core:stripped_acacia")
register_tree_trunk("sprucetree", S("Spruce Wood"), S("Spruce Bark"), S("The trunk of a spruce tree."), "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png", "mcl_core:stripped_spruce") mcl_core.register_tree_trunk("sprucetree", S("Spruce Wood"), S("Spruce Bark"), S("The trunk of a spruce tree."), "mcl_core_log_spruce_top.png", "mcl_core_log_spruce.png", "mcl_core:stripped_spruce")
register_tree_trunk("birchtree", S("Birch Wood"), S("Birch Bark"), S("The trunk of a birch tree."), "mcl_core_log_birch_top.png", "mcl_core_log_birch.png", "mcl_core:stripped_birch") mcl_core.register_tree_trunk("birchtree", S("Birch Wood"), S("Birch Bark"), S("The trunk of a birch tree."), "mcl_core_log_birch_top.png", "mcl_core_log_birch.png", "mcl_core:stripped_birch")
register_tree_trunk("jungletree", S("Jungle Wood"), S("Jungle Bark"), S("The trunk of a jungle tree."), "default_jungletree_top.png", "default_jungletree.png", "mcl_core:stripped_jungle") mcl_core.register_tree_trunk("jungletree", S("Jungle Wood"), S("Jungle Bark"), S("The trunk of a jungle tree."), "default_jungletree_top.png", "default_jungletree.png", "mcl_core:stripped_jungle")
register_stripped_trunk("stripped_oak", S("Stripped Oak Log"), S("Stripped Oak Wood"), S("The stripped trunk of an oak tree."), S("The stripped wood of an oak tree."), "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png") mcl_core.register_stripped_trunk("stripped_oak", S("Stripped Oak Log"), S("Stripped Oak Wood"), S("The stripped trunk of an oak tree."), S("The stripped wood of an oak tree."), "mcl_core_stripped_oak_top.png", "mcl_core_stripped_oak_side.png")
register_stripped_trunk("stripped_acacia", S("Stripped Acacia Log"), S("Stripped Acacia Wood"), S("The stripped trunk of an acacia tree."), S("The stripped wood of an acacia tree."), "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png") mcl_core.register_stripped_trunk("stripped_acacia", S("Stripped Acacia Log"), S("Stripped Acacia Wood"), S("The stripped trunk of an acacia tree."), S("The stripped wood of an acacia tree."), "mcl_core_stripped_acacia_top.png", "mcl_core_stripped_acacia_side.png")
register_stripped_trunk("stripped_dark_oak", S("Stripped Dark Oak Log"), S("Stripped Dark Oak Wood"), S("The stripped trunk of a dark oak tree."), S("The stripped wood of a dark oak tree."), "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png") mcl_core.register_stripped_trunk("stripped_dark_oak", S("Stripped Dark Oak Log"), S("Stripped Dark Oak Wood"), S("The stripped trunk of a dark oak tree."), S("The stripped wood of a dark oak tree."), "mcl_core_stripped_dark_oak_top.png", "mcl_core_stripped_dark_oak_side.png")
register_stripped_trunk("stripped_birch", S("Stripped Birch Log"), S("Stripped Birch Wood"), S("The stripped trunk of a birch tree."), S("The stripped wood of a birch tree."), "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png") mcl_core.register_stripped_trunk("stripped_birch", S("Stripped Birch Log"), S("Stripped Birch Wood"), S("The stripped trunk of a birch tree."), S("The stripped wood of a birch tree."), "mcl_core_stripped_birch_top.png", "mcl_core_stripped_birch_side.png")
register_stripped_trunk("stripped_spruce", S("Stripped Spruce Log"), S("Stripped Spruce Wood"), S("The stripped trunk of a spruce tree."), S("The stripped wood of a spruce tree."), "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png") mcl_core.register_stripped_trunk("stripped_spruce", S("Stripped Spruce Log"), S("Stripped Spruce Wood"), S("The stripped trunk of a spruce tree."), S("The stripped wood of a spruce tree."), "mcl_core_stripped_spruce_top.png", "mcl_core_stripped_spruce_side.png")
register_stripped_trunk("stripped_jungle", S("Stripped Jungle Log"), S("Stripped Jungle Wood"), S("The stripped trunk of a jungle tree."), S("The stripped wood of a jungle tree."),"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png") mcl_core.register_stripped_trunk("stripped_jungle", S("Stripped Jungle Log"), S("Stripped Jungle Wood"), S("The stripped trunk of a jungle tree."), S("The stripped wood of a jungle tree."),"mcl_core_stripped_jungle_top.png", "mcl_core_stripped_jungle_side.png")
register_wooden_planks("wood", S("Oak Wood Planks"), {"default_wood.png"}) mcl_core.register_wooden_planks("wood", S("Oak Wood Planks"), {"default_wood.png"})
register_wooden_planks("darkwood", S("Dark Oak Wood Planks"), {"mcl_core_planks_big_oak.png"}) mcl_core.register_wooden_planks("darkwood", S("Dark Oak Wood Planks"), {"mcl_core_planks_big_oak.png"})
register_wooden_planks("junglewood", S("Jungle Wood Planks"), {"default_junglewood.png"}) mcl_core.register_wooden_planks("junglewood", S("Jungle Wood Planks"), {"default_junglewood.png"})
register_wooden_planks("sprucewood", S("Spruce Wood Planks"), {"mcl_core_planks_spruce.png"}) mcl_core.register_wooden_planks("sprucewood", S("Spruce Wood Planks"), {"mcl_core_planks_spruce.png"})
register_wooden_planks("acaciawood", S("Acacia Wood Planks"), {"default_acacia_wood.png"}) mcl_core.register_wooden_planks("acaciawood", S("Acacia Wood Planks"), {"default_acacia_wood.png"})
register_wooden_planks("birchwood", S("Birch Wood Planks"), {"mcl_core_planks_birch.png"}) mcl_core.register_wooden_planks("birchwood", S("Birch Wood Planks"), {"mcl_core_planks_birch.png"})
register_sapling("sapling", S("Oak Sapling"), mcl_core.register_sapling("sapling", S("Oak Sapling"),
S("When placed on soil (such as dirt) and exposed to light, an oak sapling will grow into an oak after some time."), S("When placed on soil (such as dirt) and exposed to light, an oak sapling will grow into an oak after some time."),
S("Needs soil and light to grow"), S("Needs soil and light to grow"),
"default_sapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16}) "default_sapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16})
register_sapling("darksapling", S("Dark Oak Sapling"), mcl_core.register_sapling("darksapling", S("Dark Oak Sapling"),
S("Dark oak saplings can grow into dark oaks, but only in groups. A lonely dark oak sapling won't grow. A group of four dark oak saplings grows into a dark oak after some time when they are placed on soil (such as dirt) in a 2×2 square and exposed to light."), S("Dark oak saplings can grow into dark oaks, but only in groups. A lonely dark oak sapling won't grow. A group of four dark oak saplings grows into a dark oak after some time when they are placed on soil (such as dirt) in a 2×2 square and exposed to light."),
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings required"), S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings required"),
"mcl_core_sapling_big_oak.png", {-5/16, -0.5, -5/16, 5/16, 7/16, 5/16}) "mcl_core_sapling_big_oak.png", {-5/16, -0.5, -5/16, 5/16, 7/16, 5/16})
register_sapling("junglesapling", S("Jungle Sapling"), mcl_core.register_sapling("junglesapling", S("Jungle Sapling"),
S("When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. When there are 4 jungle saplings in a 2×2 square, they will grow to a huge jungle tree."), S("When placed on soil (such as dirt) and exposed to light, a jungle sapling will grow into a jungle tree after some time. When there are 4 jungle saplings in a 2×2 square, they will grow to a huge jungle tree."),
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"), S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"),
"default_junglesapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16}) "default_junglesapling.png", {-5/16, -0.5, -5/16, 5/16, 0.5, 5/16})
register_sapling("acaciasapling", S("Acacia Sapling"), mcl_core.register_sapling("acaciasapling", S("Acacia Sapling"),
S("When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia after some time."), S("When placed on soil (such as dirt) and exposed to light, an acacia sapling will grow into an acacia after some time."),
S("Needs soil and light to grow"), S("Needs soil and light to grow"),
"default_acacia_sapling.png", {-5/16, -0.5, -5/16, 5/16, 4/16, 5/16}) "default_acacia_sapling.png", {-5/16, -0.5, -5/16, 5/16, 4/16, 5/16})
register_sapling("sprucesapling", S("Spruce Sapling"), mcl_core.register_sapling("sprucesapling", S("Spruce Sapling"),
S("When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce after some time. When there are 4 spruce saplings in a 2×2 square, they will grow to a huge spruce."), S("When placed on soil (such as dirt) and exposed to light, a spruce sapling will grow into a spruce after some time. When there are 4 spruce saplings in a 2×2 square, they will grow to a huge spruce."),
S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"), S("Needs soil and light to grow") .. "\n" .. S("2×2 saplings = large tree"),
"mcl_core_sapling_spruce.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16}) "mcl_core_sapling_spruce.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
register_sapling("birchsapling", S("Birch Sapling"), mcl_core.register_sapling("birchsapling", S("Birch Sapling"),
S("When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch after some time."), S("When placed on soil (such as dirt) and exposed to light, a birch sapling will grow into a birch after some time."),
S("Needs soil and light to grow"), S("Needs soil and light to grow"),
"mcl_core_sapling_birch.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16}) "mcl_core_sapling_birch.png", {-4/16, -0.5, -4/16, 4/16, 0.5, 4/16})
register_leaves("leaves", S("Oak Leaves"), S("Oak leaves are grown from oak trees."), {"default_leaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:sapling", true, {20, 16, 12, 10}, 1) mcl_core.register_leaves("leaves", S("Oak Leaves"), S("Oak leaves are grown from oak trees."), {"default_leaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:sapling", true, {20, 16, 12, 10}, 1)
register_leaves("darkleaves", S("Dark Oak Leaves"), S("Dark oak leaves are grown from dark oak trees."), {"mcl_core_leaves_big_oak.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:darksapling", true, {20, 16, 12, 10}, 1) mcl_core.register_leaves("darkleaves", S("Dark Oak Leaves"), S("Dark oak leaves are grown from dark oak trees."), {"mcl_core_leaves_big_oak.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:darksapling", true, {20, 16, 12, 10}, 1)
register_leaves("jungleleaves", S("Jungle Leaves"), S("Jungle leaves are grown from jungle trees."), {"default_jungleleaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:junglesapling", false, {40, 26, 32, 24, 10}, 1) mcl_core.register_leaves("jungleleaves", S("Jungle Leaves"), S("Jungle leaves are grown from jungle trees."), {"default_jungleleaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:junglesapling", false, {40, 26, 32, 24, 10}, 1)
register_leaves("acacialeaves", S("Acacia Leaves"), S("Acacia leaves are grown from acacia trees."), {"default_acacia_leaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:acaciasapling", false, {20, 16, 12, 10}, 1) mcl_core.register_leaves("acacialeaves", S("Acacia Leaves"), S("Acacia leaves are grown from acacia trees."), {"default_acacia_leaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_core:acaciasapling", false, {20, 16, 12, 10}, 1)
register_leaves("spruceleaves", S("Spruce Leaves"), S("Spruce leaves are grown from spruce trees."), {"mcl_core_leaves_spruce.png"}, "#619961", "none", nil, "mcl_core:sprucesapling", false, {20, 16, 12, 10}, 0) mcl_core.register_leaves("spruceleaves", S("Spruce Leaves"), S("Spruce leaves are grown from spruce trees."), {"mcl_core_leaves_spruce.png"}, "#619961", "none", nil, "mcl_core:sprucesapling", false, {20, 16, 12, 10}, 0)
register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from birch trees."), {"mcl_core_leaves_birch.png"}, "#80A755", "none", nil, "mcl_core:birchsapling", false, {20, 16, 12, 10}, 0) mcl_core.register_leaves("birchleaves", S("Birch Leaves"), S("Birch leaves are grown from birch trees."), {"mcl_core_leaves_birch.png"}, "#80A755", "none", nil, "mcl_core:birchsapling", false, {20, 16, 12, 10}, 0)

View File

@ -18,148 +18,20 @@ local propagule_allowed_nodes = {
local propagule_water_nodes = {"mcl_mud:mud","mcl_core:dirt","mcl_core:coarse_dirt","mcl_core:clay"} local propagule_water_nodes = {"mcl_mud:mud","mcl_core:dirt","mcl_core:coarse_dirt","mcl_core:clay"}
--"mcl_lush_caves:moss","mcl_lush_caves:rooted_dirt --"mcl_lush_caves:moss","mcl_lush_caves:rooted_dirt
local function get_drops(fortune_level) mcl_core.register_tree_trunk("mangrove_tree", S("Mangrove Wood"), S("Mangrove Bark"),
local apple_chances = {200, 180, 160, 120, 40} S("The trunk of a Mangrove tree."),
local stick_chances = {50, 45, 30, 35, 10} "mcl_mangrove_log_top.png", "mcl_mangrove_log.png", "mcl_mangrove:mangrove_stripped")
local sapling_chances = {20, 16, 12, 10}
return {
max_items = 1,
items = {
{
items = {"mcl_mangrove:propagule"},
rarity = sapling_chances[fortune_level + 1] or sapling_chances[fortune_level]
},
{
items = {"mcl_core:stick 1"},
rarity = stick_chances[fortune_level + 1]
},
{
items = {"mcl_core:stick 2"},
rarity = stick_chances[fortune_level + 1]
},
{
items = {"mcl_core:apple"},
rarity = apple_chances[fortune_level + 1]
}
}
}
end
minetest.register_node("mcl_mangrove:mangrove_tree", { mcl_core.register_wooden_planks("mangrove_wood", S("Mangrove Wood Planks"), {"mcl_mangrove_planks.png"})
description = S("Mangrove Wood"),
_doc_items_longdesc = S("The trunk of a Mangrove tree."),
_doc_items_hidden = false,
tiles = {"mcl_mangrove_log_top.png", "mcl_mangrove_log_top.png", "mcl_mangrove_log.png"},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
after_destruct = mcl_core.update_leaves,
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_mangrove:mangrove_stripped_trunk",
})
minetest.register_node("mcl_mangrove:mangrove_tree_bark", {
description = S("Mangrove Bark"),
_doc_items_longdesc = S("The bark of a Mangrove tree."),
_doc_items_hidden = false,
tiles = {"mcl_mangrove_log.png", "mcl_mangrove_log.png", "mcl_mangrove_log.png"},
paramtype2 = "facedir",
groups = {handy=1,axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_place = mcl_util.rotate_axis,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
_mcl_stripped_variant = "mcl_mangrove:mangrove_stripped_bark",
})
minetest.register_node("mcl_mangrove:mangrove_wood", { mcl_core.register_leaves("mangroveleaves", S("Mangrove Leaves"), S("Mangrove leaves are grown from mangrove trees."),
description = S("Mangrove Wood Planks"), {"mcl_mangrove_leaves.png"}, "#48B518", "color", "mcl_core_palette_foliage.png", "mcl_mangrove:propagule", true, {20, 16, 12, 10}, 1)
_doc_items_longdesc = doc.sub.items.temp.build,
_doc_items_hidden = false,
tiles = {"mcl_mangrove_planks.png"},
is_ground_content = false, mcl_core.register_stripped_trunk("mangrove_stripped", S("Stripped Mangrove Log"), S("Stripped Mangrove Wood"),
groups = {handy=1,axey=1, flammable=3,wood=1,building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=20}, S("The stripped wood of a Mangrove tree"), S("The stripped bark of a Mangrove tree"),
sounds = mcl_sounds.node_sound_wood_defaults(), "mcl_stripped_mangrove_log_top.png", "mcl_stripped_mangrove_log_side.png")
_mcl_blast_resistance = 3,
_mcl_hardness = 2,
})
local l_def = { minetest.register_alias("mcl_mangrove:mangrove_stripped_trunk", "mcl_mangrove:mangrove_stripped")
description = S("Mangrove Leaves"),
_doc_items_longdesc = S("mangrove leaves are grown from mangrove trees."),
_doc_items_hidden = false,
drawtype = "allfaces_optional",
waving = 2,
tiles = {"mcl_mangrove_leaves.png"},
color = "#48B518",
paramtype = "light",
paramtype2 = "color",
palette = "mcl_core_palette_foliage.png",
groups = {
handy = 1, hoey = 1, shearsy = 1, swordy = 1, dig_by_piston = 1,
flammable = 2, fire_encouragement = 30, fire_flammability = 60,
leaves = 1, deco_block = 1, compostability = 30, foliage_palette = 1
},
drop = get_drops(0),
_mcl_shears_drop = true,
sounds = mcl_sounds.node_sound_leaves_defaults(),
_mcl_blast_resistance = 0.2,
_mcl_hardness = 0.2,
_mcl_silk_touch_drop = true,
_mcl_fortune_drop = { get_drops(1), get_drops(2), get_drops(3), get_drops(4) },
on_construct = function(pos)
local node = minetest.get_node(pos)
if node.param2 == 0 or node.param2 == 1 then -- Check if param2 is 1 as well, since the schematics accidentally have the param2 of mangrove leaves be 1.
local new_node = mcl_core.get_foliage_block_type(pos)
if new_node.param2 ~= 0 then
minetest.swap_node(pos, new_node)
end
end
end,
after_place_node = function(pos)
mcl_core.make_player_leaves(pos) -- Leaves placed by the player should always be player leaves.
end,
}
minetest.register_node("mcl_mangrove:mangroveleaves", l_def)
local o_def = table.copy(l_def)
o_def._doc_items_create_entry = false
o_def.groups.not_in_creative_inventory = 1
o_def.groups.orphan_leaves = 1
o_def._mcl_shears_drop = {"mcl_mangrove:mangroveleaves"}
o_def._mcl_silk_touch_drop = {"mcl_mangrove:mangroveleaves"}
minetest.register_node("mcl_mangrove:mangroveleaves_orphan", o_def)
minetest.register_node("mcl_mangrove:mangrove_stripped_trunk", {
description = S("Stripped Mangrove Wood"),
_doc_items_longdesc = S("The stripped wood of a Mangrove tree"),
_doc_items_hidden = false,
tiles ={"mcl_stripped_mangrove_log_top.png","mcl_stripped_mangrove_log_side.png",},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = mcl_util.rotate_axis_and_place,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.register_node("mcl_mangrove:mangrove_stripped_bark", {
description = S("Stripped Mangrove Bark"),
_doc_items_longdesc = S("The stripped bark of a Mangrove tree"),
_doc_items_hidden = false,
tiles ={"mcl_stripped_mangrove_log_side.png","mcl_stripped_mangrove_log_side.png",},
paramtype2 = "facedir",
on_place = mcl_util.rotate_axis,
groups = {handy=1, axey=1, tree=1, flammable=2, building_block=1, material_wood=1, fire_encouragement=5, fire_flammability=5},
sounds = mcl_sounds.node_sound_wood_defaults(),
on_rotate = mcl_util.rotate_axis_and_place,
_mcl_blast_resistance = 2,
_mcl_hardness = 2,
})
minetest.register_node("mcl_mangrove:mangrove_roots", { minetest.register_node("mcl_mangrove:mangrove_roots", {
description = S("Mangrove Roots"), description = S("Mangrove Roots"),

View File

@ -5,7 +5,7 @@ Mangrove Bark=Bois de palétuvier
The bark of a Mangrove tree.=L'écorce d'un palétuvier. The bark of a Mangrove tree.=L'écorce d'un palétuvier.
Mangrove Wood Planks=Planches de palétuvier Mangrove Wood Planks=Planches de palétuvier
Mangrove Leaves=Feuilles de palétuvier Mangrove Leaves=Feuilles de palétuvier
mangrove leaves are grown from mangrove trees.=les feuilles de palétuvier poussent sur les palétuviers. Mangrove leaves are grown from mangrove trees.=les feuilles de palétuvier poussent sur les palétuviers.
Stripped Mangrove Wood=Bûche de palétuvier écorcée Stripped Mangrove Wood=Bûche de palétuvier écorcée
The stripped wood of a Mangrove tree=La bûche écorcée d'un palétuvier The stripped wood of a Mangrove tree=La bûche écorcée d'un palétuvier
Stripped Mangrove Bark=Bois de palétuvier écorcé Stripped Mangrove Bark=Bois de palétuvier écorcé

View File

@ -5,7 +5,7 @@ Mangrove Bark=マングローブの樹皮
The bark of a Mangrove tree.=マングローブの木の樹皮です。 The bark of a Mangrove tree.=マングローブの木の樹皮です。
Mangrove Wood Planks=マングローブの板材 Mangrove Wood Planks=マングローブの板材
Mangrove Leaves=マングローブの葉 Mangrove Leaves=マングローブの葉
mangrove leaves are grown from mangrove trees.=マングローブの葉は、マングローブの木から育ちます。 Mangrove leaves are grown from mangrove trees.=マングローブの葉は、マングローブの木から育ちます。
Stripped Mangrove Wood=樹皮を剥いだマングローブの木 Stripped Mangrove Wood=樹皮を剥いだマングローブの木
The stripped wood of a Mangrove tree=剥き身となったマングローブの木 The stripped wood of a Mangrove tree=剥き身となったマングローブの木
Stripped Mangrove Bark=剥がされたマングローブの樹皮 Stripped Mangrove Bark=剥がされたマングローブの樹皮

View File

@ -5,7 +5,7 @@ Mangrove Bark=
The bark of a Mangrove tree.= The bark of a Mangrove tree.=
Mangrove Wood Planks= Mangrove Wood Planks=
Mangrove Leaves= Mangrove Leaves=
mangrove leaves are grown from mangrove trees.= Mangrove leaves are grown from mangrove trees.=
Stripped Mangrove Wood= Stripped Mangrove Wood=
The stripped wood of a Mangrove tree= The stripped wood of a Mangrove tree=
Stripped Mangrove Bark= Stripped Mangrove Bark=