From fff0e572aa3c22fe215da5fe873429b4c1f5b7e6 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Fri, 2 Feb 2018 17:35:36 +0100 Subject: [PATCH] Don't allow to use empty nametag --- mods/ENTITIES/mobs/api.lua | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/mods/ENTITIES/mobs/api.lua b/mods/ENTITIES/mobs/api.lua index 03e2ba5aea..d564286f5c 100644 --- a/mods/ENTITIES/mobs/api.lua +++ b/mods/ENTITIES/mobs/api.lua @@ -3608,16 +3608,18 @@ function mobs:feed_tame(self, clicker, feed_count, breed, tame) if item:get_name() == "mobs:nametag" then local tag = item:get_meta():get_string("name") - if string.len(tag) > 30 then - tag = string.sub(tag, 1, 30) - end - self.nametag = tag + if tag ~= "" then + if string.len(tag) > 30 then + tag = string.sub(tag, 1, 30) + end + self.nametag = tag - update_tag(self) + update_tag(self) - if not mobs.is_creative(name) then - item:take_item() - player:set_wielded_item(item) + if not mobs.is_creative(name) then + item:take_item() + player:set_wielded_item(item) + end end end