diff --git a/gradle.properties b/gradle.properties index 260d37fe..7fa6b742 100644 --- a/gradle.properties +++ b/gradle.properties @@ -8,7 +8,7 @@ org.gradle.jvmargs=-Xmx4G loader_version=0.14.6 # Mod Properties - mod_version = 1.18.2-1.0.1 + mod_version = 1.18.2-1.0.2 maven_group = tools.redstone archives_base_name = redstonetools diff --git a/src/main/java/tools/redstone/redstonetools/RedstoneToolsClient.java b/src/main/java/tools/redstone/redstonetools/RedstoneToolsClient.java index e6b283ce..b0d47f49 100644 --- a/src/main/java/tools/redstone/redstonetools/RedstoneToolsClient.java +++ b/src/main/java/tools/redstone/redstonetools/RedstoneToolsClient.java @@ -3,15 +3,15 @@ import com.google.inject.Guice; import com.google.inject.Injector; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.loader.api.FabricLoader; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -import tools.redstone.redstonetools.macros.MacroManager; import tools.redstone.redstonetools.macros.WorldlessCommandHelper; import tools.redstone.redstonetools.utils.ReflectionUtils; public class RedstoneToolsClient implements ClientModInitializer { public static final String MOD_ID = "redstonetools"; - public static final String MOD_VERSION = "v1.18.2-1.0.1"; + public static final String MOD_VERSION = "v" + FabricLoader.getInstance().getModContainer(MOD_ID).orElseThrow().getMetadata().getVersion().getFriendlyString(); public static final Logger LOGGER = LoggerFactory.getLogger(MOD_ID); public static final Injector INJECTOR = Guice.createInjector(ReflectionUtils.getModules()); diff --git a/src/main/java/tools/redstone/redstonetools/gui/UpdatePopupScreen.java b/src/main/java/tools/redstone/redstonetools/gui/UpdatePopupScreen.java index e4db97d1..f0741f31 100644 --- a/src/main/java/tools/redstone/redstonetools/gui/UpdatePopupScreen.java +++ b/src/main/java/tools/redstone/redstonetools/gui/UpdatePopupScreen.java @@ -1,11 +1,11 @@ package tools.redstone.redstonetools.gui; -import java.net.URI; -import java.awt.Desktop; - import net.minecraft.client.gui.screen.Screen; import net.minecraft.client.gui.widget.ButtonWidget; import net.minecraft.text.Text; +import net.minecraft.util.Util; + +import java.net.URI; import static tools.redstone.redstonetools.RedstoneToolsClient.MOD_VERSION; @@ -22,21 +22,12 @@ public UpdatePopupScreen(Screen parent, URI uri, String newVersion) { @Override protected void addButtons(int y) { this.addDrawableChild(new ButtonWidget(this.width / 2 + 5, y, 150, 20, Text.of("Go to release"), (button) -> { - try { - Desktop desktop = Desktop.getDesktop(); - - if (desktop.isSupported(Desktop.Action.BROWSE)) - desktop.browse(uri); - - - } catch (Exception e) { - e.printStackTrace(); - } + Util.getOperatingSystem().open(uri); + this.close(); })); this.addDrawableChild(new ButtonWidget(this.width / 2 - 155, y, 150, 20, Text.of("Ignore"), (button) -> { this.close(); })); } - } diff --git a/src/main/java/tools/redstone/redstonetools/mixin/UpdatePopupMixin.java b/src/main/java/tools/redstone/redstonetools/mixin/UpdatePopupMixin.java index 2756bfed..ae43495d 100644 --- a/src/main/java/tools/redstone/redstonetools/mixin/UpdatePopupMixin.java +++ b/src/main/java/tools/redstone/redstonetools/mixin/UpdatePopupMixin.java @@ -54,7 +54,7 @@ public void init(CallbackInfo ci) { Gson gson = new Gson(); JsonObject release = gson.fromJson(responseBody, JsonObject.class); - URI uri = new URI(release.get("url").getAsString()); + URI uri = new URI(release.get("html_url").getAsString()); String newVersion = release.get("tag_name").getAsString(); if (RedstoneToolsClient.MOD_VERSION.equals(newVersion) || newVersion.contains("alpha") || newVersion.contains("beta"))