diff --git a/default.lua b/default.lua index c56ff40..873d542 100644 --- a/default.lua +++ b/default.lua @@ -1,11 +1,11 @@ -- Register stripped trees local mod_name = "default" -stripped_tree.register_strippable_trunk("default:tree") -stripped_tree.register_strippable_trunk("default:jungletree") -stripped_tree.register_strippable_trunk("default:aspen_tree") -stripped_tree.register_strippable_trunk("default:acacia_tree") -stripped_tree.register_strippable_trunk("default:pine_tree") +stripped_tree.register_strippable_trunk("default:tree", "default:wood") +stripped_tree.register_strippable_trunk("default:jungletree", "default:junglewood") +stripped_tree.register_strippable_trunk("default:aspen_tree", "default:aspen_wood") +stripped_tree.register_strippable_trunk("default:acacia_tree", "default:acacia_wood") +stripped_tree.register_strippable_trunk("default:pine_tree", "default:pine_wood") -- Register axes local axe_types = {"axe_wood", "axe_stone", "axe_bronze", "axe_steel", "axe_mese", "axe_diamond"} diff --git a/ethereal.lua b/ethereal.lua index 146f134..1c117d6 100644 --- a/ethereal.lua +++ b/ethereal.lua @@ -1,15 +1,15 @@ -- Register stripped trees local mod_name = "ethereal" -stripped_tree.register_strippable_trunk("ethereal:banana_trunk") -stripped_tree.register_strippable_trunk("ethereal:birch_trunk") -stripped_tree.register_strippable_trunk("ethereal:scorched_tree") -stripped_tree.register_strippable_trunk("ethereal:yellow_trunk") -stripped_tree.register_strippable_trunk("ethereal:willow_trunk") -stripped_tree.register_strippable_trunk("ethereal:redwood_trunk") -stripped_tree.register_strippable_trunk("ethereal:sakura_trunk") -stripped_tree.register_strippable_trunk("ethereal:frost_tree") -stripped_tree.register_strippable_trunk("ethereal:palm_trunk") +stripped_tree.register_strippable_trunk("ethereal:banana_trunk", "ethereal:banana_wood") +stripped_tree.register_strippable_trunk("ethereal:birch_trunk", "ethereal:birch_wood") +stripped_tree.register_strippable_trunk("ethereal:scorched_tree", "ethereal:scorched_wood") +stripped_tree.register_strippable_trunk("ethereal:yellow_trunk", "ethereal:yellow_wood") +stripped_tree.register_strippable_trunk("ethereal:willow_trunk", "ethereal:willow_wood") +stripped_tree.register_strippable_trunk("ethereal:redwood_trunk", "ethereal:redwood_wood") +stripped_tree.register_strippable_trunk("ethereal:sakura_trunk", "ethereal:sakura_wood") +stripped_tree.register_strippable_trunk("ethereal:frost_tree", "ethereal:frost_wood") +stripped_tree.register_strippable_trunk("ethereal:palm_trunk", "ethereal:palm_wood") -- Register axes local axe_types = {"axe_crystal"} diff --git a/functions.lua b/functions.lua index 0f2ad1c..24360e5 100644 --- a/functions.lua +++ b/functions.lua @@ -39,9 +39,15 @@ stripped_tree.swap_node = function(pos, user, in_creative_mode, tool) end -- Function to register a single strippable trunk -function stripped_tree.register_strippable_trunk(trunk_name, stripped_tiles) +function stripped_tree.register_strippable_trunk(trunk_name, plank_name, stripped_tiles) local mod_name, trunk_node = unpack(trunk_name:split(":")) local stripped_name = ":" .. mod_name .. ":stripped_" .. trunk_node + local stripped_ingredient_name = stripped_name + + -- The leading colon of the stripped name is only required for node registration. For recipe ingredients it must not + -- be there. + if stripped_ingredient_name:sub(1, 1) == ":" then stripped_ingredient_name = stripped_ingredient_name:sub(2) end + local trunk_def = core.registered_nodes[trunk_name] local stripped_def = table.copy(trunk_def) stripped_def.description = "Stripped " .. trunk_def.description @@ -65,6 +71,8 @@ function stripped_tree.register_strippable_trunk(trunk_name, stripped_tiles) }, } ) + + if plank_name then core.register_craft({output = plank_name .. " 4", recipe = {{stripped_ingredient_name}}}) end end -- Compatibility function from the previous version, able to register multiple stripped tree nodes at once diff --git a/moretrees.lua b/moretrees.lua index 6aab98a..36c48f4 100644 --- a/moretrees.lua +++ b/moretrees.lua @@ -1,34 +1,38 @@ -- Register stripped trees -local mod_name = "moretrees" - -stripped_tree.register_strippable_trunk("moretrees:beech_trunk") -stripped_tree.register_strippable_trunk("moretrees:apple_tree_trunk") -stripped_tree.register_strippable_trunk("moretrees:oak_trunk") -stripped_tree.register_strippable_trunk("moretrees:sequoia_trunk") -stripped_tree.register_strippable_trunk("moretrees:birch_trunk") -stripped_tree.register_strippable_trunk("moretrees:palm_trunk") -stripped_tree.register_strippable_trunk("moretrees:date_palm_trunk") -stripped_tree.register_strippable_trunk("moretrees:spruce_trunk") -stripped_tree.register_strippable_trunk("moretrees:cedar_trunk") -stripped_tree.register_strippable_trunk("moretrees:poplar_trunk") -stripped_tree.register_strippable_trunk("moretrees:willow_trunk") -stripped_tree.register_strippable_trunk("moretrees:rubber_tree_trunk") -stripped_tree.register_strippable_trunk("moretrees:fir_trunk") -stripped_tree.register_strippable_trunk("moretrees:jungletree_trunk") +stripped_tree.register_strippable_trunk("moretrees:beech_trunk", "moretrees:beech_planks") +stripped_tree.register_strippable_trunk("moretrees:apple_tree_trunk", "moretrees:apple_tree_planks") +stripped_tree.register_strippable_trunk("moretrees:oak_trunk", "moretrees:oak_planks") +stripped_tree.register_strippable_trunk("moretrees:sequoia_trunk", "moretrees:sequoia_planks") +stripped_tree.register_strippable_trunk("moretrees:birch_trunk", "moretrees:birch_planks") +stripped_tree.register_strippable_trunk("moretrees:palm_trunk", "moretrees:palm_planks") +stripped_tree.register_strippable_trunk("moretrees:date_palm_trunk", "moretrees:date_palm_planks") +stripped_tree.register_strippable_trunk("moretrees:spruce_trunk", "moretrees:spruce_planks") +stripped_tree.register_strippable_trunk("moretrees:cedar_trunk", "moretrees:cedar_planks") +stripped_tree.register_strippable_trunk("moretrees:poplar_trunk", "moretrees:poplar_planks") +stripped_tree.register_strippable_trunk("moretrees:willow_trunk", "moretrees:willow_planks") +stripped_tree.register_strippable_trunk("moretrees:rubber_tree_trunk", "moretrees:rubber_tree_planks") +stripped_tree.register_strippable_trunk("moretrees:fir_trunk", "moretrees:fir_planks") +stripped_tree.register_strippable_trunk("moretrees:jungletree_trunk", "default:junglewood") -- Register tree variations using the same texture as default moretree trunks -local palm_trunk_tiles = { - "stripped_" .. mod_name .. "_date_palm_trunk_top.png", - "stripped_" .. mod_name .. "_date_palm_trunk_top.png", - "stripped_" .. mod_name .. "_date_palm_trunk.png", +local date_palm_trunk_tiles = { + "stripped_moretrees_date_palm_trunk_top.png", + "stripped_moretrees_date_palm_trunk_top.png", + "stripped_moretrees_date_palm_trunk.png", } -stripped_tree.register_strippable_trunk("moretrees:date_palm_mfruit_trunk", palm_trunk_tiles) -stripped_tree.register_strippable_trunk("moretrees:date_palm_ffruit_trunk", palm_trunk_tiles) -stripped_tree.register_strippable_trunk("moretrees:date_palm_fruit_trunk", palm_trunk_tiles) stripped_tree.register_strippable_trunk( - "moretrees:rubber_tree_trunk_empty", { - "stripped_" .. mod_name .. "_rubber_tree_trunk_top.png", - "stripped_" .. mod_name .. "_rubber_tree_trunk_top.png", - "stripped_" .. mod_name .. "_rubber_tree_trunk.png", + "moretrees:date_palm_mfruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles +) +stripped_tree.register_strippable_trunk( + "moretrees:date_palm_ffruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles +) +stripped_tree.register_strippable_trunk( + "moretrees:date_palm_fruit_trunk", "moretrees:date_palm_planks", date_palm_trunk_tiles +) +stripped_tree.register_strippable_trunk( + "moretrees:rubber_tree_trunk_empty", "moretrees:rubber_tree_planks", { + "stripped_moretrees_rubber_tree_trunk_top.png", + "stripped_moretrees_rubber_tree_trunk_top.png", + "stripped_moretrees_rubber_tree_trunk.png", } )