Skip to content

Commit 41a2fab

Browse files
committed
use dummy src for mod menu mod
1 parent 4f98c48 commit 41a2fab

6 files changed

Lines changed: 49 additions & 18 deletions

File tree

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
plugins {
2-
id("dev.tocraft.modmaster.root") version ("single-1.9")
2+
id("dev.tocraft.modmaster.root") version ("single-1.10.1")
33
}
44

55
val clothConfigVersion: String? = properties["cloth_config_version"] as String

common/build.gradle.kts

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ plugins {
22
id("dev.tocraft.modmaster.common")
33
}
44

5-
val clothConfigVersion: String? = parent!!.properties["cloth_config_version"] as String
5+
val clothConfigVersion: String = parent!!.properties["cloth_config_version"] as String
66

77
repositories {
88
maven("https://maven.terraformersmc.com/releases/")
@@ -13,9 +13,7 @@ dependencies {
1313
// mixin extras
1414
implementation(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.properties["mixinextras_version"]}")!!)
1515
// Cloth Config
16-
if (clothConfigVersion != null) {
17-
modCompileOnly("me.shedaniel.cloth:cloth-config:${clothConfigVersion}") {
18-
exclude("net.fabricmc.fabric-api")
19-
}
16+
modCompileOnly("me.shedaniel.cloth:cloth-config:${clothConfigVersion}") {
17+
exclude("net.fabricmc.fabric-api")
2018
}
2119
}

fabric/build.gradle.kts

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ tasks.withType<ProcessResources> {
1515

1616
val modMenuVersion: String? = parent!!.properties["modmenu_version"] as String
1717

18-
val clothConfigVersion: String? = parent!!.properties["cloth_config_version"] as String
18+
val clothConfigVersion: String = parent!!.properties["cloth_config_version"] as String
1919

2020
repositories {
2121
maven("https://maven.terraformersmc.com/releases/")
@@ -26,17 +26,12 @@ dependencies {
2626
// mixin extras
2727
include(implementation(annotationProcessor("io.github.llamalad7:mixinextras-fabric:${rootProject.properties["mixinextras_version"]}")!!)!!)
2828
if (modMenuVersion != null) {
29-
modCompileOnly("com.terraformersmc:modmenu:${modMenuVersion}") {
30-
isTransitive = false
31-
}
3229
modRuntimeOnly("com.terraformersmc:modmenu:${modMenuVersion}") {
3330
isTransitive = false
3431
}
3532
}
3633
// Cloth Config
37-
if (clothConfigVersion != null) {
38-
modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:${clothConfigVersion}") {
39-
exclude("net.fabricmc.fabric-api")
40-
}
34+
modRuntimeOnly("me.shedaniel.cloth:cloth-config-fabric:${clothConfigVersion}") {
35+
exclude("net.fabricmc.fabric-api")
4136
}
4237
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
package com.terraformersmc.modmenu.api;
2+
3+
import net.minecraft.client.gui.screens.Screen;
4+
5+
@SuppressWarnings("unused")
6+
@FunctionalInterface
7+
public interface ConfigScreenFactory<S extends Screen> {
8+
S create(Screen parent);
9+
}
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
package com.terraformersmc.modmenu.api;
2+
3+
import java.util.Map;
4+
5+
@SuppressWarnings("unused")
6+
public interface ModMenuApi {
7+
/**
8+
* Used to provide config screen factories for other mods. This takes second
9+
* priority to a mod's own config screen factory provider. For example, if
10+
* mod `xyz` supplies a config screen factory, mod `abc` providing a config
11+
* screen to `xyz` will be pointless, as the one provided by `xyz` will be
12+
* used.
13+
* <p>
14+
* This method is NOT meant to be used to add a config screen factory to
15+
* your own mod.
16+
*
17+
* @return a map of mod ids to screen factories.
18+
*/
19+
default Map<String, ConfigScreenFactory<?>> getProvidedConfigScreenFactories() {
20+
return Map.of();
21+
}
22+
/**
23+
* Used to construct a new config screen instance when your mod's
24+
* configuration button is selected on the mod menu screen. The
25+
* screen instance parameter is the active mod menu screen.
26+
*
27+
* @return A factory for constructing config screen instances.
28+
*/
29+
default ConfigScreenFactory<?> getModConfigScreenFactory() {
30+
return screen -> null;
31+
}}

neoforge/build.gradle.kts

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ tasks.withType<ProcessResources> {
1919
outputs.upToDateWhen { false }
2020
}
2121

22-
val clothConfigVersion: String? = parent!!.properties["cloth_config_version"] as String
22+
val clothConfigVersion: String = parent!!.properties["cloth_config_version"] as String
2323

2424
repositories {
2525
maven("https://maven.terraformersmc.com/releases/")
@@ -31,7 +31,5 @@ dependencies {
3131
compileOnly(annotationProcessor("io.github.llamalad7:mixinextras-common:${rootProject.properties["mixinextras_version"]}")!!)
3232
implementation(include("io.github.llamalad7:mixinextras-neoforge:${rootProject.properties["mixinextras_version"]}")!!)
3333
// Cloth Config
34-
if (clothConfigVersion != null) {
35-
modRuntimeOnly("me.shedaniel.cloth:cloth-config-neoforge:${clothConfigVersion}")
36-
}
34+
modRuntimeOnly("me.shedaniel.cloth:cloth-config-neoforge:${clothConfigVersion}")
3735
}

0 commit comments

Comments
 (0)