mirror of
https://github.com/minetest-mods/unified_inventory.git
synced 2024-12-26 10:40:28 +01:00
Categories: Remove not_in_creative_inventory
items
`unified_inventory.is_itemdef_listable` already prevents such items being listed. They are not needed, thus removing them from the categories in the first place does make sense. Co-authored-by: SmallJoker <mk939@ymail.com>
This commit is contained in:
parent
b5de18b196
commit
2c9449b6e7
16
api.lua
16
api.lua
@ -187,8 +187,9 @@ minetest.after(0.01, function()
|
||||
-- Remove unknown items from all categories
|
||||
local total_removed = 0
|
||||
for cat_name, cat_def in pairs(ui.registered_category_items) do
|
||||
for itemname, exists in pairs(cat_def) do
|
||||
if exists and not minetest.registered_items[itemname] then
|
||||
for itemname, _ in pairs(cat_def) do
|
||||
local idef = minetest.registered_items[itemname]
|
||||
if not idef then
|
||||
total_removed = total_removed + 1
|
||||
--[[
|
||||
-- For analysis
|
||||
@ -197,12 +198,21 @@ minetest.after(0.01, function()
|
||||
.. "'. Reason: item not registered")
|
||||
]]
|
||||
cat_def[itemname] = nil
|
||||
elseif not ui.is_itemdef_listable(idef) then
|
||||
total_removed = total_removed + 1
|
||||
--[[
|
||||
-- For analysis
|
||||
minetest.log("warning", "[unified_inventory] Removed item '"
|
||||
.. itemname .. "' from category '" .. cat_name
|
||||
.. "'. Reason: item is in 'not_in_creative_inventory' group")
|
||||
]]
|
||||
cat_def[itemname] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
if total_removed > 0 then
|
||||
minetest.log("info", "[unified_inventory] Removed " .. total_removed ..
|
||||
" unknown items from the categories.")
|
||||
" items from the categories.")
|
||||
end
|
||||
|
||||
for _, callback in ipairs(ui.initialized_callbacks) do
|
||||
|
Loading…
Reference in New Issue
Block a user