0
0
Fork 0

Add function to replace mobs

This commit is contained in:
NO11 2021-09-09 09:54:58 +00:00 committed by Gitea
parent 8e3f9d2169
commit e4af02ea52
1 changed files with 9 additions and 0 deletions

View File

@ -538,3 +538,12 @@ function mcl_util.get_object_name(object)
return luaentity.nametag and luaentity.nametag ~= "" and luaentity.nametag or luaentity.description or luaentity.name
end
end
function mcl_util.replace_mob(obj, mob)
local rot = obj:get_yaw()
local pos = obj:get_pos()
obj:remove()
obj = minetest.add_entity(pos, mob)
obj:set_yaw(rot)
return obj
end