VoxeLibre/mods/ITEMS/mcl_copper/crafting.lua

205 lines
5.0 KiB
Lua
Raw Normal View History

2022-05-01 03:11:51 +02:00
minetest.register_craft({
output = "mcl_copper:block_raw",
recipe = {
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
{ "mcl_copper:raw_copper", "mcl_copper:raw_copper", "mcl_copper:raw_copper" },
},
2022-05-01 03:11:51 +02:00
})
2022-05-01 03:11:51 +02:00
minetest.register_craft({
output = "mcl_copper:block",
recipe = {
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
{ "mcl_copper:copper_ingot", "mcl_copper:copper_ingot", "mcl_copper:copper_ingot" },
},
2022-05-01 03:11:51 +02:00
})
2024-05-03 18:36:39 +02:00
local function get_shape(name, material)
if name == "cut" then
return {
{material, material},
{material, material}
}
elseif name == "grate" then
return {
{"", material, ""},
{material, "", material},
{"", material, ""}
}
elseif name == "chiseled" then
return {
{material},
{material},
}
elseif name == "door" then
return {
{material, material},
{material, material},
{material, material}
}
elseif name == "trapdoor" then
return {
{material, material, material},
{material, material, material}
}
elseif name == "bulb_off" then
return {
{"", material, ""},
{material, "mcl_mobitems:blaze_rod", material},
{"", "mesecons:redstone", ""}
}
else
return {}
end
end
2024-05-03 18:36:39 +02:00
function mcl_copper.register_variants_recipes(name, material, amount)
local names
local materials = {}
if name ~= "cut" then
names = {
name, "waxed_"..name,
name.."_exposed", "waxed_"..name.."_exposed",
name.."_weathered", "waxed_"..name.."_weathered",
name.."_oxidized", "waxed_"..name.."_oxidized"
}
else
names = {
"block_"..name, "waxed_block_"..name,
"block_exposed_"..name, "waxed_block_exposed_"..name,
"block_weathered_"..name, "waxed_block_weathered_"..name,
"block_oxidized_"..name, "waxed_block_oxidized_"..name
}
end
2024-05-03 18:36:39 +02:00
if type(material) == "string" then
materials = {
"mcl_copper:"..material, "mcl_copper:waxed_"..material,
"mcl_copper:"..material.."_exposed", "mcl_copper:waxed_"..material.."_exposed",
"mcl_copper:"..material.."_weathered", "mcl_copper:waxed_"..material.."_weathered",
"mcl_copper:"..material.."_oxidized", "mcl_copper:waxed_"..material.."_oxidized"
}
elseif type(material) == "table" then
if #material == 8 then
materials = material
else
return
end
else
return
end
2024-05-03 18:36:39 +02:00
for i = 1, 8 do
minetest.register_craft({
output = "mcl_copper:"..names[i].." "..tostring(amount),
recipe = get_shape(name, materials[i])
})
end
end
mcl_copper.register_variants_recipes("cut", "block", 4)
mcl_copper.register_variants_recipes("grate", "block", 4)
mcl_copper.register_variants_recipes("door", "block", 3)
mcl_copper.register_variants_recipes("trapdoor", "block", 2)
mcl_copper.register_variants_recipes("bulb_off", "block", 4)
local chiseled_materials = {
"mcl_stairs:slab_copper_cut",
"mcl_stairs:slab_waxed_copper_cut",
"mcl_stairs:slab_copper_exposed_cut",
"mcl_stairs:slab_waxed_copper_exposed_cut",
"mcl_stairs:slab_copper_weathered_cut",
"mcl_stairs:slab_waxed_copper_weathered_cut",
"mcl_stairs:slab_copper_oxidized_cut",
"mcl_stairs:slab_waxed_copper_oxidized_cut"
}
mcl_copper.register_variants_recipes("chiseled", chiseled_materials, 1)
2024-05-03 18:36:39 +02:00
local waxable_blocks = {
"block",
"block_cut",
"grate",
"chiseled",
"bulb_off",
"block_exposed",
"block_exposed_cut",
"grate_exposed",
"chiseled_exposed",
"bulb_off_exposed",
"block_weathered",
"block_weathered_cut",
"grate_weathered",
"chiseled_weathered",
"bulb_off_weathered",
"block_oxidized",
"block_oxidized_cut",
"grate_oxidized",
"chiseled_oxidized",
"bulb_off_oxidized"
}
2022-11-15 22:02:05 +01:00
for _, w in ipairs(waxable_blocks) do
minetest.register_craft({
output = "mcl_copper:waxed_"..w,
recipe = {
{ "mcl_copper:"..w, "mcl_honey:honeycomb" },
},
})
end
2024-05-03 18:36:39 +02:00
local cuttable_blocks = {
"block",
"waxed_block",
"block_exposed",
"waxed_block_exposed",
"block_weathered",
"waxed_block_weathered",
"block_oxidized",
"waxed_block_oxidized"
}
2023-11-13 21:19:09 +01:00
2023-11-26 00:47:02 +01:00
for _, c in ipairs(cuttable_blocks) do
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c.."_cut", 4)
2024-05-03 18:36:39 +02:00
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "grate"), 4)
mcl_stonecutter.register_recipe("mcl_copper:"..c, "mcl_copper:"..c:gsub("block", "chiseled"), 4)
mcl_stonecutter.register_recipe("mcl_copper:"..c.."_cut", "mcl_copper:"..c:gsub("block", "chiseled"))
2023-11-13 21:19:09 +01:00
end
2022-05-01 03:11:51 +02:00
minetest.register_craft({
output = "mcl_copper:copper_ingot 9",
2022-05-01 03:11:51 +02:00
recipe = {
{ "mcl_copper:block" },
},
2022-05-01 03:11:51 +02:00
})
2022-05-01 03:11:51 +02:00
minetest.register_craft({
output = "mcl_copper:raw_copper 9",
recipe = {
{ "mcl_copper:block_raw" },
},
2022-05-01 03:11:51 +02:00
})
2022-05-01 03:11:51 +02:00
minetest.register_craft({
type = "cooking",
output = "mcl_copper:copper_ingot",
recipe = "mcl_copper:raw_copper",
cooktime = 10,
})
2022-05-01 03:11:51 +02:00
minetest.register_craft({
type = "cooking",
output = "mcl_copper:copper_ingot",
recipe = "mcl_copper:stone_with_copper",
cooktime = 10,
2022-11-15 22:02:05 +01:00
})
minetest.register_craft({
type = "cooking",
output = "mcl_copper:block",
recipe = "mcl_copper:block_raw",
cooktime = 90,
})