2929import net .minecraft .client .gui .components .Button ;
3030import net .minecraft .client .gui .screens .Screen ;
3131import net .minecraft .client .gui .screens .TitleScreen ;
32+ import net .minecraft .client .input .MouseButtonEvent ;
3233import net .minecraft .network .chat .CommonComponents ;
3334import net .minecraft .network .chat .Component ;
3435import net .minecraft .util .ARGB ;
35- import org .visuals .legacy .animatium .util .ConfigUtil ;
3636import org .visuals .legacy .animatium .util .RenderUtils ;
37+ import org .visuals .legacy .animatium .util .config .ConfigUtil ;
38+ import org .visuals .legacy .animatium .util .config .Version ;
39+ import org .visuals .legacy .animatium .util .config .VersionUtil ;
3740
3841public class OnboardingScreen extends Screen {
3942 private final TitleScreen original ;
43+ private Version version = Version .MODERN ;
44+
45+ private Button v1_7Button = null ;
46+ private Button v1_8Button = null ;
47+ private Button modernButton = null ;
4048
4149 public OnboardingScreen (TitleScreen original ) {
4250 super (Component .literal ("Onboarding" ));
@@ -52,8 +60,22 @@ protected void init() {
5260 }
5361
5462 this .original .init (this .minecraft , this .width , this .height );
63+
64+ final int buttonWidth = 120 ;
65+ this .v1_7Button = this .addRenderableWidget (Button .builder (Component .literal ("1.7" ), button -> this .version = Version .V1_7 )
66+ .bounds (((this .width / 2 ) - (buttonWidth / 2 ) - (buttonWidth + Button .DEFAULT_SPACING )), this .height / 2 , buttonWidth , Button .DEFAULT_HEIGHT )
67+ .build ());
68+ this .v1_8Button = this .addRenderableWidget (Button .builder (Component .literal ("1.8" ), button -> this .version = Version .V1_8 )
69+ .bounds ((this .width / 2 ) - (buttonWidth / 2 ), this .height / 2 , buttonWidth , Button .DEFAULT_HEIGHT )
70+ .build ());
71+ this .modernButton = this .addRenderableWidget (Button .builder (Component .literal ("Modern" ), button -> this .version = Version .MODERN )
72+ .bounds (((this .width / 2 ) - (buttonWidth / 2 ) + (buttonWidth + Button .DEFAULT_SPACING )), this .height / 2 , buttonWidth , Button .DEFAULT_HEIGHT )
73+ .build ());
74+ updateVersionButtonState ();
75+
5576 this .addRenderableWidget (Button .builder (CommonComponents .GUI_DONE , button -> {
5677 ConfigUtil .put ("onboarding" , false );
78+ VersionUtil .setVersion (this .version );
5779 this .minecraft .setScreen (this .original );
5880 }).pos ((this .width / 2 ) - (Button .DEFAULT_WIDTH / 2 ), (int ) (this .height / 1.2F )).build ());
5981 }
@@ -62,15 +84,39 @@ protected void init() {
6284 public void render (GuiGraphics guiGraphics , int mouseX , int mouseY , float partialTick ) {
6385 this .original .render (guiGraphics , 0 , 0 , partialTick );
6486
65- guiGraphics .fill (0 , 0 , this .width , this .height , ARGB .color (0.67F , 0x000000 ));
87+ guiGraphics .fill (0 , 0 , this .width , this .height , ARGB .color (0.72F , 0x000000 ));
6688 super .render (guiGraphics , mouseX , mouseY , partialTick );
6789
68- RenderUtils .drawScaledText (guiGraphics , this .font , "Welcome to Animatium Onboarding!" , this .width / 2 , this .height / 4 , 1.67F );
90+ RenderUtils .drawScaledText (guiGraphics , this .font , "Welcome to Animatium Onboarding!" , this .width / 2 , this .height / 4 , 2.0F );
91+ guiGraphics .drawCenteredString (this .font , "Hello! Thank you for downloading Animatium!" , this .width / 2 , (int ) (this .height / 2.8 ), 0xFFD6D6D6 );
92+ guiGraphics .drawCenteredString (this .font , "Please select the version of visuals you would like to use!" , this .width / 2 , (int ) (this .height / 2.4 ), 0xFFD6D6D6 );
93+
94+ guiGraphics .drawCenteredString (this .font , "NOTE: If you have already went through this," , this .width / 2 , (int ) (this .height / 1.4F ), 0xFFFFA600 );
95+ guiGraphics .drawCenteredString (this .font , "ask for help in the discord before continuing!" , this .width / 2 , (int ) (this .height / 1.3F ), 0xFFFFA600 );
6996 }
7097
7198 @ Override
72- @ SuppressWarnings ({"DataFlowIssue" })
73- public void onClose () {
74- // ConfigUtil.put("onboarding", false);
99+ public boolean mouseClicked (MouseButtonEvent event , boolean isDoubleClick ) {
100+ if (this .v1_7Button .mouseClicked (event , isDoubleClick ) || this .v1_8Button .mouseClicked (event , isDoubleClick ) || this .modernButton .mouseClicked (event , isDoubleClick )) {
101+ updateVersionButtonState ();
102+ return true ;
103+ } else {
104+ return super .mouseClicked (event , isDoubleClick );
105+ }
106+ }
107+
108+ private void updateVersionButtonMessage (Button button ) {
109+ button .setMessage (button .getMessage ().copy ().withColor (button .isActive () ? ARGB .white (1.0F ) : 0xFFFFFFA0 ));
110+ }
111+
112+ private void updateVersionButtonState () {
113+ this .v1_7Button .active = this .version != Version .V1_7 ;
114+ updateVersionButtonMessage (this .v1_7Button );
115+
116+ this .v1_8Button .active = this .version != Version .V1_8 ;
117+ updateVersionButtonMessage (this .v1_8Button );
118+
119+ this .modernButton .active = this .version != Version .MODERN ;
120+ updateVersionButtonMessage (this .modernButton );
75121 }
76122}
0 commit comments