From 0ddecdff2a6270a2dd0a1ecddf56e67582c68b30 Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 13 Oct 2024 14:37:40 -0500 Subject: [PATCH] Add workaround to prevent random detached inventory doesn't exist warning when right-clicking entities with inventory --- mods/ENTITIES/mcl_entity_invs/init.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/mods/ENTITIES/mcl_entity_invs/init.lua b/mods/ENTITIES/mcl_entity_invs/init.lua index ee9b50318..4bcffede4 100644 --- a/mods/ENTITIES/mcl_entity_invs/init.lua +++ b/mods/ENTITIES/mcl_entity_invs/init.lua @@ -113,7 +113,11 @@ function mcl_entity_invs.show_inv_form(ent,player,text) local playername = player:get_player_name() - minetest.show_formspec(playername, ent._inv_id, load_default_formspec (ent, text)) + -- Workaround: wait at least 50ms to ensure that the detached inventory exists before + -- the formspec attempts to use it. (See https://git.minetest.land/VoxeLibre/VoxeLibre/issues/4670#issuecomment-84875) + minetest.after(0.05, function() + minetest.show_formspec(playername, ent._inv_id, load_default_formspec (ent, text)) + end) end local function drop_inv(ent)