fuzzy recipe ingredients

This commit is contained in:
kepler155c
2018-02-21 04:44:37 -05:00
parent ade176e977
commit b92b620e4d
2 changed files with 8 additions and 6 deletions

View File

@@ -146,11 +146,12 @@ function itemDB:getName(item)
end
-- fallback to nameDB
local name = nameDB:getName(item.name .. ':' .. (item.damage or '*'))
local strId = self:makeKey(item)
local name = nameDB.data[strId]
if not name and not item.damage then
return self:getName({ name = item.name, damage = 0, nbtHash = item.nbtHash })
name = nameDB.data[self:makeKey({ name = item.name, damage = 0, nbtHash = item.nbtHash })]
end
return name
return name or strId
end
function itemDB:getMaxCount(item)

View File

@@ -168,9 +168,10 @@ function Craft.findRecipe(key)
end
-- handle cases where the request is like : IC2:reactorVent:*
for _,recipe in pairs(Craft.recipes) do
if item.name == recipe.name and
(not item.nbtHash or recipe.nbtHash == item.nbtHash) then
for rkey,recipe in pairs(Craft.recipes) do
local r = itemDB:splitKey(rkey)
if item.name == r.name and
(not item.nbtHash or r.nbtHash == item.nbtHash) then
return recipe
end
end