fix: wither and ender dragon custom names (#1472)
This commit is contained in:
@@ -89,6 +89,11 @@ void EnderDragonRenderer::render(shared_ptr<Entity> _mob, double x, double y, do
|
|||||||
// 4J - dynamic cast required because we aren't using templates/generics in our version
|
// 4J - dynamic cast required because we aren't using templates/generics in our version
|
||||||
shared_ptr<EnderDragon> mob = dynamic_pointer_cast<EnderDragon>(_mob);
|
shared_ptr<EnderDragon> mob = dynamic_pointer_cast<EnderDragon>(_mob);
|
||||||
BossMobGuiInfo::setBossHealth(mob, false);
|
BossMobGuiInfo::setBossHealth(mob, false);
|
||||||
|
if (!mob->getCustomName().empty())
|
||||||
|
{
|
||||||
|
BossMobGuiInfo::name = mob->getCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
MobRenderer::render(mob, x, y, z, rot, a);
|
MobRenderer::render(mob, x, y, z, rot, a);
|
||||||
if (mob->nearestCrystal != nullptr)
|
if (mob->nearestCrystal != nullptr)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,10 @@ void WitherBossRenderer::render(shared_ptr<Entity> entity, double x, double y, d
|
|||||||
shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(entity);
|
shared_ptr<WitherBoss> mob = dynamic_pointer_cast<WitherBoss>(entity);
|
||||||
|
|
||||||
BossMobGuiInfo::setBossHealth(mob, true);
|
BossMobGuiInfo::setBossHealth(mob, true);
|
||||||
|
if (!mob->getCustomName().empty())
|
||||||
|
{
|
||||||
|
BossMobGuiInfo::name = mob->getCustomName();
|
||||||
|
}
|
||||||
|
|
||||||
int modelVersion = dynamic_cast<WitherBossModel*>(model)->modelVersion();
|
int modelVersion = dynamic_cast<WitherBossModel*>(model)->modelVersion();
|
||||||
if (modelVersion != this->modelVersion)
|
if (modelVersion != this->modelVersion)
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ public:
|
|||||||
double getHeadPartYRotDiff(int partIndex, doubleArray bodyPos, doubleArray partPos);
|
double getHeadPartYRotDiff(int partIndex, doubleArray bodyPos, doubleArray partPos);
|
||||||
Vec3 *getHeadLookVector(float a);
|
Vec3 *getHeadLookVector(float a);
|
||||||
|
|
||||||
virtual wstring getAName() { return app.GetString(IDS_ENDERDRAGON); };
|
virtual wstring getAName() { if (hasCustomName()) return getCustomName(); return app.GetString(IDS_ENDERDRAGON); };
|
||||||
virtual float getHealth() { return LivingEntity::getHealth(); };
|
virtual float getHealth() { return LivingEntity::getHealth(); };
|
||||||
virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); };
|
virtual float getMaxHealth() { return LivingEntity::getMaxHealth(); };
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -105,5 +105,5 @@ public:
|
|||||||
// 4J Stu - These are required for the BossMob interface
|
// 4J Stu - These are required for the BossMob interface
|
||||||
virtual float getMaxHealth() { return Monster::getMaxHealth(); };
|
virtual float getMaxHealth() { return Monster::getMaxHealth(); };
|
||||||
virtual float getHealth() { return Monster::getHealth(); };
|
virtual float getHealth() { return Monster::getHealth(); };
|
||||||
virtual wstring getAName() { return app.GetString(IDS_WITHER); };
|
virtual wstring getAName() { if (hasCustomName()) return getCustomName(); return app.GetString(IDS_WITHER); };
|
||||||
};
|
};
|
||||||
Reference in New Issue
Block a user