From 1ed5d7db4fa9ea313d899723d2081ae969c03cb7 Mon Sep 17 00:00:00 2001 From: Jaidyn Ann <10477760+JadedCtrl@users.noreply.github.com> Date: Wed, 14 Aug 2024 13:25:13 -0500 Subject: [PATCH] Only display/register visible recipes Respect the group not_in_craftguide. --- init.lua | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/init.lua b/init.lua index 83dd290..883aa1f 100644 --- a/init.lua +++ b/init.lua @@ -499,11 +499,16 @@ end function visible_items(data) local ret = {} for item,_ in pairs(data.held_items) do - table.insert(ret, item) + if _ and item ~= "" then + table.insert(ret, item) + end end for item,_ in pairs(data.known_items) do - table.insert(ret, item) + if _ and item ~= "" then + table.insert(ret, item) + end end + table.sort(ret) return ret end @@ -529,8 +534,11 @@ function update_known_items(player, item_name) -- Mark items craftable with this (and other) items as known. local new_recipes = 0 for _,out_item_name in pairs(known_crafting_outputs(data, item_name)) do - new_recipes = new_recipes + 1 data.known_items[out_item_name] = true + if show_item(minetest.registered_items[out_item_name]) then + new_recipes = new_recipes + 1 + data.known_items[out_item_name] = true + end end -- Reset item-list.