|
8 | 8 | import com.formdev.flatlaf.FlatLightLaf; |
9 | 9 | import java.awt.Color; |
10 | 10 | import java.awt.event.ItemEvent; |
11 | | -import java.io.BufferedOutputStream; |
12 | | -import java.io.File; |
13 | | -import java.io.FileInputStream; |
14 | | -import java.io.FileOutputStream; |
15 | | -import java.io.IOException; |
| 11 | +import java.io.*; |
16 | 12 | import java.net.MalformedURLException; |
17 | 13 | import java.net.URL; |
| 14 | +import java.nio.file.Files; |
18 | 15 | import java.nio.file.Path; |
19 | | -import java.util.Collections; |
20 | | -import java.util.List; |
21 | | -import java.util.Objects; |
22 | | -import java.util.Scanner; |
| 16 | +import java.util.*; |
23 | 17 | import java.util.concurrent.ExecutionException; |
24 | 18 | import java.util.zip.ZipEntry; |
25 | 19 | import java.util.zip.ZipInputStream; |
@@ -664,19 +658,39 @@ private void installButtonMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIR |
664 | 658 | return; |
665 | 659 | } |
666 | 660 |
|
667 | | - installButton.setText("Completed!"); |
668 | | - //installButton.setMargin(new java.awt.Insets(10, 80, 10, 80)); |
| 661 | + File configDir = getVanillaGameDir().resolve("config").toFile(); |
| 662 | + if (!configDir.exists() || !configDir.isDirectory()) { |
| 663 | + configDir.mkdir(); |
| 664 | + } |
| 665 | + Path ipDir = getVanillaGameDir().resolve("config").resolve("iris.properties"); |
| 666 | + Properties irisProp = new Properties(); |
| 667 | + if (Files.exists(ipDir)) { |
| 668 | + try (InputStream is = Files.newInputStream(ipDir)) { |
| 669 | + irisProp.load(is); |
| 670 | + } catch (IOException e) { |
| 671 | + System.out.println("Failed to read iris.properties"); |
| 672 | + } |
| 673 | + } |
| 674 | + irisProp.setProperty("shaderPack", finalShaderName); |
| 675 | + irisProp.setProperty("enableShaders", "true"); |
| 676 | + try (OutputStream os = Files.newOutputStream(ipDir)) { |
| 677 | + irisProp.store(os, "File written by Comp Installer"); |
| 678 | + } catch (IOException e) { |
| 679 | + System.out.println("Failed to write iris.properties"); |
| 680 | + } |
669 | 681 |
|
| 682 | + installButton.setText("Completed!"); |
670 | 683 | progressBar.setForeground(new Color(39, 195, 75)); |
671 | 684 | installButton.setEnabled(false); |
672 | 685 | finishedSuccessfulInstall = true; |
673 | | - |
674 | 686 | System.out.println("Finished Successful Install"); |
| 687 | + String loaderMsg = installAsMod ? "fabric-loader" : "iris-fabric-loader"; |
675 | 688 | String msg = "Successfully installed Iris, Sodium, and " |
676 | | - +finalShaderName; |
| 689 | + +finalShaderName+ |
| 690 | + "\nYou can launch the game by selecting the "+loaderMsg+" installation in your Minecraft launcher."; |
677 | 691 | JOptionPane.showMessageDialog(this, |
678 | 692 | msg, "Installation Complete!", JOptionPane.PLAIN_MESSAGE, new ImageIcon(Objects.requireNonNull(Utils.class.getClassLoader().getResource("green_tick.png")))); |
679 | | - System.exit(111); |
| 693 | + System.exit(0); |
680 | 694 | return; |
681 | 695 | } |
682 | 696 | }); |
|
0 commit comments