From cbd2731e0609354da4e7cee687cc7ccbfbde7893 Mon Sep 17 00:00:00 2001 From: Elias Fleckenstein Date: Fri, 9 Apr 2021 13:22:45 +0200 Subject: [PATCH] Improve mcl_bossbars performance --- mods/HUD/mcl_bossbars/init.lua | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/mods/HUD/mcl_bossbars/init.lua b/mods/HUD/mcl_bossbars/init.lua index 3a144aac..3ab1a83c 100644 --- a/mods/HUD/mcl_bossbars/init.lua +++ b/mods/HUD/mcl_bossbars/init.lua @@ -86,9 +86,10 @@ function mcl_bossbars.update_boss(luaentity, name, color) if not bardef.text or bardef.text == "" then bardef.text = name end - for _, obj in pairs(minetest.get_objects_inside_radius(object:get_pos(), 128)) do - if obj:is_player() then - mcl_bossbars.add_bar(obj, bardef) + local pos = object:get_pos() + for _, player in pairs(minetest.get_connected_players()) do + if vector.distance(pos, player:get_pos()) <= 80 then + mcl_bossbars.add_bar(player, bardef) end end end