add modmenu configs

This commit is contained in:
Christoph J. Scherr 2023-11-08 19:25:32 +01:00
parent eeb881c972
commit ed9eda1612
6 changed files with 101 additions and 41 deletions

BIN
assets/mcpht/icon.png Executable file

Binary file not shown.

After

Width:  |  Height:  |  Size: 94 KiB

View File

@ -16,6 +16,8 @@ repositories {
// Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // Loom adds the essential maven repositories to download Minecraft and libraries from automatically.
// See https://docs.gradle.org/current/userguide/declaring_repositories.html // See https://docs.gradle.org/current/userguide/declaring_repositories.html
// for more information about repositories. // for more information about repositories.
maven { url "https://maven.shedaniel.me/" }
maven { url "https://maven.terraformersmc.com/releases/" }
} }
loom { loom {
@ -39,6 +41,11 @@ dependencies {
// Fabric API. This is technically optional, but you probably want it anyway. // Fabric API. This is technically optional, but you probably want it anyway.
modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}" modImplementation "net.fabricmc.fabric-api:fabric-api:${project.fabric_version}"
modApi("me.shedaniel.cloth:cloth-config-fabric:10.1.105") {
exclude(group: "net.fabricmc.fabric-api")
}
modApi "com.terraformersmc:modmenu:6.2.1"
// Uncomment the following line to enable the deprecated Fabric API modules. // Uncomment the following line to enable the deprecated Fabric API modules.
// These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time. // These are included in the Fabric API production distribution and allow you to update your mod to the latest modules at a later more convenient time.

View File

@ -1,6 +1,9 @@
package de.cscherr.mcpht; package de.cscherr.mcpht;
import de.cscherr.mcpht.config.MCPHTConfig;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.ClientModInitializer; import net.fabricmc.api.ClientModInitializer;
import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
@ -11,6 +14,7 @@ public class McphtClient implements ClientModInitializer {
@Override @Override
public void onInitializeClient() { public void onInitializeClient() {
AutoConfig.register(MCPHTConfig.class, JanksonConfigSerializer::new);
// This entrypoint is suitable for setting up client-specific logic, such as rendering. // This entrypoint is suitable for setting up client-specific logic, such as rendering.
LOGGER.info("Init client!"); LOGGER.info("Init client!");
} }

View File

@ -0,0 +1,24 @@
package de.cscherr.mcpht.config;
import me.shedaniel.autoconfig.ConfigData;
import me.shedaniel.autoconfig.annotation.Config;
import me.shedaniel.autoconfig.annotation.ConfigEntry;
import me.shedaniel.cloth.clothconfig.shadowed.blue.endless.jankson.Comment;
@Config(name = "MCPHT Config")
public class MCPHTConfig implements ConfigData {
@Comment("Dummy Button")
public NetworkTrafficBarScheme netbar = new NetworkTrafficBarScheme();
public static class NetworkTrafficBarScheme {
public enum NetworkTrafficEnum {
None,
All,
Client,
Server,
}
public NetworkTrafficEnum state = NetworkTrafficEnum.None;
}
@Comment("How much should network traffic be logged")
public int state = 0;
}

View File

@ -0,0 +1,15 @@
package de.cscherr.mcpht.config;
import com.terraformersmc.modmenu.api.ConfigScreenFactory;
import com.terraformersmc.modmenu.api.ModMenuApi;
import me.shedaniel.autoconfig.AutoConfig;
import net.fabricmc.api.EnvType;
import net.fabricmc.api.Environment;
@Environment(EnvType.CLIENT)
public class ModMenuImpl implements ModMenuApi {
@Override
public ConfigScreenFactory<?> getModConfigScreenFactory() {
return parent -> AutoConfig.getConfigScreen(MCPHTConfig.class, parent).get();
}
}

View File

@ -1,25 +1,29 @@
{ {
"schemaVersion": 1, "schemaVersion": 1,
"id": "mcpht", "id": "mcpht",
"version": "${version}", "version": "0.0.1",
"name": "mcpht", "name": "MCPHT",
"description": "This is an example description! Tell everyone what your mod is about!", "description": "Plex Hack Tools",
"authors": [ "authors": [
"Me!" {
"name": "Christoph J. Scherr",
"email": "software@cscherr.de"
}
], ],
"contact": { "contact": {
"homepage": "https://fabricmc.net/", "email": "software@cscherr.de",
"sources": "https://github.com/FabricMC/fabric-example-mod" "homepage": "https://www.cscherr.de",
"sources": "https://git.cscherr.de/PlexSheep/mcpht",
"issues": "https://git.cscherr.de/PlexSheep/mcpht/issues"
}, },
"license": "CC0-1.0", "license": "MIT",
"icon": "assets/mcpht/icon.png", "icon": "assets/mcpht/icon.png",
"environment": "*", "environment": "*",
"entrypoints": { "entrypoints": {
"main": [ "main": ["de.cscherr.mcpht.Mcpht"],
"de.cscherr.mcpht.Mcpht" "client": ["de.cscherr.mcpht.McphtClient"],
], "modmenu": [
"client": [ "de.cscherr.mcpht.config.ModMenuImpl"
"de.cscherr.mcpht.McphtClient"
] ]
}, },
"mixins": [ "mixins": [
@ -33,9 +37,15 @@
"fabricloader": ">=0.14.24", "fabricloader": ">=0.14.24",
"minecraft": "~1.19.4", "minecraft": "~1.19.4",
"java": ">=17", "java": ">=17",
"fabric-api": "*" "fabric-api": "*",
"modmenu": ">=6.0.0"
}, },
"suggests": { "suggests": {
"another-mod": "*" "another-mod": "*"
},
"custom": {
"modmenu": {
"update_checker": true
}
} }
} }