From 86d6445f421219a0e72b65761d3af291d47de694 Mon Sep 17 00:00:00 2001 From: Sumyjkl Date: Thu, 28 Jul 2022 11:10:56 +1000 Subject: [PATCH] fix crash when items in unloaded chunk --- mods/ENTITIES/mcl_item_entity/init.lua | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/mods/ENTITIES/mcl_item_entity/init.lua b/mods/ENTITIES/mcl_item_entity/init.lua index 6640b835f..5a82ca1fd 100644 --- a/mods/ENTITIES/mcl_item_entity/init.lua +++ b/mods/ENTITIES/mcl_item_entity/init.lua @@ -649,6 +649,12 @@ minetest.register_entity(":__builtin:item", { local node = minetest.get_node_or_nil(p) local in_unloaded = (node == nil) + if in_unloaded then + -- Don't infinetly fall into unloaded map + disable_physics(self.object, self) + return + end + if self.is_clock then self.object:set_properties({ textures = {"mcl_clock:clock_" .. (mcl_worlds.clock_works(p) and mcl_clock.old_time or mcl_clock.random_frame)} @@ -680,11 +686,6 @@ minetest.register_entity(":__builtin:item", { enable_physics(self.object, self) return end - if in_unloaded then - -- Don't infinetly fall into unloaded map - disable_physics(self.object, self) - return - end -- Destroy item in lava, fire or special nodes