1515import net .wurstclient .clickgui .Component ;
1616import net .wurstclient .settings .Setting ;
1717import net .wurstclient .util .RenderUtils ;
18+ import net .wurstclient .util .WurstFont ;
1819
1920public abstract class AbstractListEditButton extends Component
2021{
2122 private static final ClickGui GUI = WURST .getGui ();
22- private static final Font TR = MC .font ;
23+
24+ private static Font getFont ()
25+ {
26+ return WurstFont .get ();
27+ }
2328
2429 private final String buttonText = "Edit..." ;
25- private final int buttonWidth = TR .width (buttonText );
30+
31+ private int getButtonWidth ()
32+ {
33+ return getFont ().width (buttonText );
34+ }
2635
2736 protected abstract void openScreen ();
2837
@@ -37,6 +46,7 @@ public void handleMouseClick(double mouseX, double mouseY, int mouseButton,
3746 if (mouseButton != GLFW .GLFW_MOUSE_BUTTON_LEFT )
3847 return ;
3948
49+ int buttonWidth = getButtonWidth ();
4050 if (mouseX < getX () + getWidth () - buttonWidth - 4 )
4151 return ;
4252
@@ -49,6 +59,7 @@ public void render(GuiGraphics context, int mouseX, int mouseY,
4959 {
5060 int x1 = getX ();
5161 int x2 = x1 + getWidth ();
62+ int buttonWidth = getButtonWidth ();
5263 int x3 = x2 - buttonWidth - 4 ;
5364 int y1 = getY ();
5465 int y2 = y1 + getHeight ();
@@ -71,8 +82,9 @@ public void render(GuiGraphics context, int mouseX, int mouseY,
7182 // text
7283 int txtColor = GUI .getTxtColor ();
7384 context .guiRenderState .up ();
74- context .drawString (TR , getText (), x1 , y1 + 2 , txtColor , false );
75- context .drawString (TR , buttonText , x3 + 2 , y1 + 2 , txtColor , false );
85+ context .drawString (getFont (), getText (), x1 , y1 + 2 , txtColor , false );
86+ context .drawString (getFont (), buttonText , x3 + 2 , y1 + 2 , txtColor ,
87+ false );
7688 }
7789
7890 private int getFillColor (boolean hovering )
@@ -84,7 +96,8 @@ private int getFillColor(boolean hovering)
8496 @ Override
8597 public int getDefaultWidth ()
8698 {
87- return TR .width (getText ()) + buttonWidth + 6 ;
99+ int buttonWidth = getButtonWidth ();
100+ return getFont ().width (getText ()) + buttonWidth + 6 ;
88101 }
89102
90103 @ Override
0 commit comments