diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index f44917ccf3..3628244940 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -543,8 +543,8 @@ core.register_entity(":__builtin:item", { -- Push item out when stuck inside solid opaque node if def and def.walkable and def.groups and def.groups.opaque == 1 then local shootdir - local cx = p.x % 1 - local cz = p.z % 1 + local cx = (p.x % 1) - 0.5 + local cz = (p.z % 1) - 0.5 local order = {} -- First prepare the order in which the 4 sides are to be checked. @@ -552,7 +552,7 @@ core.register_entity(":__builtin:item", { -- 2nd: other direction -- 3rd and 4th: other axis local cxcz = function(o, cw, one, zero) - if cw > 0 then + if cw < 0 then table.insert(o, { [one]=1, y=0, [zero]=0 }) table.insert(o, { [one]=-1, y=0, [zero]=0 }) else @@ -561,7 +561,7 @@ core.register_entity(":__builtin:item", { end return o end - if math.abs(cx) > math.abs(cz) then + if math.abs(cx) < math.abs(cz) then order = cxcz(order, cx, "x", "z") order = cxcz(order, cz, "z", "x") else