This commit is contained in:
arsenicviscera 2026-03-10 18:05:50 -07:00
parent 907a9155e6
commit 6579d802d5
8 changed files with 47 additions and 11 deletions

View file

@ -1,7 +1,7 @@
#pragma once
#define VER_PRODUCTBUILD 560
#define VER_PRODUCTVERSION_STR_W L"DEV (unknown version)"
#define VER_PRODUCTVERSION_STR_W L""
#define VER_FILEVERSION_STR_W VER_PRODUCTVERSION_STR_W
#define VER_BRANCHVERSION_STR_W L"UNKNOWN BRANCH"
#define VER_BRANCHVERSION_STR_W L"UNKNOWN/"
#define VER_NETWORK VER_PRODUCTBUILD

View file

@ -465,11 +465,13 @@ 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); //This fills the "color" argument
}
else
{
renderNameTag(mob, msg, x, y, z, 64);
//but THIS. THIS works. ???
mob->nametagColor = 0xFFFF0000;
renderNameTag(mob, msg, x, y, z, 64, mob->nametagColor);
}
}
@ -548,7 +550,6 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
shared_ptr<Player> player = dynamic_pointer_cast<Player>(mob);
if(app.isXuidDeadmau5( player->getXuid() ) ) offs = -10;
#if defined(__PS3__) || defined(__ORBIS__)
// Check we have all the font characters for this player name
switch(player->GetPlayerNameValidState())
@ -649,14 +650,16 @@ void LivingEntityRenderer::renderNameTag(shared_ptr<LivingEntity> mob, const wst
t->end();
glDepthFunc(GL_LEQUAL);
glEnable(GL_TEXTURE_2D);
glTranslatef(0.0f, 0.0f, -0.04f);
}
if( textOpacity > 0.0f )
{
//This works as intended
int textColor = ( ( static_cast<int>(textOpacity * 255) << 24 ) | 0xffffff );
font->draw(playerName, -font->width(playerName) / 2, offs, textColor);
font->draw(L"PLR " + mob->SettingThis ? L"YES" : L"NO", -font->width(playerName) / 2, offs, textColor);
}
glEnable(GL_LIGHTING);

View file

@ -120,6 +120,7 @@ LocalPlayer::LocalPlayer(Minecraft *minecraft, Level *level, User *user, int dim
lastClickTolerance = 0.0f;
m_bHasAwardedStayinFrosty = false;
}
LocalPlayer::~LocalPlayer()

View file

@ -65,8 +65,7 @@ PlayerRenderer::PlayerRenderer() : LivingEntityRenderer( new HumanoidModel(0), 0
unsigned int PlayerRenderer::getNametagColour(int index)
{
if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS)
return nametagColorForIndex(index);
if( index >= 0 && index < MINECRAFT_NET_MAX_PLAYERS) return nametagColorForIndex(index);
return 0xFF000000;
}
@ -496,6 +495,23 @@ void PlayerRenderer::renderNameTags(shared_ptr<LivingEntity> player, double x, d
}
#endif
//Check if the player is a local or server player, and if so, add the gamertag prefix to the nametag
//For some reason this is a LivingEntity instead of a Player, but this is derived from LivingEntityRenderer so it makes sense
//Anyways just recast
if (player->instanceof(eTYPE_PLAYER)) {
shared_ptr<Player> plr = static_pointer_cast<Player>(player);
//This doesn't work for some reason
player->nametagColor = 0xFF0000FF;
//But this does??? nametagColor is still black in the renderNameTag method, but it is set to the correct color here, so maybe the renderNameTag method is using a different player instance or something?
player->SettingThis = true; //This is how I know
}
//Set it literally right before, mind you both player and mob are LivingEntity
player->nametagColor = 0xFF0000FF; //This doesn't do anything and is still black.
LivingEntityRenderer::renderNameTags(player, x, y, z, msg, scale, dist);
}

View file

@ -93,6 +93,8 @@ void LivingEntity::_init()
speed = 0.0f;
noJumpDelay = 0;
absorptionAmount = 0.0f;
nametagColor = 0xff000000; //default black
}
LivingEntity::LivingEntity( Level* level) : Entity(level)
@ -114,6 +116,7 @@ LivingEntity::LivingEntity( Level* level) : Entity(level)
yHeadRot = yRot;
footSize = 0.5f;
}
LivingEntity::~LivingEntity()

View file

@ -80,6 +80,9 @@ public:
float yHeadRot, yHeadRotO;
float flyingSpeed;
//New
int nametagColor;
bool SettingThis = false;
protected:
shared_ptr<Player> lastHurtByPlayer;
int lastHurtByPlayerTime;

View file

@ -41,6 +41,7 @@
#include "..\Minecraft.Client\LocalPlayer.h"
#include "..\Minecraft.Client\HumanoidModel.h"
#include "..\Minecraft.Client\Common\Colours\ColourTable.h"
#include "SoundTypes.h"
@ -101,6 +102,7 @@ void Player::_init()
m_bCheckedForModelParts=false;
m_bCheckedDLCForModelParts=false;
#if defined(__PS3__) || defined(__ORBIS__)
m_ePlayerNameValidState=ePlayerNameValid_NotSet;
#endif
@ -108,6 +110,8 @@ void Player::_init()
enderChestInventory = std::make_shared<PlayerEnderChestContainer>();
m_bAwardedOnARail=false;
}
Player::Player(Level *level, const wstring &name) : LivingEntity( level )
@ -145,13 +149,18 @@ Player::Player(Level *level, const wstring &name) : LivingEntity( level )
setShowOnMaps(app.GetGameHostOption(eGameHostOption_Gamertags)!=0?true:false);
m_bIsGuest = false;
#ifndef _XBOX_ONE
// 4J: Set UUID to name on none-XB1 consoles, may change in future but for now
// ownership of animals on these consoles is done by name
setUUID(name);
#endif
}
}
Player::~Player()
{
// TODO 4J

View file

@ -72,6 +72,7 @@ protected:
int jumpTriggerTime;
public:
BYTE userType;
float oBob, bob;