StyledChat
StyledChat copied to clipboard
Fix flickering text rendering on scoreboard when calling getDisplayName() from off of the main thread.
This one took a long time to debug, but it fixes https://github.com/GrimAnticheat/Grim/issues/2047. Grim runs lots of async tasks and processing on the netty thread and still needs to check permissions which on fabric requires a CommandSourceStack, the creation of which for a player via fabricPlayer.getCommandSource() calls fabricPlayer.getDisplayName() which causes the issue.
This PR returns the cached value of getDisplayName() when called from off the main thread, since the existing code is already built upon only updating within every tick regardless this breaks no existing behavior.