Change bug fix so that loop carries on processing other items if first one is the issue.

This commit is contained in:
ancientmarinerdev 2023-06-27 18:06:09 +01:00
parent b05fa5562c
commit fe501e8021

View file

@ -85,24 +85,14 @@ local function hopper_take_item(self, dtime)
for k, v in pairs(objs) do for k, v in pairs(objs) do
local ent = v:get_luaentity() local ent = v:get_luaentity()
if not ent or (ent and ent._removed) or not ent.itemstring or ent.itemstring == "" then if ent and not ent._removed and ent.itemstring and ent.itemstring ~= "" then
--minetest.log("Ignore this item")
break
end
-- Don't forget actual hoppers
local taken_items = false local taken_items = false
mcl_log("ent.name: " .. tostring(ent.name)) mcl_log("ent.name: " .. tostring(ent.name))
mcl_log("ent pos: " .. tostring(ent.object:get_pos())) mcl_log("ent pos: " .. tostring(ent.object:get_pos()))
local inv = mcl_entity_invs.load_inv(self, 5) local inv = mcl_entity_invs.load_inv(self, 5)
if not inv then return false end
if not inv then
mcl_log("No inv")
return false
end
local current_itemstack = ItemStack(ent.itemstring) local current_itemstack = ItemStack(ent.itemstring)
@ -181,6 +171,8 @@ local function hopper_take_item(self, dtime)
else else
mcl_log("No need to save") mcl_log("No need to save")
end end
end
end end
end end