diff --git a/common/src/main/java/com/vaporvee/loadsupport/Allocated.java b/common/src/main/java/com/vaporvee/loadsupport/Allocated.java index cc8b200..5348b15 100644 --- a/common/src/main/java/com/vaporvee/loadsupport/Allocated.java +++ b/common/src/main/java/com/vaporvee/loadsupport/Allocated.java @@ -5,6 +5,7 @@ import com.vaporvee.loadsupport.platform.Services; import javax.swing.*; import java.awt.*; import java.net.URI; +import java.util.Objects; public class Allocated { public static float memoryInGB; @@ -48,15 +49,18 @@ public class Allocated { try { if (enoughMemory) { enoughMemory = false; + UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); SwingUtilities.invokeLater(() -> { String[] warning = getWarningMessage(); errorWindow = new JFrame(warning[0]); + Image icon = new ImageIcon(Objects.requireNonNull(Allocated.class.getResource("/assets/" + Constants.MOD_ID + "/icon.png"))).getImage(); + errorWindow.setIconImage(icon); errorWindow.setDefaultCloseOperation(JDialog.DISPOSE_ON_CLOSE); errorWindow.setSize(500, 350); errorWindow.setLocationRelativeTo(null); JLabel message = new JLabel( - "

" + warning[1] + "

", + "

" + warning[1] + "

", JLabel.CENTER ); @@ -88,8 +92,10 @@ public class Allocated { errorWindow.setVisible(true); }); } - } catch (RuntimeException e) { + } catch (RuntimeException | ClassNotFoundException | InstantiationException | IllegalAccessException e) { Constants.LOG.error(String.valueOf(e)); + } catch (UnsupportedLookAndFeelException e) { + throw new RuntimeException(e); } } } diff --git a/common/src/main/resources/assets/loadsupport/icon.png b/common/src/main/resources/assets/loadsupport/icon.png new file mode 100644 index 0000000..c34e000 Binary files /dev/null and b/common/src/main/resources/assets/loadsupport/icon.png differ diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b66f7be..8c4135a 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -12,7 +12,7 @@ "sources": "https://github.com/FabricMC/fabric-example-mod" }, "license": "${license}", - "icon": "${mod_id}.png", + "icon": "assets/${mod_id}/icon.png", "environment": "*", "entrypoints": { "main": [ diff --git a/neoforge/src/main/resources/META-INF/neoforge.mods.toml b/neoforge/src/main/resources/META-INF/neoforge.mods.toml index b008f60..348b775 100644 --- a/neoforge/src/main/resources/META-INF/neoforge.mods.toml +++ b/neoforge/src/main/resources/META-INF/neoforge.mods.toml @@ -8,7 +8,7 @@ version = "${version}" #mandatory displayName = "${mod_name}" #mandatory #updateJSONURL="https://change.me.example.invalid/updates.json" #optional (see https://docs.neoforged.net/docs/misc/updatechecker/) #displayURL="https://change.me.to.your.mods.homepage.example.invalid/" #optional (displayed in the mod UI) -logoFile="${mod_id}.png" #optional +logoFile="assets/${mod_id}/icon.png" #optional credits="${credits}" #optional authors = "${mod_author}" #optional description = '''${description}''' #mandatory (Supports multiline text)