Performance improvement

This commit is contained in:
anarquimico 2023-03-02 09:20:00 -03:00
parent 8825fb9860
commit 5093f31f28

View file

@ -447,14 +447,16 @@ mcl_mobs.register_mob("mobs_mc:enderman", {
-- ATTACK ENDERMITE -- ATTACK ENDERMITE
local enderpos = self.object:get_pos() local enderpos = self.object:get_pos()
local mobsnear = minetest.get_objects_inside_radius(enderpos, 64) if math.random(1,20) == 1 then
for n=1, #mobsnear do local mobsnear = minetest.get_objects_inside_radius(enderpos, 64)
local mob = mobsnear[n] for n=1, #mobsnear do
if mob then local mob = mobsnear[n]
local entity = mob:get_luaentity() if mob then
if entity and entity.name == "mobs_mc:endermite" then local entity = mob:get_luaentity()
self.state = 'attack' if entity and entity.name == "mobs_mc:endermite" then
self.attack = mob self.state = 'attack'
self.attack = mob
end
end end
end end
end end