aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--build.gradle8
-rw-r--r--src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt8
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/DulkirModMenuPlugin.kt11
-rw-r--r--src/main/resources/fabric.mod.json7
4 files changed, 29 insertions, 5 deletions
diff --git a/build.gradle b/build.gradle
index 2ff4b7e..f2cff89 100644
--- a/build.gradle
+++ b/build.gradle
@@ -27,6 +27,12 @@ repositories {
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
maven { url = "https://jitpack.io/" }
+ maven {
+ url "https://api.modrinth.com/maven"
+ content {
+ includeGroup("maven.modrinth")
+ }
+ }
}
dependencies {
@@ -47,6 +53,8 @@ dependencies {
modImplementation("moe.nea.jarvis:jarvis-api:1.1.1")
include("moe.nea.jarvis:jarvis-fabric:1.1.1")
modLocalRuntime("moe.nea.jarvis:jarvis-fabric:1.1.1")
+ modImplementation "maven.modrinth:modmenu:7.0.0"
+ modLocalRuntime "maven.modrinth:modmenu:7.0.0"
}
loom {
diff --git a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
index 5e2eb5d..93db1a0 100644
--- a/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
+++ b/src/main/kotlin/com/dulkirfabric/config/DulkirConfig.kt
@@ -38,9 +38,9 @@ class DulkirConfig {
private val buttonText: Text =
MutableText.of(LiteralTextContent("Dulkir")).formatted(Formatting.BOLD, Formatting.YELLOW)
- var screen: Screen
+ var screen: Screen = buildScreen(null)
- init {
+ fun buildScreen(parentScreen: Screen? = null): Screen {
val builder = ConfigBuilder.create().setTitle(buttonText)
builder.setDefaultBackgroundTexture(Identifier("minecraft:textures/block/oak_planks.png"))
builder.setGlobalized(true)
@@ -408,7 +408,9 @@ class DulkirConfig {
// .build()
// )
builder.transparentBackground()
- screen = builder.build()
+ if (parentScreen != null)
+ builder.setParentScreen(parentScreen)
+ return builder.build()
}
@Serializable
diff --git a/src/main/kotlin/com/dulkirfabric/util/DulkirModMenuPlugin.kt b/src/main/kotlin/com/dulkirfabric/util/DulkirModMenuPlugin.kt
new file mode 100644
index 0000000..40b731e
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/util/DulkirModMenuPlugin.kt
@@ -0,0 +1,11 @@
+package com.dulkirfabric.util
+
+import com.dulkirfabric.config.DulkirConfig
+import com.terraformersmc.modmenu.api.ConfigScreenFactory
+import com.terraformersmc.modmenu.api.ModMenuApi
+
+class DulkirModMenuPlugin : ModMenuApi {
+ override fun getModConfigScreenFactory(): ConfigScreenFactory<*> {
+ return ConfigScreenFactory { DulkirConfig().buildScreen(it) }
+ }
+} \ No newline at end of file
diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json
index 962251b..fabcfeb 100644
--- a/src/main/resources/fabric.mod.json
+++ b/src/main/resources/fabric.mod.json
@@ -26,8 +26,11 @@
],
"jarvis": [
"com.dulkirfabric.util.JarvisIntegrationPlugin"
- ]
- },
+ ],
+ "modmenu": [
+ "com.dulkirfabric.util.DulkirModMenuPlugin"
+ ]
+ },
"mixins": [
"dulkirmod-fabric.mixins.json"
],