Fixed auto-feeder

This commit is contained in:
rspx
2023-03-26 15:11:23 +02:00
committed by Kan18
parent aef1bfa186
commit a9202a7034

View File

@@ -58,9 +58,9 @@ local function getFood(food)
for slot,v in pairs(ni.getInventory().list()) do for slot,v in pairs(ni.getInventory().list()) do
local key = itemDB:makeKey(v) local key = itemDB:makeKey(v)
if key == food then if key == food then
local item = ni.getInventory().getItem(slot) local item = ni.getInventory().getItemDetail(slot)
if item and item.consume then if item and item.saturation then
return item return slot
end end
break break
end end
@@ -87,7 +87,7 @@ Event.onInterval(5, function()
if context.state.food and ni.getMetaOwner().food.hungry then if context.state.food and ni.getMetaOwner().food.hungry then
local item = getFood(context.state.food) local item = getFood(context.state.food)
if item then if item then
item.consume() ni.getInventory().consume(item)
end end
end end
end) end)
@@ -101,4 +101,4 @@ return {
callback = function() callback = function()
UI:setPage(page) UI:setPage(page)
end, end,
} }