diff --git a/items.lua b/items.lua index 19920aa..e8dfcf9 100644 --- a/items.lua +++ b/items.lua @@ -63,6 +63,7 @@ function Cache.makeCache(cacheLoader) local entry = nil if #chest.list() == 0 and type(cacheLoader) == "function" then + print("Using cacheloader") entry = cacheLoader(name, chest) end @@ -174,6 +175,10 @@ function Cache:find(predicate) end local function checkField(base, check) + if type(base) == "function" then + return base(check) + end + local baseType = type(base) if baseType == nil then return true @@ -198,10 +203,10 @@ end function FILTER_MATCHING_SLOTS(target) return function(detail) - return checkField(target.name, detail.name) and + return target == nil or (checkField(target.name, detail.name) and checkField(target.displayName, detail.displayName) and checkField(target.damage, detail.damage) and - checkField(target.enchantments, detail.enchantments) + checkField(target.enchantments, detail.enchantments)) end end