diff --git a/mods/CORE/mcl_util/init.lua b/mods/CORE/mcl_util/init.lua index 0335e2037..e497077a2 100644 --- a/mods/CORE/mcl_util/init.lua +++ b/mods/CORE/mcl_util/init.lua @@ -1230,9 +1230,9 @@ function mcl_util.assign_uuid(obj) assert(obj) local le = obj:get_luaentity() - if le._uuid then return le._uuid end - - le._uuid = mcl_util.gen_uuid() + if not le._uuid then + le._uuid = mcl_util.gen_uuid() + end -- Update the cache with this new id aoid = mcl_util.get_active_object_id(obj) diff --git a/mods/ENTITIES/mcl_minecarts/carts.lua b/mods/ENTITIES/mcl_minecarts/carts.lua index 78cc552f7..00ee39356 100644 --- a/mods/ENTITIES/mcl_minecarts/carts.lua +++ b/mods/ENTITIES/mcl_minecarts/carts.lua @@ -470,21 +470,20 @@ local function respawn_cart(cart) local d = vector.distance(player:get_pos(), pos) if not distance or d < distance then distance = d end end - if not distance or distance > 115 then return end + if not distance or distance > 90 then return end - print("Respawning cart #"..cart.uuid.." at "..tostring(pos)..",distance="..distance) + print("Respawning cart #"..cart.uuid.." at "..tostring(pos)..",distance="..distance..",node="..minetest.get_node(pos).name) -- Update sequence so that old cart entities get removed cart.seq = (cart.seq or 1) + 1 save_cart_data(cart.uuid) - -- Create the new entity + -- Create the new entity and refresh caches local sd = minetest.serialize({ uuid=cart.uuid, seq=cart.seq }) local entity = minetest.add_entity(pos, cart_type, sd) local le = entity:get_luaentity() - le._seq = cart.seq - le._uuid = cart.uuid le._staticdata = cart + mcl_util.assign_uuid(entity) -- We intentionally don't call the normal hooks because this minecart was already there end