diff --git a/base/src/main/kotlin/dev/nathanpb/dml/command/DMLCommand.kt b/base/src/main/kotlin/dev/nathanpb/dml/command/DMLCommand.kt index 641b47d6..f84265bc 100644 --- a/base/src/main/kotlin/dev/nathanpb/dml/command/DMLCommand.kt +++ b/base/src/main/kotlin/dev/nathanpb/dml/command/DMLCommand.kt @@ -8,8 +8,7 @@ import net.minecraft.command.CommandRegistryAccess import net.minecraft.server.command.CommandManager.RegistrationEnvironment import net.minecraft.server.command.CommandManager.literal import net.minecraft.server.command.ServerCommandSource -import net.minecraft.text.MutableText -import net.minecraft.text.Text +import net.minecraft.text.* import net.minecraft.util.Formatting @@ -33,7 +32,27 @@ class DMLCommand: CommandRegistrationCallback { // Main Command .executes { - it.source.sendMessage(Text.literal("Hello, Brigadier!")) + val metadata = FabricLoader.getInstance().getModContainer("dml-refabricated").get().metadata + val authors = metadata.authors.filter { person -> person.name != "IterationFunk" }.joinToString { + person -> person.name + } + val contributors = metadata.contributors.joinToString { + person -> person.name + } + + it.source.sendMessage(coloredText("-= ", true).append(coloredText("${metadata.name} v${metadata.version}")).append(coloredText(" =-", true))) + it.source.sendMessage(coloredText("Original mod by ").append(coloredText("IterationFunk", true))) + it.source.sendMessage(coloredText("Reimagining/port by ").append(coloredText(authors, true))) + it.source.sendMessage(coloredText("With contributions of ").append(coloredText(contributors, true))) + it.source.sendMessage(Text.empty()) + it.source.sendMessage( + hyperlink("CurseForge", "https://curseforge.com/minecraft/mc-mods/deep-mob-learning-refabricated", 0xF46434).append( + " ").append( + hyperlink("Modrinth", "https://modrinth.com/mod/deep-mob-learning-refabricated", 0x1CD368)).append( + " ").append( + hyperlink("Issue Tracker", "https://github.com/CafeteriaGuild/DeepMobLearning-Refabricated/issues", 0x6E5494)) + ) + return@executes 1 }) @@ -56,7 +75,16 @@ class DMLCommand: CommandRegistrationCallback { return coloredText(message, false) } - private fun coloredText(message: String, translatable: Boolean): MutableText { - return (if(translatable) Text.translatable(message) else Text.literal(message)).styled { RenderUtils.STYLE } + private fun coloredText(message: String, altStyle: Boolean): MutableText { + return Text.literal(message).styled { if(altStyle) RenderUtils.ALT_STYLE else RenderUtils.STYLE } + } + + private fun hyperlink(title: String, url: String, color: Int): MutableText { + return Text.literal("[$title]").styled { Style.EMPTY + .withClickEvent(ClickEvent(ClickEvent.Action.OPEN_URL, url)) + .withHoverEvent(HoverEvent(HoverEvent.Action.SHOW_TEXT, Text.literal("Click to open link").styled { Style.EMPTY.withColor(color) })) + .withColor(color) + .withBold(true) + } } } diff --git a/base/src/main/kotlin/dev/nathanpb/dml/utils/RenderUtils.kt b/base/src/main/kotlin/dev/nathanpb/dml/utils/RenderUtils.kt index 7bbb2ad1..361c2eb6 100644 --- a/base/src/main/kotlin/dev/nathanpb/dml/utils/RenderUtils.kt +++ b/base/src/main/kotlin/dev/nathanpb/dml/utils/RenderUtils.kt @@ -39,7 +39,9 @@ class RenderUtils { companion object { private const val TITLE_COLOR: Int = 0x04FCC4 + private const val ALT_TITLE_COLOR: Int = 0x62D8FF val STYLE: Style = Style.EMPTY.withColor(TITLE_COLOR) + val ALT_STYLE: Style = Style.EMPTY.withColor(ALT_TITLE_COLOR) val DEFAULT_BACKGROUND_PAINTER: NinePatchBackgroundPainter by lazy { BackgroundPainter.createNinePatch(identifier("textures/gui/dml_background_painter.png")) } diff --git a/src/main/resources/fabric.mod.json b/src/main/resources/fabric.mod.json index df6b6a90..4ba4caed 100644 --- a/src/main/resources/fabric.mod.json +++ b/src/main/resources/fabric.mod.json @@ -5,6 +5,7 @@ "name": "Deep Mob Learning: Refabricated", "description": "A revitalized version of IterationFunk's server friendly mob loot acquisition mod, now on Fabric!", "authors": ["NathanPB", "Luligabi", "IterationFunk"], + "contributors": ["ProjectET"], "contact": { "homepage": "https://www.curseforge.com/minecraft/mc-mods/deep-mob-learning-refabricated", "repo": "https://github.com/CafeteriaGuild/DeepMobLearning-Refabricated",