From f2a184c35209179e8c221c824a9c1081de1e4cf0 Mon Sep 17 00:00:00 2001 From: PseudoDistant Date: Fri, 5 Jan 2024 09:11:04 -0500 Subject: [PATCH] Add mods folder keybind --- gradle.properties | 2 +- .../minifabric_api/impl/ModsDisplay.java | 17 ++++++++++++++--- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/gradle.properties b/gradle.properties index 95199a4..8a07be9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -4,7 +4,7 @@ org.gradle.jvmargs=-Xmx1G loader_version=0.15.3 # Mod Properties - mod_version = 1.2.0 + mod_version = 1.2.1 maven_group = io.github.minifabric archives_base_name = minifabric-modmenu diff --git a/src/main/java/io/github/minifabric/minifabric_api/impl/ModsDisplay.java b/src/main/java/io/github/minifabric/minifabric_api/impl/ModsDisplay.java index 9b269ae..ab2e0d7 100644 --- a/src/main/java/io/github/minifabric/minifabric_api/impl/ModsDisplay.java +++ b/src/main/java/io/github/minifabric/minifabric_api/impl/ModsDisplay.java @@ -7,11 +7,15 @@ import minicraft.gfx.Font; import minicraft.gfx.Screen; import minicraft.screen.*; +import minicraft.screen.Menu; import minicraft.screen.entry.SelectEntry; import net.fabricmc.loader.api.FabricLoader; import net.fabricmc.loader.api.ModContainer; import net.fabricmc.loader.api.metadata.Person; +import java.awt.*; +import java.io.File; +import java.io.IOException; import java.util.ArrayList; import java.util.Collection; import java.util.Objects; @@ -99,7 +103,13 @@ public void tick(InputHandler input) { super.tick(input); if (input.getMappedKey("exit").isClicked()) { Game.setDisplay(parent); - } + } else if (input.getMappedKey("info").isClicked()) { + try { + Desktop.getDesktop().open(new File("mods/")); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } @Override @@ -143,8 +153,9 @@ public void render(Screen screen) { Font.drawCentered(Localization.getLocalized("Authors:") + " " + author, screen, Font.textHeight() * 5, col); } - Font.drawCentered(Game.input.getMapping("select") + Localization.getLocalized(" to confirm"), screen, Screen.h - 40, Color.GRAY); - Font.drawCentered(Game.input.getMapping("exit") + Localization.getLocalized(" to return"), screen, Screen.h - 20, Color.GRAY); + Font.drawCentered(Game.input.getMapping("info") + Localization.getLocalized(" to open mods folder"), screen, Screen.h - 30, Color.GRAY); + Font.drawCentered(Game.input.getMapping("select") + Localization.getLocalized(" to confirm"), screen, Screen.h - 20, Color.GRAY); + Font.drawCentered(Game.input.getMapping("exit") + Localization.getLocalized(" to return"), screen, Screen.h - 10, Color.GRAY); String title = Localization.getLocalized("Fabric Mod Menu"); int color = Color.WHITE;