diff --git a/mods/ITEMS/vl_hollow_logs/API.md b/mods/ITEMS/vl_hollow_logs/API.md new file mode 100644 index 000000000..58055515a --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/API.md @@ -0,0 +1,28 @@ +# ```vl_hollow_logs``` + +This mod registers hollow logs derived from normal logs. +Hollow logs mostly have a decorative function, but some of them can be used in recipes. Changes may appear soon. + +## Functions: +### ```vl_hollow_logs.register_hollow_log(defs)``` +This is the function that registers the hollow trunk. +For a hollow log to be registered, the defs parameter must be a table that contains up to 5 values, which are, in this order, the itemstring of the hollow log, the itemstring of the stripped hollow log, the description of the hollow log, the description of the stripped hollow log and, optionally, a boolean to inform whether this trunk is NOT flammable. If the hollow log is defined as flammable, it becomes part of the hollow_log_flammable group, which allows the log to be used as fuel for furnaces and also allows it to be an ingredient for chacoal. + +Examples: +```lua +-- Flammable +{"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"} + +-- Not flammable +{"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true} +``` +### ```vl_hollow_logs.register_craft(material, result)``` + +This function records the crafting recipe for a hollow log based on its non-hollow variant. +This function also defines a recipe for the stonecutter. The material and result parameters must be, respectively, the complete itemstring of the source material and the (partial) itemstring of the result. See the following examples: + +```lua +vl_hollow_logs.register_craft("mcl_core:tree", "tree") + +vl_hollow_logs.register_craft("mcl_crimson:stripped_crimson_hyphae", "stripped_crimson_hyphae") +``` diff --git a/mods/ITEMS/vl_hollow_logs/init.lua b/mods/ITEMS/vl_hollow_logs/init.lua new file mode 100644 index 000000000..455688253 --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/init.lua @@ -0,0 +1,112 @@ +local modpath = minetest.get_modpath(minetest.get_current_modname()) +local S = minetest.get_translator(minetest.get_current_modname()) + +vl_hollow_logs = {} +--- Function to register a hollow log. See API.md to learn how to use this function. +---@param defs table {name:string, stripped_name>string, desc:string, stripped_desc:string, not_flammable:boolean|nil} +function vl_hollow_logs.register_hollow_log(defs) + if not defs or #defs < 4 then + error("Incomplete definition provided") + end + + for i = 1, 4 do + if type(defs[i]) ~= "string" then + error("defs["..i.."] must be a string") + end + end + if defs[5] and type(defs[5]) ~= "boolean" then + error("defs[5] must be a boolean if present") + end + + local modname = minetest.get_current_modname() + + if #defs > 5 then + minetest.log("warning", "[vl_hollow_logs] unused vars passed, dumping the table") + minetest.log("warning", "from mod " .. modname .. ": " .. dump(defs)) + end + + local name = defs[1] + local stripped_name = defs[2] + local desc = defs[3] + local stripped_desc = defs[4] + + local collisionbox = { + type = "fixed", + fixed = { + {-0.5, -0.5, -0.5, 0.5, 0.5, -0.375}, + {-0.5, -0.5, -0.5, -0.375, 0.5, 0.5}, + {0.375, -0.5, -0.5, 0.5, 0.5, 0.5}, + {-0.5, -0.5, 0.375, 0.5, 0.5, 0.5}, + } + } + + local groups = {axey = 1, building_block = 1, handy = 1, hollow_log = 1} + + if not defs[5] then + groups = table.insert(groups, {fire_encouragement = 5, fire_flammability = 5, flammable = 2, hollow_log_burnable = 1}) + end + + minetest.register_node(modname .. ":"..name.."_hollow", { + collision_box = collisionbox, + description = S(desc), + drawtype = "mesh", + groups = groups, + mesh = "vl_hollow_logs_log.obj", + on_place = mcl_util.rotate_axis, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + sounds = mcl_sounds.node_sound_wood_defaults(), + sunlight_propagates = true, + tiles = {modname .. "_"..name..".png"}, + _mcl_blast_resistance = 2, + _mcl_hardness = 2, + _mcl_stripped_variant = modname .. ":stripped_"..name.."_hollow" + }) + + minetest.register_node(modname .. ":"..stripped_name.."_hollow", { + collision_box = collisionbox, + description = S(stripped_desc), + drawtype = "mesh", + groups = groups, + mesh = "vl_hollow_logs_log.obj", + on_place = mcl_util.rotate_axis, + paramtype = "light", + paramtype2 = "facedir", + use_texture_alpha = "clip", + sounds = mcl_sounds.node_sound_wood_defaults(), + sunlight_propagates = true, + tiles = {modname .. "_stripped_"..name..".png"}, + _mcl_blast_resistance = 2, + _mcl_hardness = 2 + }) +end + +vl_hollow_logs.logs = { + {"acaciatree", "stripped_acacia", "Hollow Acacia Log", "Stripped Hollow Acacia Log"}, + {"birchtree", "stripped_birch", "Hollow Birch Log", "Stripped Hollow Birch Log"}, + {"darktree", "stripped_dark_oak", "Hollow Dark Oak Log", "Stripped Hollow Dark Oak Log"}, + {"jungletree", "stripped_jungle", "Hollow Jungle Log", "Stripped Hollow Jungle Log"}, + {"sprucetree", "stripped_spruce", "Hollow Spruce Log", "Stripped Hollow Spruce Log"}, + {"tree", "stripped_oak", "Hollow Oak Log", "Stripped Hollow Oak Log"} +} + + +if minetest.get_modpath("mcl_cherry_blossom") then + table.insert(vl_hollow_logs.logs, {"cherrytree", "stripped_cherrytree", "Hollow Cherry Log", "Stripped Hollow Cherry Log"}) +end + +if minetest.get_modpath("mcl_mangrove") then + table.insert(vl_hollow_logs.logs, {"mangrove_tree", "mangrove_stripped", "Hollow Mangrove Log", "Stripped Hollow Mangrove Log"}) +end + +if minetest.get_modpath("mcl_crimson") then + table.insert(vl_hollow_logs.logs, {"crimson_hyphae", "stripped_crimson_hyphae", "Hollow Crimson Stem", "Stripped Hollow Crimson Stem", true}) + table.insert(vl_hollow_logs.logs, {"warped_hyphae", "stripped_warped_hyphae", "Hollow Warped Stem", "Stripped Hollow Warped Stem", true}) +end + +for _, defs in pairs(vl_hollow_logs.logs) do + vl_hollow_logs.register_hollow_log(defs) +end + +dofile(modpath.."/recipes.lua") diff --git a/mods/ITEMS/vl_hollow_logs/locale/template.txt b/mods/ITEMS/vl_hollow_logs/locale/template.txt new file mode 100644 index 000000000..a8498e23d --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/locale/template.txt @@ -0,0 +1,21 @@ +# textdomain: mcl_hollow_logs +Hollow Acacia Log= +Hollow Birch Log= +Hollow Cherry Log= +Hollow Dark Oak Log= +Hollow Jungle Log= +Hollow Mangrove Log= +Hollow Oak Log= +Hollow Spruce Log= +Hollow Crimson Stem= +Hollow Warped Stem= +Stripped Hollow Acacia Log= +Stripped Hollow Birch Log= +Stripped Hollow Cherry Log= +Stripped Hollow Dark Oak Log= +Stripped Hollow Jungle Log= +Stripped Hollow Mangrove Log= +Stripped Hollow Oak Log= +Stripped Hollow Spruce Log= +Stripped Hollow Crimson Stem= +Stripped Hollow Warped Stem= diff --git a/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.pt_BR.tr b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.pt_BR.tr new file mode 100644 index 000000000..171a5a613 --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/locale/vl_hollow_logs.pt_BR.tr @@ -0,0 +1,21 @@ +# textdomain: mcl_hollow_logs +Hollow Acacia Log=Tronco Oco de Acácia +Hollow Birch Log=Tronco Oco de Bétula +Hollow Cherry Log=Tronco Oco de Cerejeira +Hollow Dark Oak Log=Tronco Oco de Carvalho Escuro +Hollow Jungle Log=Tronco Oco da Selva +Hollow Mangrove Log=Tronco Oco de Mangue +Hollow Oak Log=Tronco Oco de Carvalho +Hollow Spruce Log=Tronco Oco de Pinheiro +Hollow Crimson Stem=Caule Oco Carmesim +Hollow Warped Stem=Caule Oco Distorcido +Stripped Hollow Acacia Log=Tronco Oco Descascado de Acácia +Stripped Hollow Birch Log=Tronco Oco Descascado de Bétula +Stripped Hollow Cherry Log=Tronco Oco Descascado de Cerejeira +Stripped Hollow Dark Oak Log=Tronco Oco Descascado de Carvalho Escuro +Stripped Hollow Jungle Log=Tronco Oco Descascado da Selva +Stripped Hollow Mangrove Log=Tronco Oco Descascado de Mangue +Stripped Hollow Oak Log=Tronco Oco Descascado de Carvalho +Stripped Hollow Spruce Log=Tronco Oco Descascado de Pinheiro +Stripped Hollow Crimson Stem=Caule Oco Descascado Carmesim +Stripped Hollow Warped Stem=Caule Oco Descascado Distorcido diff --git a/mods/ITEMS/vl_hollow_logs/mod.conf b/mods/ITEMS/vl_hollow_logs/mod.conf new file mode 100644 index 000000000..b9fb65754 --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/mod.conf @@ -0,0 +1,4 @@ +name = vl_hollow_logs +depends = mcl_core, mcl_sounds, mcl_util +optional_depends = mcl_cherry_blossom, mcl_crimson, mcl_mangrove +author = JoseDouglas26 diff --git a/mods/ITEMS/vl_hollow_logs/models/vl_hollow_logs_log.obj b/mods/ITEMS/vl_hollow_logs/models/vl_hollow_logs_log.obj new file mode 100644 index 000000000..c254512e3 --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/models/vl_hollow_logs_log.obj @@ -0,0 +1,54 @@ +# Blender 3.6.7 +# www.blender.org +o hollow_log +v -0.312500 -0.500000 0.312500 +v -0.312500 0.500000 0.312500 +v -0.312500 -0.500000 -0.312500 +v -0.312500 0.500000 -0.312500 +v 0.312500 -0.500000 0.312500 +v 0.312500 0.500000 0.312500 +v 0.312500 -0.500000 -0.312500 +v 0.312500 0.500000 -0.312500 +v -0.500000 -0.500000 -0.500000 +v -0.500000 -0.500000 0.500000 +v -0.500000 0.500000 0.500000 +v -0.500000 0.500000 -0.500000 +v 0.500000 -0.500000 -0.500000 +v 0.500000 0.500000 -0.500000 +v 0.500000 -0.500000 0.500000 +v 0.500000 0.500000 0.500000 +vn -1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 -1.0000 +vn 1.0000 -0.0000 -0.0000 +vn -0.0000 -0.0000 1.0000 +vn -0.0000 -1.0000 -0.0000 +vn -0.0000 1.0000 -0.0000 +vt 0.380952 0.000000 +vt 0.380952 1.000000 +vt 0.000000 1.000000 +vt 0.000000 0.000000 +vt 0.619048 0.000000 +vt 0.619048 1.000000 +vt 0.928571 0.187500 +vt 0.928571 0.812500 +vt 1.000000 1.000000 +vt 1.000000 -0.000000 +vt 0.690476 0.187500 +vt 0.690476 0.812500 +s 0 +f 10/1/1 11/2/1 12/3/1 9/4/1 +f 9/1/2 12/2/2 14/3/2 13/4/2 +f 13/1/3 14/2/3 16/3/3 15/4/3 +f 15/1/4 16/2/4 11/3/4 10/4/4 +f 7/5/4 8/6/4 4/2/4 3/1/4 +f 5/5/1 6/6/1 8/2/1 7/1/1 +f 3/7/5 1/8/5 10/9/5 9/10/5 +f 2/8/6 4/7/6 12/10/6 11/9/6 +f 7/11/5 3/7/5 9/10/5 13/5/5 +f 4/7/6 8/11/6 14/5/6 12/10/6 +f 5/12/5 7/11/5 13/5/5 15/6/5 +f 8/11/6 6/12/6 16/6/6 14/5/6 +f 1/8/5 5/12/5 15/6/5 10/9/5 +f 6/12/6 2/8/6 11/9/6 16/6/6 +f 3/5/3 4/6/3 2/2/3 1/1/3 +f 1/5/2 2/6/2 6/2/2 5/1/2 diff --git a/mods/ITEMS/vl_hollow_logs/recipes.lua b/mods/ITEMS/vl_hollow_logs/recipes.lua new file mode 100644 index 000000000..0eaa5732f --- /dev/null +++ b/mods/ITEMS/vl_hollow_logs/recipes.lua @@ -0,0 +1,48 @@ +function vl_hollow_logs.register_craft(material, result) + minetest.register_craft({ + output = "vl_hollow_logs:"..result.."_hollow 4", + recipe = { + {"", material, ""}, + {material, "", material}, + {"", material, ""} + }, + type = "shaped" + }) + + mcl_stonecutter.register_recipe(material, "vl_hollow_logs:"..result.."_hollow", 1) +end + +for _, defs in pairs(vl_hollow_logs.logs) do + local mod, material, stripped_material + local name = defs[1] + local stripped_name = defs[2] + + if name:find("cherry") then + mod = "mcl_cherry_blossom:" + elseif name:find("mangrove") then + mod = "mcl_mangrove:" + elseif name:find("hyphae") then + mod = "mcl_crimson:" + else + mod = "mcl_core:" + end + + material = mod..name + stripped_material = mod..stripped_name + + vl_hollow_logs.register_craft(material, name) + vl_hollow_logs.register_craft(stripped_material, stripped_name) +end + +minetest.register_craft({ + burntime = 10, + recipe = "group:hollow_log_burnable", + type = "fuel", +}) + +minetest.register_craft({ + cooktime = 5, + output = "mcl_core:charcoal_lump", + recipe = "group:hollow_log_burnable", + type = "cooking" +}) diff --git a/textures/vl_hollow_logs_acaciatree.png b/textures/vl_hollow_logs_acaciatree.png new file mode 100644 index 000000000..f41412827 Binary files /dev/null and b/textures/vl_hollow_logs_acaciatree.png differ diff --git a/textures/vl_hollow_logs_birchtree.png b/textures/vl_hollow_logs_birchtree.png new file mode 100644 index 000000000..5ead6b211 Binary files /dev/null and b/textures/vl_hollow_logs_birchtree.png differ diff --git a/textures/vl_hollow_logs_cherrytree.png b/textures/vl_hollow_logs_cherrytree.png new file mode 100644 index 000000000..83da0e779 Binary files /dev/null and b/textures/vl_hollow_logs_cherrytree.png differ diff --git a/textures/vl_hollow_logs_crimson_hyphae.png b/textures/vl_hollow_logs_crimson_hyphae.png new file mode 100644 index 000000000..1ee1ec0f3 Binary files /dev/null and b/textures/vl_hollow_logs_crimson_hyphae.png differ diff --git a/textures/vl_hollow_logs_darktree.png b/textures/vl_hollow_logs_darktree.png new file mode 100644 index 000000000..0b3bfd79c Binary files /dev/null and b/textures/vl_hollow_logs_darktree.png differ diff --git a/textures/vl_hollow_logs_jungletree.png b/textures/vl_hollow_logs_jungletree.png new file mode 100644 index 000000000..d6dde6e4c Binary files /dev/null and b/textures/vl_hollow_logs_jungletree.png differ diff --git a/textures/vl_hollow_logs_mangrove_tree.png b/textures/vl_hollow_logs_mangrove_tree.png new file mode 100644 index 000000000..4a2a33db1 Binary files /dev/null and b/textures/vl_hollow_logs_mangrove_tree.png differ diff --git a/textures/vl_hollow_logs_sprucetree.png b/textures/vl_hollow_logs_sprucetree.png new file mode 100644 index 000000000..48b7e39fe Binary files /dev/null and b/textures/vl_hollow_logs_sprucetree.png differ diff --git a/textures/vl_hollow_logs_stripped_acaciatree.png b/textures/vl_hollow_logs_stripped_acaciatree.png new file mode 100644 index 000000000..b4047e2e6 Binary files /dev/null and b/textures/vl_hollow_logs_stripped_acaciatree.png differ diff --git a/textures/vl_hollow_logs_stripped_birchtree.png b/textures/vl_hollow_logs_stripped_birchtree.png new file mode 100644 index 000000000..e2fd7ac8a Binary files /dev/null and b/textures/vl_hollow_logs_stripped_birchtree.png differ diff --git a/textures/vl_hollow_logs_stripped_cherrytree.png b/textures/vl_hollow_logs_stripped_cherrytree.png new file mode 100644 index 000000000..50154931e Binary files /dev/null and b/textures/vl_hollow_logs_stripped_cherrytree.png differ diff --git a/textures/vl_hollow_logs_stripped_crimson_hyphae.png b/textures/vl_hollow_logs_stripped_crimson_hyphae.png new file mode 100644 index 000000000..9466797a9 Binary files /dev/null and b/textures/vl_hollow_logs_stripped_crimson_hyphae.png differ diff --git a/textures/vl_hollow_logs_stripped_darktree.png b/textures/vl_hollow_logs_stripped_darktree.png new file mode 100644 index 000000000..c8c5ed113 Binary files /dev/null and b/textures/vl_hollow_logs_stripped_darktree.png differ diff --git a/textures/vl_hollow_logs_stripped_jungletree.png b/textures/vl_hollow_logs_stripped_jungletree.png new file mode 100644 index 000000000..3d49d879c Binary files /dev/null and b/textures/vl_hollow_logs_stripped_jungletree.png differ diff --git a/textures/vl_hollow_logs_stripped_mangrove_tree.png b/textures/vl_hollow_logs_stripped_mangrove_tree.png new file mode 100644 index 000000000..232b41a8a Binary files /dev/null and b/textures/vl_hollow_logs_stripped_mangrove_tree.png differ diff --git a/textures/vl_hollow_logs_stripped_sprucetree.png b/textures/vl_hollow_logs_stripped_sprucetree.png new file mode 100644 index 000000000..b49d5280a Binary files /dev/null and b/textures/vl_hollow_logs_stripped_sprucetree.png differ diff --git a/textures/vl_hollow_logs_stripped_tree.png b/textures/vl_hollow_logs_stripped_tree.png new file mode 100644 index 000000000..81cc52d8b Binary files /dev/null and b/textures/vl_hollow_logs_stripped_tree.png differ diff --git a/textures/vl_hollow_logs_stripped_warped_hyphae.png b/textures/vl_hollow_logs_stripped_warped_hyphae.png new file mode 100644 index 000000000..fb3cce08b Binary files /dev/null and b/textures/vl_hollow_logs_stripped_warped_hyphae.png differ diff --git a/textures/vl_hollow_logs_tree.png b/textures/vl_hollow_logs_tree.png new file mode 100644 index 000000000..ddd6864e9 Binary files /dev/null and b/textures/vl_hollow_logs_tree.png differ diff --git a/textures/vl_hollow_logs_warped_hyphae.png b/textures/vl_hollow_logs_warped_hyphae.png new file mode 100644 index 000000000..c80930740 Binary files /dev/null and b/textures/vl_hollow_logs_warped_hyphae.png differ