Fix: Multiplayer/Splitscreen Name Tags#1136
Open
tylerreese543-lab wants to merge 2 commits intosmartcmd:mainfrom
Open
Fix: Multiplayer/Splitscreen Name Tags#1136tylerreese543-lab wants to merge 2 commits intosmartcmd:mainfrom
tylerreese543-lab wants to merge 2 commits intosmartcmd:mainfrom
Conversation
Co-Authored-By: Ayush Thoren <ayushthoren@gmail.com>
Co-Authored-By: Ayush Thoren <ayushthoren@gmail.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Changes
Fixed the renderNameTags function, so player name tags appear in the correct colors.
Huge thanks to @ayushthoren for helping me with the fix. Most of this is his work but he wanted me to test and send the PR.
Previous Behavior
All name tags for players would render black.
Root Cause
Default "color" argument set to black in LivingEntityRenderer::renderNameTags().
New Behavior
Now queries the player index to get the proper nametagColor.
Fix Implementation
Added a new "nametagColor" int (initialized to black) to each LivingEntity. This can be built upon with dyed nametags (oouu), etc.
Changed PlayerRenderer::renderNameTags to be an override of the original. This initially caused replication errors with nametagColor.
In PlayerRenderer::renderNameTags, it sets nametagColor to getNametagColour(p->getPlayerIndex())
"p" is a player with a player->instanceof(eType_PLAYER) check and dynamic_pointer_cast(). This set is skipped if the entity in question is not a player.
AI Use Disclosure
No AI was used. 🫡
Related Issues