Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Minecraft.Client/LivingEntityRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -465,11 +465,11 @@ void LivingEntityRenderer::renderNameTags(shared_ptr<LivingEntity> mob, double x
{
if (mob->isSleeping())
{
renderNameTag(mob, msg, x, y - 1.5f, z, 64);
renderNameTag(mob, msg, x, y - 1.5f, z, 64, mob->nametagColor);
}
else
{
renderNameTag(mob, msg, x, y, z, 64);
renderNameTag(mob, msg, x, y, z, 64, mob->nametagColor);
}
}

Expand Down
9 changes: 8 additions & 1 deletion Minecraft.Client/PlayerRenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,7 @@ void PlayerRenderer::additionalRendering(shared_ptr<LivingEntity> _mob, float a)
}
}

void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist)
void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring& msg, float scale, double dist)
{
#if 0
if (dist < 10 * 10)
Expand All @@ -496,6 +496,13 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
}
#endif

if (player->instanceof(eTYPE_PLAYER)) {
shared_ptr<Player> p = dynamic_pointer_cast<Player>(player);
p->nametagColor = getNametagColour(p->getPlayerIndex());
}
else {
player->nametagColor = 0xFF000000;
}
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
}

Expand Down
2 changes: 1 addition & 1 deletion Minecraft.Client/PlayerRenderer.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class PlayerRenderer : public LivingEntityRenderer

protected:
virtual void additionalRendering(shared_ptr<LivingEntity> _mob, float a);
void renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, wstring msg, float scale, double dist);
virtual void renderNameTags(shared_ptr<LivingEntity> player, double x, double y, double z, const wstring& msg, float scale, double dist) override;

virtual void scale(shared_ptr<LivingEntity> _player, float a);
public:
Expand Down
2 changes: 2 additions & 0 deletions Minecraft.World/LivingEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ void LivingEntity::_init()
speed = 0.0f;
noJumpDelay = 0;
absorptionAmount = 0.0f;

nametagColor = 0xFF000000; //default to black. Overridden by stuff
}

LivingEntity::LivingEntity( Level* level) : Entity(level)
Expand Down
2 changes: 2 additions & 0 deletions Minecraft.World/LivingEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ class LivingEntity : public Entity
float yHeadRot, yHeadRotO;
float flyingSpeed;

int nametagColor;

protected:
shared_ptr<Player> lastHurtByPlayer;
int lastHurtByPlayerTime;
Expand Down