Skip to content

Commit

Permalink
Merge branch 'mcl-craftguide-recipes' into mcl-technic
Browse files Browse the repository at this point in the history
  • Loading branch information
nonfreegithub committed Nov 4, 2023
2 parents 72177c6 + eeeb403 commit 9e4285e
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 5 deletions.
1 change: 1 addition & 0 deletions .luacheckrc
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ read_globals = {
"craftguide", "i3", "mtt",
"vizlib", "mcl_sounds", "mcl_vars",
"mcl_worlds", "mcl_buckets", "mcl_formspec",
"mcl_craftguide",

-- Only used in technic/machines/MV/lighting.lua (disabled)
"isprotect", "homedecor_expect_infinite_stacks",
Expand Down
4 changes: 2 additions & 2 deletions technic/machines/register/alloy_recipes.lua
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ local recipes = {
-- "[Compounding a] pure gum vulcanizate … with 50% of its weight of carbon black
-- improves its tensile strength and wear resistance …"
{"technic:raw_latex 4", "technic:coal_dust 2", "technic:rubber 6", 2},
{mat.ice, "bucket:bucket_empty", "bucket:bucket_water", 1 },
{"default:obsidian", "bucket:bucket_empty", "bucket:bucket_lava", 1 },
{mat.ice, mat.bucket_empty, mat.bucket_water, 1 },
{mat.obsidian, mat.bucket_empty, mat.bucket_lava, 1 },
}

if minetest.get_modpath("ethereal") then
Expand Down
22 changes: 20 additions & 2 deletions technic/machines/register/recipes.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@

local have_ui = minetest.get_modpath("unified_inventory")
local have_cg = minetest.get_modpath("craftguide")
local have_mcl_cg = minetest.get_modpath("mcl_craftguide")
local have_i3 = minetest.get_modpath("i3")

technic.recipes = { cooking = { input_size = 1, output_size = 1 } }
Expand All @@ -23,6 +24,12 @@ function technic.register_recipe_type(typename, origdata)
icon = data.icon,
})
end
if have_mcl_cg then
mcl_craftguide.register_craft_type(typename, {
description = data.description,
icon = data.icon,
})
end
if have_i3 then
i3.register_craft_type(typename, {
description = data.description,
Expand Down Expand Up @@ -86,6 +93,14 @@ local function register_recipe(typename, data)
items = {table.concat(data.input, ", ")},
})
end
if have_mcl_cg then
mcl_craftguide.register_craft({
type = typename,
output = output,
items = data.input,
width = 0,
})
end
if have_i3 then
i3.register_craft({
type = typename,
Expand All @@ -97,7 +112,11 @@ local function register_recipe(typename, data)
end

function technic.register_recipe(typename, data)
minetest.after(0.01, register_recipe, typename, data) -- Handle aliases
if have_mcl_cg then
register_recipe(typename, data)
else
minetest.after(0.01, register_recipe, typename, data) -- Handle aliases
end
end

function technic.get_recipe(typename, items)
Expand Down Expand Up @@ -133,7 +152,6 @@ function technic.get_recipe(typename, items)
if recipe then
local new_input = {}
for i, stack in ipairs(items) do
if not stack:get_count() or not recipe.input[stack:get_name()] then return end
if stack:get_count() < recipe.input[stack:get_name()] then
return
else
Expand Down
2 changes: 1 addition & 1 deletion technic/mod.conf
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
name = technic
depends = pipeworks, technic_worldgen, basic_materials
optional_depends = mcl_core, mcl_sounds, default, bucket, mesecons, mesecons_mvps, digilines, digiline_remote, unified_inventory, dye, craftguide, i3, mtt, vizlib, moreores, mcl_buckets, mcl_explosions
optional_depends = mcl_core, mcl_sounds, default, bucket, mesecons, mesecons_mvps, digilines, digiline_remote, unified_inventory, dye, craftguide, i3, mtt, vizlib, moreores, mcl_buckets, mcl_explosions, mcl_craftguide

0 comments on commit 9e4285e

Please sign in to comment.