-
Bug
-
Resolution: Fixed
-
1.19.2, 22w42a, 22w43a, 22w44a, 22w45a, 1.19.3, 23w06a, 1.19.4, 1.20.1
-
Community Consensus
-
Internationalisation
-
Low
-
Platform
The Bug:
The two characters used within the tab list to show players' health are untranslatable.
The "hp" characters that are used to show the players' health within the tab list are missing a translation key.
Steps to Reproduce:
- Attempt to search for the existence of this string by using this search filter on the official Minecraft crowdin project.
- Take note as to whether or not the two characters used within the tab list to show players' health are untranslatable.
Observed Behavior:
The two characters used within the tab list to show players' health are untranslatable.
Expected Behavior:
The two characters used within the tab list to show players' health would be translatable.
Code Analysis:
Code analysis by Avoma can be found below.
The following is based on a decompiled version of Minecraft 1.19.2 using Mojang mappings.
net.minecraft.client.gui.components.PlayerTabOverlay.java
public class PlayerTabOverlay extends GuiComponent { ... private void renderTablistScore(Objective objective, int n, String string, int n2, int n3, PlayerInfo playerInfo, PoseStack poseStack) { int n4 = objective.getScoreboard().getOrCreatePlayerScore(string, objective).getScore(); if (objective.getRenderType() == ObjectiveCriteria.RenderType.HEARTS) { ... if (n5 > 0) { ... if (n7 > 3) { ... } else { float f = Mth.clamp((float)n4 / 20.0f, 0.0f, 1.0f); int n9 = (int)((1.0f - f) * 255.0f) << 16 | (int)(f * 255.0f) << 8; String string2 = "" + (float)n4 / 2.0f; if (n3 - this.minecraft.font.width(string2 + "hp") >= n2) { string2 = string2 + "hp"; } this.minecraft.font.drawShadow(poseStack, string2, (float)((n3 + n2) / 2 - this.minecraft.font.width(string2) / 2), (float)n, n9); } ...
If we look at the above class, we can see that the two characters used within the tab list to show players' health are hardcoded, and as a result, are untranslatable. This is evident through the following piece of code:
if (n3 - this.minecraft.font.width(string2 + "hp") >= n2) { string2 = string2 + "hp";