diff --git a/src/main/java/org/polyfrost/example/mixin/MinecraftClientMixin.java b/src/main/java/org/polyfrost/example/mixin/Mixin_MinecraftClient_Example.java similarity index 83% rename from src/main/java/org/polyfrost/example/mixin/MinecraftClientMixin.java rename to src/main/java/org/polyfrost/example/mixin/Mixin_MinecraftClient_Example.java index cf5ddea..d26bd5e 100644 --- a/src/main/java/org/polyfrost/example/mixin/MinecraftClientMixin.java +++ b/src/main/java/org/polyfrost/example/mixin/Mixin_MinecraftClient_Example.java @@ -13,7 +13,8 @@ * @see Inject */ @Mixin(MinecraftClient.class) -public class MinecraftClientMixin { +// Class naming convention: Mixin_[OriginalClassName]_[SimplifiedDescription] +public class Mixin_MinecraftClient_Example { @Inject(method = "", at = @At(value = "RETURN")) private void examplemod$onStartGame(CallbackInfo ci) { diff --git a/src/main/kotlin/org/polyfrost/example/ExampleConstants.kt b/src/main/kotlin/org/polyfrost/example/ExampleConstants.kt new file mode 100644 index 0000000..d48d873 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/example/ExampleConstants.kt @@ -0,0 +1,10 @@ +package org.polyfrost.example + +object ExampleConstants { + + // Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin. + const val ID = "@MOD_ID@" + const val NAME = "@MOD_NAME@" + const val VERSION = "@MOD_VERSION@" + +} diff --git a/src/main/kotlin/org/polyfrost/example/ExampleMod.kt b/src/main/kotlin/org/polyfrost/example/ExampleMod.kt deleted file mode 100644 index 8724c91..0000000 --- a/src/main/kotlin/org/polyfrost/example/ExampleMod.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.polyfrost.example - -import net.fabricmc.api.ClientModInitializer -import org.polyfrost.example.command.ExampleCommand -import org.polyfrost.example.config.ExampleConfig -import org.polyfrost.oneconfig.api.commands.v1.CommandManager - -/** - * The entrypoint of the Example Mod which initializes it. - * This is what is run when the game is started and typically how your mod will set up its functionality. - * - * @see ClientModInitializer - */ -object ExampleMod : ClientModInitializer { - - // Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin. - const val ID = "@MOD_ID@" - const val NAME = "@MOD_NAME@" - const val VERSION = "@MOD_VERSION@" - - // Register the config and commands. - override fun onInitializeClient() { - ExampleConfig.preload() - CommandManager.registerCommand(ExampleCommand()) - } -} \ No newline at end of file diff --git a/src/main/kotlin/org/polyfrost/example/client/ExampleClient.kt b/src/main/kotlin/org/polyfrost/example/client/ExampleClient.kt new file mode 100644 index 0000000..4235559 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/example/client/ExampleClient.kt @@ -0,0 +1,13 @@ +package org.polyfrost.example.client + +import net.fabricmc.api.ClientModInitializer +import org.polyfrost.oneconfig.api.commands.v1.CommandManager + +object ExampleClient : ClientModInitializer { + + override fun onInitializeClient() { + ExampleConfig.preload() + CommandManager.registerCommand(ExampleCommand) + } + +} diff --git a/src/main/kotlin/org/polyfrost/example/client/ExampleCommand.kt b/src/main/kotlin/org/polyfrost/example/client/ExampleCommand.kt new file mode 100644 index 0000000..5dbb868 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/example/client/ExampleCommand.kt @@ -0,0 +1,15 @@ +package org.polyfrost.example.client + +import org.polyfrost.example.ExampleConstants +import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command +import org.polyfrost.oneconfig.utils.v1.dsl.openUI + +@Command(value = [ExampleConstants.ID], description = "Access the ${ExampleConstants.NAME} GUI.") +object ExampleCommand { + + @Command + private fun main() { + ExampleConfig.openUI() + } + +} diff --git a/src/main/kotlin/org/polyfrost/example/client/ExampleConfig.kt b/src/main/kotlin/org/polyfrost/example/client/ExampleConfig.kt new file mode 100644 index 0000000..ff76fb4 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/example/client/ExampleConfig.kt @@ -0,0 +1,22 @@ +package org.polyfrost.example.client + +import org.polyfrost.example.ExampleConstants +import org.polyfrost.oneconfig.api.config.v1.Config +import org.polyfrost.oneconfig.api.config.v1.annotations.Dropdown +import org.polyfrost.oneconfig.api.config.v1.annotations.Slider +import org.polyfrost.oneconfig.api.config.v1.annotations.Switch + +object ExampleConfig : Config("${ExampleConstants.ID}.json", ExampleConstants.NAME, Category.OTHER) { + + @JvmStatic + @Switch(title = "Example Switch") + var exampleSwitch = false // The default value for the boolean Switch + + @JvmStatic + @Slider(title = "Example Slider", min = 0f, max = 100f, step = 10f) + var exampleSlider = 50f // The default value for the float Slider + + @Dropdown(title = "Example Dropdown", options = ["Option 1", "Option 2", "Option 3", "Option 4"]) + var exampleDropdown = 1 // Default option (in this case, "Option 2") + +} diff --git a/src/main/kotlin/org/polyfrost/example/client/ExampleHud.kt b/src/main/kotlin/org/polyfrost/example/client/ExampleHud.kt new file mode 100644 index 0000000..7d531b6 --- /dev/null +++ b/src/main/kotlin/org/polyfrost/example/client/ExampleHud.kt @@ -0,0 +1,5 @@ +package org.polyfrost.example.client + +// TODO: for nextdayy +object ExampleHud { +} diff --git a/src/main/kotlin/org/polyfrost/example/command/ExampleCommand.kt b/src/main/kotlin/org/polyfrost/example/command/ExampleCommand.kt deleted file mode 100644 index bb5f23e..0000000 --- a/src/main/kotlin/org/polyfrost/example/command/ExampleCommand.kt +++ /dev/null @@ -1,21 +0,0 @@ -package org.polyfrost.example.command - -import org.polyfrost.example.ExampleMod -import org.polyfrost.example.config.ExampleConfig -import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command -import org.polyfrost.oneconfig.utils.v1.dsl.openUI - -/** - * An example command implementing the Command API of OneConfig. - * Registered in ExampleMod.kt with `CommandManager.INSTANCE.registerCommand(new ExampleCommand());` - * - * @see Command - * @see ExampleMod - */ -@Command(value = [ExampleMod.ID], description = "Access the ${ExampleMod.NAME} GUI.") -class ExampleCommand { - @Command - private fun main() { - ExampleConfig.openUI() - } -} \ No newline at end of file diff --git a/src/main/kotlin/org/polyfrost/example/config/ExampleConfig.kt b/src/main/kotlin/org/polyfrost/example/config/ExampleConfig.kt deleted file mode 100644 index 98131b4..0000000 --- a/src/main/kotlin/org/polyfrost/example/config/ExampleConfig.kt +++ /dev/null @@ -1,22 +0,0 @@ -package org.polyfrost.example.config - -import org.polyfrost.example.ExampleMod -import org.polyfrost.oneconfig.api.config.v1.Config -import org.polyfrost.oneconfig.api.config.v1.annotations.Dropdown -import org.polyfrost.oneconfig.api.config.v1.annotations.Slider -import org.polyfrost.oneconfig.api.config.v1.annotations.Switch - -/** - * The main Config entrypoint that extends the Config type and initializes your config options. - * See [this link](https://docsv1.polyfrost.org/configuration/available-options) for more config options - */ -object ExampleConfig : Config("${ExampleMod.ID}.json", ExampleMod.NAME, Category.OTHER) { - @Switch(title = "Example Switch") - var exampleSwitch = false // The default value for the boolean Switch. - - @Slider(title = "Example Slider", min = 0F, max = 100F, step = 10F) - var exampleSlider = 50f // The default value for the float Slider. - - @Dropdown(title = "Example Dropdown", options = ["Option 1", "Option 2", "Option 3", "Option 4"]) - var exampleDropdown = 1 // Default option (in this case "Option 2") -} \ No newline at end of file diff --git a/src/main/kotlin/org/polyfrost/example/hud/ExampleHud.kt b/src/main/kotlin/org/polyfrost/example/hud/ExampleHud.kt deleted file mode 100644 index 7e46f30..0000000 --- a/src/main/kotlin/org/polyfrost/example/hud/ExampleHud.kt +++ /dev/null @@ -1,5 +0,0 @@ -package org.polyfrost.example.hud - -// TODO: for nextdayy -class ExampleHud { -} \ No newline at end of file diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index c2f31cf..c711682 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -12,7 +12,7 @@ "client": [ { "adapter": "kotlin", - "value": "org.polyfrost.example.ExampleMod" + "value": "org.polyfrost.example.client.ExampleClient" } ] }, diff --git a/src/main/resources/mixins.examplemod.json b/src/main/resources/mixins.examplemod.json index 8db6326..6fb63c7 100644 --- a/src/main/resources/mixins.examplemod.json +++ b/src/main/resources/mixins.examplemod.json @@ -7,7 +7,7 @@ "maxShiftBy": 5 }, "client": [ - "MinecraftClientMixin" + "Mixin_MinecraftClient_Example" ], "verbose": true }