Refactor and speed up get_item_usages
This commit is contained in:
parent
4c1177ac26
commit
060caad104
8
init.lua
8
init.lua
|
@ -465,13 +465,8 @@ end
|
|||
|
||||
local function get_item_usages(item)
|
||||
local usages = {}
|
||||
for name, def in pairs(reg_items) do
|
||||
if not (def.groups.not_in_craft_guide == 1 or
|
||||
def.groups.not_in_creative_inventory == 1) and
|
||||
get_recipe(name).items and
|
||||
def.description and def.description ~= "" then
|
||||
|
||||
local recipes = recipes_cache[name]
|
||||
for _, recipes in pairs(recipes_cache) do
|
||||
for i = 1, #recipes do
|
||||
local recipe = recipes[i]
|
||||
if item_in_recipe(item, recipe) then
|
||||
|
@ -479,7 +474,6 @@ local function get_item_usages(item)
|
|||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if fuel_cache[item] then
|
||||
usages[#usages + 1] = {type = "fuel", width = 1, items = {item}}
|
||||
|
|
Loading…
Reference in New Issue