@@ -107,7 +107,7 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
107107
108108 for (Object2IntMap .Entry <Statistic > entry : session .getStatistics ().object2IntEntrySet ()) {
109109 if (entry .getKey () instanceof BreakItemStatistic statistic ) {
110- String item = itemRegistry .get (statistic .getId ()). javaIdentifier ( );
110+ Item item = itemRegistry .get (statistic .getId ());
111111 content .add (getItemTranslateKey (item , language ) + ": " + entry .getIntValue ());
112112 }
113113 }
@@ -117,7 +117,7 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
117117
118118 for (Object2IntMap .Entry <Statistic > entry : session .getStatistics ().object2IntEntrySet ()) {
119119 if (entry .getKey () instanceof CraftItemStatistic statistic ) {
120- String item = itemRegistry .get (statistic .getId ()). javaIdentifier ( );
120+ Item item = itemRegistry .get (statistic .getId ());
121121 content .add (getItemTranslateKey (item , language ) + ": " + entry .getIntValue ());
122122 }
123123 }
@@ -127,7 +127,7 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
127127
128128 for (Object2IntMap .Entry <Statistic > entry : session .getStatistics ().object2IntEntrySet ()) {
129129 if (entry .getKey () instanceof UseItemStatistic statistic ) {
130- String item = itemRegistry .get (statistic .getId ()). javaIdentifier ( );
130+ Item item = itemRegistry .get (statistic .getId ());
131131 content .add (getItemTranslateKey (item , language ) + ": " + entry .getIntValue ());
132132 }
133133 }
@@ -137,7 +137,7 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
137137
138138 for (Object2IntMap .Entry <Statistic > entry : session .getStatistics ().object2IntEntrySet ()) {
139139 if (entry .getKey () instanceof PickupItemStatistic statistic ) {
140- String item = itemRegistry .get (statistic .getId ()). javaIdentifier ( );
140+ Item item = itemRegistry .get (statistic .getId ());
141141 content .add (getItemTranslateKey (item , language ) + ": " + entry .getIntValue ());
142142 }
143143 }
@@ -147,7 +147,7 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
147147
148148 for (Object2IntMap .Entry <Statistic > entry : session .getStatistics ().object2IntEntrySet ()) {
149149 if (entry .getKey () instanceof DropItemStatistic statistic ) {
150- String item = itemRegistry .get (statistic .getId ()). javaIdentifier ( );
150+ Item item = itemRegistry .get (statistic .getId ());
151151 content .add (getItemTranslateKey (item , language ) + ": " + entry .getIntValue ());
152152 }
153153 }
@@ -208,14 +208,8 @@ public static void buildAndSendStatisticsMenu(GeyserSession session) {
208208 * @param language the language to search in
209209 * @return the full name of the item
210210 */
211- private static String getItemTranslateKey (String item , String language ) {
212- item = item .replace ("minecraft:" , "item.minecraft." );
213- String translatedItem = MinecraftLocale .getLocaleString (item , language );
214- if (translatedItem .equals (item )) {
215- // Didn't translate; must be a block
216- translatedItem = MinecraftLocale .getLocaleString (item .replace ("item." , "block." ), language );
217- }
218- return translatedItem ;
211+ private static String getItemTranslateKey (Item item , String language ) {
212+ return MinecraftLocale .getLocaleString (item .translationKey (), language );
219213 }
220214
221215 private static String translate (String keys , String locale ) {
0 commit comments