-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
77 additions
and
98 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
23 changes: 0 additions & 23 deletions
23
src/main/java/org/polyfrost/example/command/ExampleCommand.java
This file was deleted.
Oops, something went wrong.
38 changes: 0 additions & 38 deletions
38
src/main/java/org/polyfrost/example/config/ExampleConfig.java
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
package org.polyfrost.example | ||
|
||
import net.minecraftforge.fml.common.Mod | ||
import net.minecraftforge.fml.common.event.FMLInitializationEvent | ||
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 Mod | ||
*/ | ||
@Mod(modid = ExampleMod.ID, name = ExampleMod.NAME, version = ExampleMod.VERSION, modLanguageAdapter = "org.polyfrost.oneconfig.utils.v1.forge.KotlinLanguageAdapter") | ||
object ExampleMod { | ||
|
||
// 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. | ||
@Mod.EventHandler | ||
fun onInit(event: FMLInitializationEvent) { | ||
ExampleConfig.preload() | ||
CommandManager.registerCommand(ExampleCommand()) | ||
} | ||
} |
21 changes: 21 additions & 0 deletions
21
src/main/kotlin/org/polyfrost/example/command/ExampleCommand.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
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() | ||
} | ||
} |
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/org/polyfrost/example/config/ExampleConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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") | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
package org.polyfrost.example.hud | ||
|
||
// TODO: for nextdayy | ||
class ExampleHud { | ||
} |