summaryrefslogtreecommitdiff
path: root/src/main/kotlin/commands/Commands.kt
diff options
context:
space:
mode:
authorLinnea Gräf <nea@nea.moe>2024-09-24 16:41:49 +0200
committerLinnea Gräf <nea@nea.moe>2024-09-24 16:41:49 +0200
commitaa1238430bd0f103f040ed31baadc029bb09529e (patch)
tree05aa9d4f6a1c35166003dc8e306dd2c40a818945 /src/main/kotlin/commands/Commands.kt
parentfb40ab45f0b4979420bae066da2244f4fdd52db8 (diff)
downloadultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.tar.gz
ultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.tar.bz2
ultra-notifier-aa1238430bd0f103f040ed31baadc029bb09529e.zip
snapshot
Diffstat (limited to 'src/main/kotlin/commands/Commands.kt')
-rw-r--r--src/main/kotlin/commands/Commands.kt22
1 files changed, 15 insertions, 7 deletions
diff --git a/src/main/kotlin/commands/Commands.kt b/src/main/kotlin/commands/Commands.kt
index 95e8685..de6ded3 100644
--- a/src/main/kotlin/commands/Commands.kt
+++ b/src/main/kotlin/commands/Commands.kt
@@ -16,24 +16,25 @@ interface CustomSource {
typealias UltraCommandSource =
//#if FORGE
//$$ CustomSource
-//#else
+//#elseif MC > 1.18
net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
-
+//#else
+//$$ net.fabricmc.fabric.api.client.command.v1.FabricClientCommandSource
//#endif
fun translatableText(key: String, vararg args: String) =
-//#if MC > 11400
+//#if MC > 1.17
Text.translatable(key, *args)
//#else
-//$$ net.minecraft.util.ChatComponentTranslation(key, *args)
+//$$ net.minecraft.text.TranslatableText(key, *args)
//#endif
fun literalText(string: String): Text =
-//#if MC > 11400
+//#if MC > 1.17
Text.literal(string)
//#else
-//$$ net.minecraft.util.ChatComponentText(string)
+//$$ net.minecraft.text.LiteralText(string)
//#endif
object Commands : SubscriptionTarget {
@@ -46,10 +47,17 @@ object Commands : SubscriptionTarget {
})
}
+//#if MC <= 1.18 && FABRIC
+//$$ @UltraSubscribe
+//$$ fun registerEverythingOnce(event: moe.nea.ultranotifier.event.RegistrationFinishedEvent) {
+//$$ CommandRegistrationEvent(net.fabricmc.fabric.api.client.command.v1.ClientCommandManager.DISPATCHER).post()
+//$$ }
+//#endif
+
override fun init() {
//#if FORGE
//$$ UltraNotifierEvents.register(BrigadierPatchbay)
-//#else
+//#elseif MC > 1.18
net.fabricmc.fabric.api.client.command.v2.ClientCommandRegistrationCallback.EVENT.register { dispatcher, registryAccess ->
UltraNotifierEvents.post(CommandRegistrationEvent(dispatcher))
}