From ca9d0aa4e2c1b6dfd914f77a9cde349ee62a9851 Mon Sep 17 00:00:00 2001 From: TheHyper45 Date: Sun, 20 Jun 2021 09:39:52 +0100 Subject: Add Prettify method to get player-friendly names of mobs --- src/Entities/Entity.cpp | 12 ++---------- 1 file changed, 2 insertions(+), 10 deletions(-) (limited to 'src/Entities/Entity.cpp') diff --git a/src/Entities/Entity.cpp b/src/Entities/Entity.cpp index b6a67859b..c4f61ad1e 100644 --- a/src/Entities/Entity.cpp +++ b/src/Entities/Entity.cpp @@ -16,6 +16,7 @@ #include "../FastRandom.h" #include "../NetherPortalScanner.h" #include "../BoundingBox.h" +#include "../WorldStorage/NamespaceSerializer.h" @@ -2364,16 +2365,7 @@ void cEntity::BroadcastDeathMessage(TakeDamageInfo & a_TDI) } else { - // Tamed ocelots are really cats in vanilla. - if (Monster->IsTame() && (Monster->GetClass() == AString("cOcelot"))) - { - Name = "Cat"; - } - else - { - Name = Monster->GetClass(); - Name.erase(Name.begin()); // Erase the 'c' of the class (e.g. "cWitch" -> "Witch") - } + Name = AString(NamespaceSerializer::Prettify(Monster->GetMobType(), Monster->IsTame())); } } else -- cgit v1.2.3