From d3a95948e76b90e1a09204f02e55b04633fd12a4 Mon Sep 17 00:00:00 2001 From: 7AGAM Date: Tue, 5 Nov 2024 21:02:12 +0100 Subject: [PATCH] Added CapeMod support Added support for CapeMod. Also in in the toggle menu. Co-Authored-By: Cael <16297430+CaelTheColher@users.noreply.github.com> --- common/src/main/kotlin/me/cael/capes/CapeConfig.kt | 1 + common/src/main/kotlin/me/cael/capes/CapeType.kt | 6 ++++-- .../src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt | 10 ++++++++-- fabric/src/main/resources/fabric.mod.json | 2 +- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/common/src/main/kotlin/me/cael/capes/CapeConfig.kt b/common/src/main/kotlin/me/cael/capes/CapeConfig.kt index 25bcade..e3c6738 100644 --- a/common/src/main/kotlin/me/cael/capes/CapeConfig.kt +++ b/common/src/main/kotlin/me/cael/capes/CapeConfig.kt @@ -13,6 +13,7 @@ class CapeConfig { var enableMinecraftCapesMod = false var enableCosmetica = false var enableCloaksPlus = false + var enableCapeMod = false var enableElytraTexture = true fun save() { diff --git a/common/src/main/kotlin/me/cael/capes/CapeType.kt b/common/src/main/kotlin/me/cael/capes/CapeType.kt index bbe96ca..f1a5fdd 100644 --- a/common/src/main/kotlin/me/cael/capes/CapeType.kt +++ b/common/src/main/kotlin/me/cael/capes/CapeType.kt @@ -5,7 +5,7 @@ import net.minecraft.screen.ScreenTexts import net.minecraft.text.Text enum class CapeType(val stylized: String) { - MINECRAFT("Minecraft"), OPTIFINE("OptiFine"), LABYMOD("LabyMod"), WYNNTILS("Wynntils"), MINECRAFTCAPES("MinecraftCapes"), COSMETICA("Cosmetica"), CLOAKSPLUS("Cloaks+"); + MINECRAFT("Minecraft"), OPTIFINE("OptiFine"), LABYMOD("LabyMod"), WYNNTILS("Wynntils"), MINECRAFTCAPES("MinecraftCapes"), COSMETICA("Cosmetica"), CLOAKSPLUS("Cloaks+"), CAPEMOD("CapeMod"); fun cycle() = when(this) { MINECRAFT -> OPTIFINE @@ -14,7 +14,8 @@ enum class CapeType(val stylized: String) { WYNNTILS -> COSMETICA COSMETICA -> MINECRAFTCAPES MINECRAFTCAPES -> CLOAKSPLUS - CLOAKSPLUS -> MINECRAFT + CLOAKSPLUS -> CAPEMOD + CAPEMOD -> MINECRAFT } fun getURL(profile: GameProfile): String? { @@ -26,6 +27,7 @@ enum class CapeType(val stylized: String) { COSMETICA -> if(config.enableCosmetica) "https://api.cosmetica.cc/get/cloak?username=${profile.name}&uuid=${profile.id}¬hirdparty" else null MINECRAFTCAPES -> if(config.enableMinecraftCapesMod) "https://api.minecraftcapes.net/profile/${profile.id.toString().replace("-", "")}" else null CLOAKSPLUS -> if(config.enableCloaksPlus) "http://161.35.130.99/capes/${profile.name}.png" else null + CAPEMOD -> if(config.enableCapeMod) "https://capes.capemod.com/api/cape/?uuid=${profile.id}" else null MINECRAFT -> null } } diff --git a/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt b/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt index 4b7b115..fab69b6 100644 --- a/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt +++ b/common/src/main/kotlin/me/cael/capes/menu/ToggleMenu.kt @@ -51,15 +51,21 @@ class ToggleMenu(parent: Screen, gameOptions: GameOptions) : MainMenu(parent, ga it.message = CapeType.CLOAKSPLUS.getToggleText(config.enableCloaksPlus) }.position(width / 2 - 155 + 160, height / 7 + 3 * 24).size(150, 20).build()) + addDrawableChild(ButtonWidget.builder(CapeType.CAPEMOD.getToggleText(config.enableCapeMod)) { + config.enableCapeMod = !config.enableCapeMod + config.save() + it.message = CapeType.CAPEMOD.getToggleText(config.enableCapeMod) + }.position(width / 2 - 155, height / 7 + 4 * 24).size(150, 20).build()) + addDrawableChild(ButtonWidget.builder(elytraMessage(config.enableElytraTexture)) { config.enableElytraTexture = !config.enableElytraTexture config.save() it.message = elytraMessage(config.enableElytraTexture) - }.position((width/2) - (200 / 2), height / 7 + 4 * 24).size(200, 20).build()) + }.position((width/2) - (200 / 2), height / 7 + 5 * 24).size(200, 20).build()) addDrawableChild(ButtonWidget.builder(ScreenTexts.DONE) { client!!.setScreen(parent) - }.position((width/2) - (200 / 2), height / 7 + 5 * 24).size(200, 20).build()) + }.position((width/2) - (200 / 2), height / 7 + 6 * 24).size(200, 20).build()) } diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index bd728c5..d01a4ef 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -4,7 +4,7 @@ "version": "${version}", "name": "Capes", - "description": "A mod that lets you use capes from Optifine, LabyMod, Cosmetica, Wynntils, Capes++, and the MinecraftCapes Mod.", + "description": "A mod that lets you use capes from Optifine, LabyMod, Cosmetica, Wynntils, Capes++, CapeMod, and the MinecraftCapes Mod.", "authors": [ "Cael" ],