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 end
-- fallback to nameDB -- 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 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 end
return name return name or strId
end end
function itemDB:getMaxCount(item) function itemDB:getMaxCount(item)

View File

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