diff --git a/build.gradle b/build.gradle index 23fe268..add2f85 100644 --- a/build.gradle +++ b/build.gradle @@ -71,7 +71,7 @@ jar { modrinth { token = System.getenv("MODRINTH_TOKEN") // This is the default. Remember to have the MODRINTH_TOKEN environment variable set or else this will fail, or set it to whatever you want - just make sure it stays private! projectId = project.archives_base_name // This can be the project ID or the slug. Either will work! - versionNumber = project.version // You don't need to set this manually. Will fail if Modrinth has this version already + versionNumber = "${project.minecraft_version}-${project.version}" // You don't need to set this manually. Will fail if Modrinth has this version already versionName = "[1.19.x] HitBox+ ${project.version}" versionType = project.release_type // This is the default -- can also be `beta` or `alpha` uploadFile = remapJar // With Loom, this MUST be set to `remapJar` instead of `jar`! @@ -81,7 +81,7 @@ modrinth { // scope.type // The scope can be `required`, `optional`, `incompatible`, or `embedded` // The type can either be `project` or `version` - required.project "modmenu" + optional.project "modmenu" required.project "cloth-config" } syncBodyFrom = rootProject.file("README.md").text diff --git a/src/main/java/io/github/pingisfun/hitboxplus/HitboxPlus.java b/src/main/java/io/github/pingisfun/hitboxplus/HitboxPlus.java index 7b61ab1..f55dde3 100644 --- a/src/main/java/io/github/pingisfun/hitboxplus/HitboxPlus.java +++ b/src/main/java/io/github/pingisfun/hitboxplus/HitboxPlus.java @@ -3,6 +3,11 @@ import me.shedaniel.autoconfig.AutoConfig; import me.shedaniel.autoconfig.serializer.GsonConfigSerializer; import net.fabricmc.api.ModInitializer; +import net.fabricmc.fabric.api.client.event.lifecycle.v1.ClientTickEvents; +import net.fabricmc.fabric.api.client.keybinding.v1.KeyBindingHelper; +import net.minecraft.client.gui.screen.Screen; +import net.minecraft.client.option.KeyBinding; +import net.minecraft.client.util.InputUtil; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -34,5 +39,15 @@ public void onInitialize() { // However, some things (like resources) may still be uninitialized. // Proceed with mild caution. AutoConfig.register(ModConfig.class, GsonConfigSerializer::new); + + KeyBinding keyBinding = new KeyBinding("Open Config", InputUtil.GLFW_KEY_B, "HitBox+"); + KeyBindingHelper.registerKeyBinding(keyBinding); + + ClientTickEvents.END_CLIENT_TICK.register(client -> { + if (keyBinding.isPressed()) { + Screen configScreen = AutoConfig.getConfigScreen(ModConfig.class, client.currentScreen).get(); + client.setScreen(configScreen); + } + }); } }