Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Setting to hide items without crafting recipe #178

Closed
Bastrabun opened this issue Jul 14, 2021 · 2 comments
Closed

Setting to hide items without crafting recipe #178

Bastrabun opened this issue Jul 14, 2021 · 2 comments

Comments

@Bastrabun
Copy link

Can you please add a setting that hides items in the crafting guide, when they have no crafting recipe?

I believe I can remember a version where this was default, but sometime in between got changed

@SmallJoker
Copy link
Member

Relevant code in case anyone would like to work on it.

for name, def in pairs(minetest.registered_items) do
if (not def.groups.not_in_creative_inventory or
def.groups.not_in_creative_inventory == 0) and
def.description and def.description ~= "" then
table.insert(ui.items_list, name)
local all_names = rev_aliases[name] or {}
table.insert(all_names, name)
for _, player_name in ipairs(all_names) do
local recipes = minetest.get_all_craft_recipes(player_name)
if recipes then
for _, recipe in ipairs(recipes) do
local unknowns
for _,chk in pairs(recipe.items) do
local groupchk = string.find(chk, "group:")
if (not groupchk and not minetest.registered_items[chk])
or (groupchk and not ui.get_group_item(string.gsub(chk, "group:", "")).item)
or minetest.get_item_group(chk, "not_in_craft_guide") ~= 0 then
unknowns = true
end
end
if not unknowns then
ui.register_craft(recipe)
end
end
end
end
end
end

@SmallJoker
Copy link
Member

Added in #240

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants