diff --git a/mods/HUD/mcl_inventory/creative.lua b/mods/HUD/mcl_inventory/creative.lua index 7504b080b..a2e510d53 100644 --- a/mods/HUD/mcl_inventory/creative.lua +++ b/mods/HUD/mcl_inventory/creative.lua @@ -72,6 +72,8 @@ minetest.register_on_mods_loaded(function() -- Is set to true if it was added in any category besides misc local nonmisc = false + -- Is set to true if it has already been added to the "all" category (special handler) + local all_handled = false if def.groups.building_block then table.insert(inventory_lists["blocks"], name) nonmisc = true @@ -120,8 +122,10 @@ minetest.register_on_mods_loaded(function() meta:set_float("vl_fireworks:duration", tbl[1]) meta:set_int("vl_fireworks:force", tbl[2]) table.insert(inventory_lists["misc"], stack:to_string()) + table.insert(inventory_lists["all"], stack:to_string()) end nonmisc = true + all_handled = true end -- Misc. category is for everything which is not in any other category if not nonmisc then @@ -143,7 +147,9 @@ minetest.register_on_mods_loaded(function() table.insert(inventory_lists["brew"], stack:to_string()) table.insert(inventory_lists["all"], stack:to_string()) end - else + end + + if not all_handled then table.insert(inventory_lists["all"], name) end @@ -200,12 +206,11 @@ local function set_inv_search(filter, player) local inv = minetest.get_inventory({ type = "detached", name = "creative_" .. playername }) local creative_list = {} local lang = minetest.get_player_information(playername).lang_code - 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 - if filter_item(string.lower(def.name), def.description, lang, filter) then - table.insert(creative_list, name) - end + for _, str in pairs(inventory_lists["all"]) do + local stack = ItemStack(str) + if filter_item(stack:get_name(), minetest.strip_colors(stack:get_description()), lang, filter) + and stack:get_name() ~= "mcl_enchanting:book_enchanted" then + table.insert(creative_list, stack:to_string()) end end for ench, def in pairs(mcl_enchanting.enchantments) do