aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoringlettronald <inglettronald@gmail.com>2023-06-08 19:56:41 -0500
committeringlettronald <inglettronald@gmail.com>2023-06-08 19:56:41 -0500
commit4e4043e5408038dde4c862da82d8a0a9bb40e950 (patch)
treeba21698d9ab371b54abaeb4b179356a0cd8ff839
parent4c66db32ac1f7ae1c260195fc50acf39831dd88b (diff)
downloadDulkirMod-Fabric-4e4043e5408038dde4c862da82d8a0a9bb40e950.tar.gz
DulkirMod-Fabric-4e4043e5408038dde4c862da82d8a0a9bb40e950.tar.bz2
DulkirMod-Fabric-4e4043e5408038dde4c862da82d8a0a9bb40e950.zip
initial commit
-rw-r--r--src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java12
-rw-r--r--src/main/kotlin/com/dulkirfabric/commands/JoinDungeonCommands.kt149
-rw-r--r--src/main/kotlin/com/dulkirfabric/util/TextUtils.kt31
3 files changed, 192 insertions, 0 deletions
diff --git a/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java b/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java
new file mode 100644
index 0000000..ab86cd9
--- /dev/null
+++ b/src/main/java/com/dulkirfabric/mixin/render/GameRendererMixin.java
@@ -0,0 +1,12 @@
+package com.dulkirfabric.mixin.render;
+
+
+import net.minecraft.client.render.GameRenderer;
+import org.spongepowered.asm.mixin.Mixin;
+
+@Mixin(GameRenderer.class)
+public class GameRendererMixin {
+
+ // TODO: THIS CODE IS NOT WORKING
+
+} \ No newline at end of file
diff --git a/src/main/kotlin/com/dulkirfabric/commands/JoinDungeonCommands.kt b/src/main/kotlin/com/dulkirfabric/commands/JoinDungeonCommands.kt
new file mode 100644
index 0000000..13b6242
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/commands/JoinDungeonCommands.kt
@@ -0,0 +1,149 @@
+package com.dulkirfabric.commands
+
+import com.dulkirfabric.util.TextUtils
+import com.mojang.brigadier.CommandDispatcher
+import com.mojang.brigadier.builder.LiteralArgumentBuilder
+import net.fabricmc.fabric.api.client.command.v2.FabricClientCommandSource
+import net.minecraft.command.CommandRegistryAccess
+
+object JoinDungeonCommands {
+ object F1Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f1").executes {
+ TextUtils.info("§6Attempting to join F1...")
+ TextUtils.sendCommand("joindungeon catacombs 1")
+ return@executes 0
+ })
+ }
+ }
+
+ object F2Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f2").executes {
+ TextUtils.info("§6Attempting to join F2...")
+ TextUtils.sendCommand("joindungeon catacombs 2")
+ return@executes 0
+ })
+ }
+ }
+
+ object F3Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f3").executes {
+ TextUtils.info("§6Attempting to join F3...")
+ TextUtils.sendCommand("joindungeon catacombs 3")
+ return@executes 0
+ })
+ }
+ }
+
+ object F4Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f4").executes {
+ TextUtils.info("§6Attempting to join F4...")
+ TextUtils.sendCommand("joindungeon catacombs 4")
+ return@executes 0
+ })
+ }
+ }
+
+ object F5Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f5").executes {
+ TextUtils.info("§6Attempting to join F5...")
+ TextUtils.sendCommand("joindungeon catacombs 5")
+ return@executes 0
+ })
+ }
+ }
+
+ object F6Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f6").executes {
+ TextUtils.info("§6Attempting to join F6...")
+ TextUtils.sendCommand("joindungeon catacombs 6")
+ return@executes 0
+ })
+ }
+ }
+
+ object F7Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("f7").executes {
+ TextUtils.info("§6Attempting to join F7...")
+ TextUtils.sendCommand("joindungeon catacombs 7")
+ return@executes 0
+ })
+ }
+ }
+
+ object M1Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m1").executes {
+ TextUtils.info("§6Attempting to join M1...")
+ TextUtils.sendCommand("joindungeon master_catacombs 1")
+ return@executes 0
+ })
+ }
+ }
+
+ object M2Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m2").executes {
+ TextUtils.info("§6Attempting to join M2...")
+ TextUtils.sendCommand("joindungeon master_catacombs 2")
+ return@executes 0
+ })
+ }
+ }
+
+ object M3Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m3").executes {
+ TextUtils.info("§6Attempting to join M3...")
+ TextUtils.sendCommand("joindungeon master_catacombs 3")
+ return@executes 0
+ })
+ }
+ }
+
+ object M4Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m4").executes {
+ TextUtils.info("§6Attempting to join M4...")
+ TextUtils.sendCommand("joindungeon master_catacombs 4")
+ return@executes 0
+ })
+ }
+ }
+
+ object M5Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m5").executes {
+ TextUtils.info("§6Attempting to join M5...")
+ TextUtils.sendCommand("joindungeon master_catacombs 5")
+ return@executes 0
+ })
+ }
+ }
+
+ object M6Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m6").executes {
+ TextUtils.info("§6Attempting to join M6...")
+ TextUtils.sendCommand("joindungeon master_catacombs 6")
+ return@executes 0
+ })
+ }
+ }
+
+ object M7Command {
+ fun register(dispatcher: CommandDispatcher<FabricClientCommandSource>, registryAccess: CommandRegistryAccess) {
+ dispatcher.register(LiteralArgumentBuilder.literal<FabricClientCommandSource>("m7").executes {
+ TextUtils.info("§6Attempting to join M7...")
+ TextUtils.sendCommand("joindungeon master_catacombs 7")
+ return@executes 0
+ })
+ }
+ }
+}
diff --git a/src/main/kotlin/com/dulkirfabric/util/TextUtils.kt b/src/main/kotlin/com/dulkirfabric/util/TextUtils.kt
new file mode 100644
index 0000000..6f904ac
--- /dev/null
+++ b/src/main/kotlin/com/dulkirfabric/util/TextUtils.kt
@@ -0,0 +1,31 @@
+package com.dulkirfabric.util
+
+import com.dulkirfabric.DulkirModFabric.mc
+import net.minecraft.text.Text
+
+object TextUtils {
+ const val CHAT_PREFIX = "§f<§3DulkirMod§f>§r"
+ fun info(text: String, prefix: Boolean = true) {
+ if (mc.player == null) return
+
+ val textPrefix = if (prefix) "${CHAT_PREFIX} " else ""
+ mc.inGameHud.chatHud.addMessage(Text.literal("$textPrefix$text§r"))
+ }
+
+ fun toggledMessage(message: String, state: Boolean) {
+ val stateText = if (state) "§aON" else "§cOFF"
+ info("§9Toggled $message §8[$stateText§8]§r")
+ }
+
+ fun sendPartyChatMessage(message: String) {
+ this.sendCommand("/pc $message")
+ }
+
+ fun sendMessage(message: String) {
+ mc.player?.networkHandler?.sendChatMessage(message)
+ }
+
+ fun sendCommand(command: String) {
+ mc.player?.networkHandler?.sendChatCommand(command)
+ }
+} \ No newline at end of file