diff --git a/README.md b/README.md index e88ab2f..556cc5f 100644 --- a/README.md +++ b/README.md @@ -24,11 +24,11 @@ This configuration will be run once per player rendered per frame. ## Configuration Cache -The configuration is read once on mod initialisation and cached in memory, and updates to it will not be read unless you open the Mod Menu configuration page for Dynamic Skins and click "Reload configuration", upon which it will be read and cached again. Every time you update the configuration, you must reload it for it to apply. +The configuration is read once on mod initialisation and cached in memory, and updates to it will not be read unless you run `/dynamic-skins cache reload`. Alternatively, you can open the Mod Menu configuration page for Dynamic Skins and click "Reload configuration". Every time you update the configuration, you must reload it for it to apply. ## Errors -If an error is encountered when Dynamic Skins executes the configuration, the error and a message stating that Dynamic Skins has stopped will be logged. To start it again, you must open the Mod Menu page (or reopen if it was already open) and click the "Restart" button that should now be visible. Note that restarting will reload the configuration. +If an error is encountered when Dynamic Skins executes the configuration, the error and a message stating that Dynamic Skins has stopped will be logged. You can run the command `/dynamic-skins error` to display the error. To start it again, you must either run `/dynamic-skins error reset` or open the Mod Menu page (reopen if it was already open) and click the "Restart" button that should now be visible. Note that restarting will reload the configuration. ## Custom Skins diff --git a/gradle.properties b/gradle.properties index cdff802..11896b6 100644 --- a/gradle.properties +++ b/gradle.properties @@ -9,7 +9,7 @@ yarn_mappings=1.20.1+build.10 loader_version=0.15.11 # Mod Properties -mod_version=1.0.1 +mod_version=1.1.0 maven_group=diacritics.owo archives_base_name=dynamic-skins diff --git a/src/client/java/diacritics/owo/DynamicSkinsClient.java b/src/client/java/diacritics/owo/DynamicSkinsClient.java index 26541f5..c12eaf0 100644 --- a/src/client/java/diacritics/owo/DynamicSkinsClient.java +++ b/src/client/java/diacritics/owo/DynamicSkinsClient.java @@ -1,10 +1,37 @@ package diacritics.owo; import net.fabricmc.api.ClientModInitializer; +import net.fabricmc.fabric.api.command.v2.CommandRegistrationCallback; +import net.minecraft.text.Text; +import static net.minecraft.server.command.CommandManager.literal; public class DynamicSkinsClient implements ClientModInitializer { @Override public void onInitializeClient() { - // This entrypoint is suitable for setting up client-specific logic, such as rendering. + CommandRegistrationCallback.EVENT.register((dispatcher, registryAccess, environment) -> { + dispatcher.register(literal("dynamic-skins") + .then(literal("cache") + .then(literal("reload").executes(context -> { + DynamicSkins.config.resetCache(); + context.getSource().sendFeedback(() -> Text.of("Successfully reloaded configuration cache"), false); + return 1; + }))) + .then(literal("error") + .executes(context -> { + context.getSource().sendFeedback( + () -> Text.of(DynamicSkins.dynamicSkinsError == null ? "No errors found" + : DynamicSkins.dynamicSkinsError.toString()), + false); + return 1; + }) + .then(literal("reset").executes(context -> { + DynamicSkins.config.resetCache(); + DynamicSkins.dynamicSkinsError = null; + context.getSource().sendFeedback( + () -> Text.of("Dynamic Skins has been restarted"), + false); + return 1; + })))); + }); } } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index 2cce332..def2301 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -27,7 +27,9 @@ "fabricloader": ">=0.15.11", "minecraft": "~1.20.1", "java": ">=17", - "fabric-api": "*", + "fabric-api": "*" + }, + "suggests": { "modmenu": ">=7.2.2" } }