Skip to content

Commit ae8eff5

Browse files
committed
Kotlinify
1 parent a70d728 commit ae8eff5

File tree

12 files changed

+69
-77
lines changed

12 files changed

+69
-77
lines changed

src/main/java/org/polyfrost/example/mixin/MinecraftClientMixin.java src/main/java/org/polyfrost/example/mixin/Mixin_MinecraftClient_Example.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,8 @@
1313
* @see Inject
1414
*/
1515
@Mixin(MinecraftClient.class)
16-
public class MinecraftClientMixin {
16+
// Class naming convention: Mixin_[OriginalClassName]_[SimplifiedDescription]
17+
public class Mixin_MinecraftClient_Example {
1718

1819
@Inject(method = "<init>", at = @At(value = "RETURN"))
1920
private void examplemod$onStartGame(CallbackInfo ci) {
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
package org.polyfrost.example
2+
3+
object ExampleConstants {
4+
5+
// Sets the variables from `gradle.properties`. Depends on the `bloom` DGT plugin.
6+
const val ID = "@MOD_ID@"
7+
const val NAME = "@MOD_NAME@"
8+
const val VERSION = "@MOD_VERSION@"
9+
10+
}

src/main/kotlin/org/polyfrost/example/ExampleMod.kt

-26
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package org.polyfrost.example.client
2+
3+
import net.fabricmc.api.ClientModInitializer
4+
import org.polyfrost.oneconfig.api.commands.v1.CommandManager
5+
6+
object ExampleClient : ClientModInitializer {
7+
8+
override fun onInitializeClient() {
9+
ExampleConfig.preload()
10+
CommandManager.registerCommand(ExampleCommand)
11+
}
12+
13+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
package org.polyfrost.example.client
2+
3+
import org.polyfrost.example.ExampleConstants
4+
import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command
5+
import org.polyfrost.oneconfig.utils.v1.dsl.openUI
6+
7+
@Command(value = [ExampleConstants.ID], description = "Access the ${ExampleConstants.NAME} GUI.")
8+
object ExampleCommand {
9+
10+
@Command
11+
private fun main() {
12+
ExampleConfig.openUI()
13+
}
14+
15+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package org.polyfrost.example.client
2+
3+
import org.polyfrost.example.ExampleConstants
4+
import org.polyfrost.oneconfig.api.config.v1.Config
5+
import org.polyfrost.oneconfig.api.config.v1.annotations.Dropdown
6+
import org.polyfrost.oneconfig.api.config.v1.annotations.Slider
7+
import org.polyfrost.oneconfig.api.config.v1.annotations.Switch
8+
9+
object ExampleConfig : Config("${ExampleConstants.ID}.json", ExampleConstants.NAME, Category.OTHER) {
10+
11+
@JvmStatic
12+
@Switch(title = "Example Switch")
13+
var exampleSwitch = false // The default value for the boolean Switch
14+
15+
@JvmStatic
16+
@Slider(title = "Example Slider", min = 0f, max = 100f, step = 10f)
17+
var exampleSlider = 50f // The default value for the float Slider
18+
19+
@Dropdown(title = "Example Dropdown", options = ["Option 1", "Option 2", "Option 3", "Option 4"])
20+
var exampleDropdown = 1 // Default option (in this case, "Option 2")
21+
22+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
package org.polyfrost.example.client
2+
3+
// TODO: for nextdayy
4+
object ExampleHud {
5+
}

src/main/kotlin/org/polyfrost/example/command/ExampleCommand.kt

-21
This file was deleted.

src/main/kotlin/org/polyfrost/example/config/ExampleConfig.kt

-22
This file was deleted.

src/main/kotlin/org/polyfrost/example/hud/ExampleHud.kt

-5
This file was deleted.

src/main/resources/fabric.mod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
"client": [
1313
{
1414
"adapter": "kotlin",
15-
"value": "org.polyfrost.example.ExampleMod"
15+
"value": "org.polyfrost.example.client.ExampleClient"
1616
}
1717
]
1818
},

src/main/resources/mixins.examplemod.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"maxShiftBy": 5
88
},
99
"client": [
10-
"MinecraftClientMixin"
10+
"Mixin_MinecraftClient_Example"
1111
],
1212
"verbose": true
1313
}

0 commit comments

Comments
 (0)