@@ -26,13 +26,23 @@ public class RainglowConfigScreen extends SpruceScreen {
26
26
private final SpruceOption resetOption ;
27
27
private RainglowMode mode ;
28
28
29
+ private SpruceLabelWidget coloursToApplyLabel ;
30
+
29
31
public RainglowConfigScreen (@ Nullable Screen parent ) {
30
32
super (Rainglow .translatableText ("config.title" ));
31
33
this .parent = parent ;
32
34
this .mode = Rainglow .CONFIG .getMode ();
33
35
34
36
this .modeOption = new SpruceCyclingOption (Rainglow .translatableTextKey ("config.mode" ),
35
- amount -> mode = mode .cycle (),
37
+ amount -> {
38
+ mode = mode .cycle ();
39
+ this .remove (coloursToApplyLabel );
40
+ StringBuilder coloursToApply = new StringBuilder (Language .getInstance ().get (Rainglow .translatableTextKey ("config.colours_to_apply" )));
41
+ appendColours (coloursToApply , this .mode );
42
+ Style style = Style .EMPTY .withColor (this .mode .getText ().getStyle ().getColor ());
43
+ this .coloursToApplyLabel = new SpruceLabelWidget (Position .of (this , this .width / 2 - 108 , this .height / 4 + 20 ), Text .literal (coloursToApply .toString ()).setStyle (style ), this .width , true );
44
+ this .addDrawableChild (coloursToApplyLabel );
45
+ },
36
46
option -> option .getDisplayText (mode .getText ()),
37
47
Rainglow .translatableText ("tooltip.mode" ,
38
48
List .of (RainglowMode .values ())
@@ -72,11 +82,17 @@ protected void init() {
72
82
this .addDrawableChild (this .customOption .createWidget (Position .of (this .width / 2 + 5 , this .height / 6 - buttonHeight + buttonOffset ), 200 ));
73
83
74
84
this .addDrawableChild (new SpruceLabelWidget (Position .of (this , 0 , this .height / 9 ), Rainglow .translatableText ("config.title" ), this .width , true ));
85
+
75
86
StringBuilder text = new StringBuilder (Language .getInstance ().get (Rainglow .translatableTextKey ("config.current_colours" )));
76
- for (SquidColour colour : Rainglow .CONFIG .getMode ().getColours ()) {
77
- text .append ("\n " ).append (Language .getInstance ().get (Rainglow .translatableTextKey ("colour." + colour .getId ())));
78
- }
79
- this .addDrawableChild (new SpruceLabelWidget (Position .of (this , 0 , this .height / 4 + buttonHeight ), Text .of (text .toString ()).copy ().setStyle (Style .EMPTY .withColor (Rainglow .CONFIG .getMode ().getText ().getStyle ().getColor ())), this .width , true ));
87
+ appendColours (text , Rainglow .CONFIG .getMode ());
88
+ Style style = Style .EMPTY .withColor (Rainglow .CONFIG .getMode ().getText ().getStyle ().getColor ());
89
+ this .addDrawableChild (new SpruceLabelWidget (Position .of (this , this .width / 2 - 318 , this .height / 4 + buttonHeight ), Text .literal (text .toString ()).setStyle (style ), this .width , true ));
90
+
91
+ StringBuilder coloursToApply = new StringBuilder (Language .getInstance ().get (Rainglow .translatableTextKey ("config.colours_to_apply" )));
92
+ appendColours (coloursToApply , this .mode );
93
+ style = Style .EMPTY .withColor (this .mode .getText ().getStyle ().getColor ());
94
+ this .coloursToApplyLabel = new SpruceLabelWidget (Position .of (this , this .width / 2 - 108 , this .height / 4 + buttonHeight ), Text .literal (coloursToApply .toString ()).setStyle (style ), this .width , true );
95
+ this .addDrawableChild (coloursToApplyLabel );
80
96
81
97
this .addDrawableChild (this .resetOption .createWidget (Position .of (this , this .width / 2 - 155 , this .height - 29 ), 150 ));
82
98
this .addDrawableChild (new SpruceButtonWidget (Position .of (this , this .width / 2 - 155 + 160 , this .height - 29 ), 150 ,
@@ -87,4 +103,10 @@ protected void init() {
87
103
}
88
104
));
89
105
}
106
+
107
+ private void appendColours (StringBuilder text , RainglowMode mode ) {
108
+ for (SquidColour colour : mode .getColours ()) {
109
+ text .append ("\n " ).append (Language .getInstance ().get (Rainglow .translatableTextKey ("colour." + colour .getId ())));
110
+ }
111
+ }
90
112
}
0 commit comments