11package com .lx862 .quitgame ;
22
3- import net .minecraft .client .Minecraft ;
43import net .minecraft .client .gui .Font ;
54import net .minecraft .client .gui .GuiGraphics ;
6- import net .minecraft .util .ARGB ;
5+ import net .minecraft .network .chat .Component ;
6+ import net .minecraft .network .chat .Style ;
77import org .joml .Vector2f ;
88
99public class SplashTextCharacter {
10- private final char character ;
10+ private final String character ;
11+ private final Style style ;
1112 private Vector2f startPos ;
1213 private Vector2f targetPos ;
1314 private Vector2f renderedPos ;
1415 private boolean dragging ;
1516 public double width ;
1617
17- public SplashTextCharacter (char character ) {
18+ public SplashTextCharacter (Font font , String character , Style style ) {
1819 this .character = character ;
20+ this .style = style ;
1921 this .targetPos = new Vector2f (0 , 0 );
2022 this .renderedPos = new Vector2f (0 , 0 );
21- this .width = Minecraft . getInstance (). font .width (String . valueOf (character ));
23+ this .width = font .width (Component . literal (character ). withStyle ( style ));
2224 }
2325
24- public char getChar () {
26+ public String getChar () {
2527 return character ;
2628 }
2729
@@ -58,8 +60,8 @@ public void render(GuiGraphics guiGraphics, double deltaTime, float alpha, Font
5860
5961 guiGraphics .pose ().pushMatrix ();
6062 guiGraphics .pose ().translate (renderedPos .x , renderedPos .y );
61- guiGraphics .pose ().rotate ((float )(-QuitGame . rotAngle * Math .PI ) / 180f );
62- guiGraphics .drawString (font , String . valueOf ( character ), 0 , 0 , ARGB .color (alpha , 16776960 ));
63+ guiGraphics .pose ().rotate ((float )(-ReorderableSplashText . SPLASH_TILT_ANGLE * Math .PI ) / 180f );
64+ guiGraphics .drawString (font , getComponent ( ), 0 , 0 , 0xFFFFFFFF /* ARGB.color(alpha, 16776960)*/ );
6365 guiGraphics .pose ().popMatrix ();
6466 }
6567
@@ -69,7 +71,11 @@ public void renderBoundary(GuiGraphics guiGraphics, double deltaTime, Font font)
6971 double endX = ((width + 0.5 ) * QuitGame .scale );
7072 double endY = ((8 + 2 ) * QuitGame .scale );
7173
72- guiGraphics .submitOutline ((int )startX , (int )startY , (int )endX , (int )endY , 0xFFFFFFFF );
74+ guiGraphics .renderOutline ((int )startX , (int )startY , (int )endX , (int )endY , 0xFFFFFFFF );
75+ }
76+
77+ public Component getComponent () {
78+ return Component .literal (character ).withStyle (style );
7379 }
7480
7581 public void dragged () {
0 commit comments