@@ -334,85 +334,85 @@ private void renderEntries(GuiGraphics context, Font font, int mouseX,
334334 : withAlpha (cfg .getPanelColor (), 0.86F );
335335 context .fill (listX1 + 2 , y1 , listX2 - 2 , y2 , rowColor );
336336
337- String left ;
338- String right ;
339- if (mode == Mode .ADD_SELECT )
340- {
341- left = entry .keybind ().getDescription ();
342- right = entry .keybind ().getCommand ();
343- }else
344- {
345- left = entry .key ().replace ("key.keyboard." , "" ) + ": "
346- + entry .keybind ().getDescription ();
347- right = entry .keybind ().getCommand ();
348- }
349-
350- int rowX1 = listX1 + 6 ;
351- int rowX2 = listX2 - 6 ;
352- int rowW = Math .max (1 , rowX2 - rowX1 );
353- int columnGap = 10 ;
354- int leftW = Math .max (80 , (int )(rowW * 0.56 ));
355- int leftX1 = rowX1 ;
356- int leftX2 = Math .min (rowX2 - columnGap , leftX1 + leftW );
357- int rightX1 = Math .min (rowX2 , leftX2 + columnGap );
358- int rightX2 = rowX2 ;
359-
360- drawStaticStringInBox (context , font , left , leftX1 , y1 , leftX2 , y2 ,
361- cfg .getTextColor (), 0 );
362- drawMarqueeStringInBox (context , font , right , rightX1 , y1 , rightX2 ,
363- y2 , cfg .getMutedTextColor (), 0 );
364- }
365- }
366-
367- private void drawStaticStringInBox (GuiGraphics context , Font font ,
368- String text , int x1 , int y1 , int x2 , int y2 , int color , int padX )
369- {
370- if (text == null || text .isEmpty ())
371- return ;
372-
373- int innerX1 = x1 + Math .max (0 , padX );
374- int innerX2 = x2 - Math .max (0 , padX );
375- if (innerX2 <= innerX1 )
376- return ;
377-
378- int textY = y1 + Math .max (0 , ((y2 - y1 ) - font .lineHeight ) / 2 );
379- context .enableScissor (innerX1 , y1 , innerX2 , y2 );
380- context .drawString (font , text , innerX1 , textY , color , false );
381- context .disableScissor ();
382- }
383-
384- private void drawMarqueeStringInBox (GuiGraphics context , Font font ,
385- String text , int x1 , int y1 , int x2 , int y2 , int color , int padX )
386- {
387- if (text == null || text .isEmpty ())
388- return ;
389-
390- int innerX1 = x1 + Math .max (0 , padX );
391- int innerX2 = x2 - Math .max (0 , padX );
392- if (innerX2 <= innerX1 )
393- return ;
394-
395- int innerW = innerX2 - innerX1 ;
396- int textW = Math .max (1 , font .width (text ));
397- int textY = y1 + Math .max (0 , ((y2 - y1 ) - font .lineHeight ) / 2 );
398- int textX = innerX1 ;
399-
400- if (textW > innerW )
401- {
402- int overflow = textW - innerW ;
403- int ticks = minecraft != null && minecraft .gui != null
404- ? minecraft .gui .getGuiTicks ()
405- : (int )(System .currentTimeMillis () / 50L );
406- float cycle = 220F ;
407- float phase = (ticks % (int )cycle ) / cycle ;
408- float pingPong = phase <= 0.5F ? phase * 2F : (1F - phase ) * 2F ;
409- textX = innerX1 - Math .round (overflow * pingPong );
410- }
411-
412- context .enableScissor (innerX1 , y1 , innerX2 , y2 );
413- context .drawString (font , text , textX , textY , color , false );
414- context .disableScissor ();
415- }
337+ String left ;
338+ String right ;
339+ if (mode == Mode .ADD_SELECT )
340+ {
341+ left = entry .keybind ().getDescription ();
342+ right = entry .keybind ().getCommand ();
343+ }else
344+ {
345+ left = entry .key ().replace ("key.keyboard." , "" ) + ": "
346+ + entry .keybind ().getDescription ();
347+ right = entry .keybind ().getCommand ();
348+ }
349+
350+ int rowX1 = listX1 + 6 ;
351+ int rowX2 = listX2 - 6 ;
352+ int rowW = Math .max (1 , rowX2 - rowX1 );
353+ int columnGap = 10 ;
354+ int leftW = Math .max (80 , (int )(rowW * 0.56 ));
355+ int leftX1 = rowX1 ;
356+ int leftX2 = Math .min (rowX2 - columnGap , leftX1 + leftW );
357+ int rightX1 = Math .min (rowX2 , leftX2 + columnGap );
358+ int rightX2 = rowX2 ;
359+
360+ drawStaticStringInBox (context , font , left , leftX1 , y1 , leftX2 , y2 ,
361+ cfg .getTextColor (), 0 );
362+ drawMarqueeStringInBox (context , font , right , rightX1 , y1 , rightX2 ,
363+ y2 , cfg .getMutedTextColor (), 0 );
364+ }
365+ }
366+
367+ private void drawStaticStringInBox (GuiGraphics context , Font font ,
368+ String text , int x1 , int y1 , int x2 , int y2 , int color , int padX )
369+ {
370+ if (text == null || text .isEmpty ())
371+ return ;
372+
373+ int innerX1 = x1 + Math .max (0 , padX );
374+ int innerX2 = x2 - Math .max (0 , padX );
375+ if (innerX2 <= innerX1 )
376+ return ;
377+
378+ int textY = y1 + Math .max (0 , ((y2 - y1 ) - font .lineHeight ) / 2 );
379+ context .enableScissor (innerX1 , y1 , innerX2 , y2 );
380+ context .drawString (font , text , innerX1 , textY , color , false );
381+ context .disableScissor ();
382+ }
383+
384+ private void drawMarqueeStringInBox (GuiGraphics context , Font font ,
385+ String text , int x1 , int y1 , int x2 , int y2 , int color , int padX )
386+ {
387+ if (text == null || text .isEmpty ())
388+ return ;
389+
390+ int innerX1 = x1 + Math .max (0 , padX );
391+ int innerX2 = x2 - Math .max (0 , padX );
392+ if (innerX2 <= innerX1 )
393+ return ;
394+
395+ int innerW = innerX2 - innerX1 ;
396+ int textW = Math .max (1 , font .width (text ));
397+ int textY = y1 + Math .max (0 , ((y2 - y1 ) - font .lineHeight ) / 2 );
398+ int textX = innerX1 ;
399+
400+ if (textW > innerW )
401+ {
402+ int overflow = textW - innerW ;
403+ int ticks = minecraft != null && minecraft .gui != null
404+ ? minecraft .gui .getGuiTicks ()
405+ : (int )(System .currentTimeMillis () / 50L );
406+ float cycle = 220F ;
407+ float phase = (ticks % (int )cycle ) / cycle ;
408+ float pingPong = phase <= 0.5F ? phase * 2F : (1F - phase ) * 2F ;
409+ textX = innerX1 - Math .round (overflow * pingPong );
410+ }
411+
412+ context .enableScissor (innerX1 , y1 , innerX2 , y2 );
413+ context .drawString (font , text , textX , textY , color , false );
414+ context .disableScissor ();
415+ }
416416
417417 private void renderFooter (GuiGraphics context , Font font , int mouseX ,
418418 int mouseY )
0 commit comments