diff --git a/assets/mcpht/icon.png b/assets/mcpht/icon.png new file mode 100755 index 0000000..39e7921 Binary files /dev/null and b/assets/mcpht/icon.png differ diff --git a/build.gradle b/build.gradle index 25e40bd..6a863a2 100644 --- a/build.gradle +++ b/build.gradle @@ -16,6 +16,8 @@ repositories { // Loom adds the essential maven repositories to download Minecraft and libraries from automatically. // See https://docs.gradle.org/current/userguide/declaring_repositories.html // for more information about repositories. + maven { url "https://maven.shedaniel.me/" } + maven { url "https://maven.terraformersmc.com/releases/" } } loom { @@ -38,7 +40,12 @@ dependencies { // Fabric API. This is technically optional, but you probably want it anyway. 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. // 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. diff --git a/src/client/java/de/cscherr/mcpht/McphtClient.java b/src/client/java/de/cscherr/mcpht/McphtClient.java index 10f4fbb..b5acb2f 100644 --- a/src/client/java/de/cscherr/mcpht/McphtClient.java +++ b/src/client/java/de/cscherr/mcpht/McphtClient.java @@ -1,6 +1,9 @@ package de.cscherr.mcpht; +import de.cscherr.mcpht.config.MCPHTConfig; +import me.shedaniel.autoconfig.AutoConfig; import net.fabricmc.api.ClientModInitializer; +import me.shedaniel.autoconfig.serializer.JanksonConfigSerializer; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -11,6 +14,7 @@ public class McphtClient implements ClientModInitializer { @Override public void onInitializeClient() { + AutoConfig.register(MCPHTConfig.class, JanksonConfigSerializer::new); // This entrypoint is suitable for setting up client-specific logic, such as rendering. LOGGER.info("Init client!"); } diff --git a/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java b/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java new file mode 100644 index 0000000..35acb41 --- /dev/null +++ b/src/client/java/de/cscherr/mcpht/config/MCPHTConfig.java @@ -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; +} diff --git a/src/client/java/de/cscherr/mcpht/config/ModMenuImpl.java b/src/client/java/de/cscherr/mcpht/config/ModMenuImpl.java new file mode 100644 index 0000000..db896cc --- /dev/null +++ b/src/client/java/de/cscherr/mcpht/config/ModMenuImpl.java @@ -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(); + } +} diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 8c9e0df..c62ca56 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -1,41 +1,51 @@ { - "schemaVersion": 1, - "id": "mcpht", - "version": "${version}", - "name": "mcpht", - "description": "This is an example description! Tell everyone what your mod is about!", - "authors": [ - "Me!" - ], - "contact": { - "homepage": "https://fabricmc.net/", - "sources": "https://github.com/FabricMC/fabric-example-mod" - }, - "license": "CC0-1.0", - "icon": "assets/mcpht/icon.png", - "environment": "*", - "entrypoints": { - "main": [ - "de.cscherr.mcpht.Mcpht" - ], - "client": [ - "de.cscherr.mcpht.McphtClient" - ] - }, - "mixins": [ - "mcpht.mixins.json", - { - "config": "mcpht.client.mixins.json", - "environment": "client" - } - ], - "depends": { - "fabricloader": ">=0.14.24", - "minecraft": "~1.19.4", - "java": ">=17", - "fabric-api": "*" - }, - "suggests": { - "another-mod": "*" - } -} \ No newline at end of file + "schemaVersion": 1, + "id": "mcpht", + "version": "0.0.1", + "name": "MCPHT", + "description": "Plex Hack Tools", + "authors": [ + { + "name": "Christoph J. Scherr", + "email": "software@cscherr.de" + } + ], + "contact": { + "email": "software@cscherr.de", + "homepage": "https://www.cscherr.de", + "sources": "https://git.cscherr.de/PlexSheep/mcpht", + "issues": "https://git.cscherr.de/PlexSheep/mcpht/issues" + }, + "license": "MIT", + "icon": "assets/mcpht/icon.png", + "environment": "*", + "entrypoints": { + "main": ["de.cscherr.mcpht.Mcpht"], + "client": ["de.cscherr.mcpht.McphtClient"], + "modmenu": [ + "de.cscherr.mcpht.config.ModMenuImpl" + ] + }, + "mixins": [ + "mcpht.mixins.json", + { + "config": "mcpht.client.mixins.json", + "environment": "client" + } + ], + "depends": { + "fabricloader": ">=0.14.24", + "minecraft": "~1.19.4", + "java": ">=17", + "fabric-api": "*", + "modmenu": ">=6.0.0" + }, + "suggests": { + "another-mod": "*" + }, + "custom": { + "modmenu": { + "update_checker": true + } + } +}