3535import javax .imageio .ImageIO ;
3636import javax .swing .*;
3737import java .awt .*;
38+ import java .awt .image .BufferedImage ;
3839import java .io .IOException ;
3940import java .io .InputStream ;
4041import java .math .RoundingMode ;
4142import java .nio .file .Files ;
4243import java .nio .file .Path ;
4344import java .text .DecimalFormat ;
45+ import java .time .LocalDate ;
46+ import java .time .Month ;
4447import java .util .List ;
4548import java .util .Random ;
4649import java .util .concurrent .atomic .AtomicBoolean ;
4750import java .util .concurrent .atomic .AtomicLong ;
4851
4952public class ThunderGUI extends JFrame {
50- private static List <String > MESSAGES = List .of (
51- "Your order is ready!" , "Also try Rainbow!" , "The floodgates are open!" ,
52- "Your pack has been converted!" , "(╯°□°)╯︵ ┻━┻"
53- );
54-
5553 private final DecimalFormat decimalFormat ;
5654 private final AtomicBoolean converting = new AtomicBoolean (false );
5755 private final AtomicLong startTime = new AtomicLong (0 );
@@ -62,7 +60,7 @@ public class ThunderGUI extends JFrame {
6260
6361 private Path inputPath = null ;
6462 private Path outputPath = null ;
65- private Icon currentIcon = null ;
63+ private BufferedImage currentIcon = null ;
6664
6765 public ThunderGUI (boolean debug ) throws IOException {
6866 vanillaPackPath = Path .of (System .getenv ("LOCALAPPDATA" ) != null ? System .getenv ("LOCALAPPDATA" ) : System .getProperty ("user.home" ), "Thunder" , "Vanilla-Assets.zip" );
@@ -74,6 +72,7 @@ public ThunderGUI(boolean debug) throws IOException {
7472 InputStream iconStream = Main .class .getResourceAsStream ("/icon.png" );
7573 if (iconStream != null ) this .setIconImage (ImageIO .read (iconStream ));
7674 this .setSize (800 , 300 );
75+ this .setLocationRelativeTo (null );
7776 this .setLayout (null );
7877 this .setDefaultCloseOperation (WindowConstants .EXIT_ON_CLOSE );
7978 this .setResizable (false );
@@ -141,21 +140,6 @@ public ThunderGUI(boolean debug) throws IOException {
141140 .pack ();
142141
143142 dataLabel .setText ("%s Converted! Time elapsed: %ss" .formatted (inputPath .getFileName ().toString (), decimalFormat .format ((System .currentTimeMillis () - startTime .get ()) / 1000d )));
144-
145- if (Desktop .isDesktopSupported () && Desktop .getDesktop ().isSupported (Desktop .Action .OPEN )) {
146- int option = JOptionPane .showConfirmDialog (
147- this ,
148- "%s Would you like to view the pack?" .formatted (MESSAGES .get (new Random ().nextInt (MESSAGES .size ()))),
149- "Pack Converted!" ,
150- JOptionPane .YES_NO_OPTION ,
151- JOptionPane .QUESTION_MESSAGE ,
152- currentIcon
153- );
154-
155- if (option == JOptionPane .YES_OPTION ) {
156- Desktop .getDesktop ().open (outputPath .getParent ().toFile ());
157- }
158- }
159143 } catch (Exception e ) {
160144 logListener .error ("An issue occured while converting:" , e );
161145 } finally {
@@ -215,10 +199,24 @@ public ThunderGUI(boolean debug) throws IOException {
215199 javaPackButton .setIcon (null );
216200 } else {
217201 javaPackButton .setText (null );
218- currentIcon = new BufferedImageIcon (
219- ImageUtil .resize (ImageIO .read (Files .newInputStream (iconPath )), 175 , 175 )
202+
203+ LocalDate date = LocalDate .now ();
204+
205+ currentIcon = ImageUtil .borderRadias (
206+ ImageUtil .resize (
207+ ImageIO .read (Files .newInputStream (iconPath )),
208+ 198 ,
209+ 198
210+ ),
211+ 5
220212 );
221- javaPackButton .setIcon (currentIcon );
213+
214+ if (date .getMonth ().equals (Month .APRIL ) && date .getDayOfMonth () == 1 ) {
215+ List <Integer > rotations = List .of (90 , 180 , 270 );
216+ currentIcon = ImageUtil .rotate (currentIcon , rotations .get (new Random ().nextInt (rotations .size ())));
217+ }
218+
219+ javaPackButton .setIcon (new BufferedImageIcon (currentIcon ));
222220 }
223221 });
224222 } catch (IOException e ) {
0 commit comments