Merge pull request 'Fix hopper cart crash' (#3821) from fix_cart_hopper_crash into master

Reviewed-on: https://git.minetest.land/MineClone2/MineClone2/pulls/3821
This commit is contained in:
ancientmarinerdev 2023-06-28 20:35:37 +00:00
commit 823f7ee5c7

View file

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