diff --git a/build.gradle.kts b/build.gradle.kts index eb0b2d8..692a3cf 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,84 +1,41 @@ @file:Suppress("UnstableApiUsage", "PropertyName") -import org.polyfrost.gradle.util.noServerRunConfigs -import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar +import dev.deftu.gradle.utils.GameSide -// Adds support for kotlin, and adds the Polyfrost Gradle Toolkit -// which we use to prepare the environment. plugins { - kotlin("jvm") - id("org.polyfrost.multi-version") - id("org.polyfrost.defaults.repo") - id("org.polyfrost.defaults.java") - id("org.polyfrost.defaults.loom") - id("com.github.johnrengelman.shadow") - id("net.kyori.blossom") version "1.3.2" - id("signing") java + kotlin("jvm") + id("dev.deftu.gradle.multiversion") + id("dev.deftu.gradle.tools") + id("dev.deftu.gradle.tools.resources") + id("dev.deftu.gradle.tools.bloom") + id("dev.deftu.gradle.tools.shadow") + id("dev.deftu.gradle.tools.minecraft.loom") } -// Gets the mod name, version and id from the `gradle.properties` file. -val mod_name: String by project -val mod_version: String by project -val mod_id: String by project -val mod_archives_name: String by project - - -// Replaces the variables in `ExampleMod.java` to the ones specified in `gradle.properties`. -blossom { - replaceToken("@VER@", mod_version) - replaceToken("@NAME@", mod_name) - replaceToken("@ID@", mod_id) -} - -// Sets the mod version to the one specified in `gradle.properties`. Make sure to change this following semver! -version = mod_version -// Sets the group, make sure to change this to your own. It can be a website you own backwards or your GitHub username. -// e.g. com.github. or com. -group = "org.polyfrost" +toolkitLoomHelper { + // Adds OneConfig to our project + useOneConfig(mcData.version, mcData.loader, "commands", "config-impl", "events", "internal", "ui") -// Sets the name of the output jar (the one you put in your mods folder and send to other people) -// It outputs all versions of the mod into the `build` directory. -base { - archivesName.set("$mod_archives_name-$platform") -} - -// Configures the Polyfrost Loom, our plugin fork to easily set up the programming environment. -loom { // Removes the server configs from IntelliJ IDEA, leaving only client runs. // If you're developing a server-side mod, you can remove this line. - noServerRunConfigs() + disableRunConfigs(GameSide.SERVER) - // Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org) - if (project.platform.isLegacyForge) { - runConfigs { - "client" { - programArgs("--tweakClass", "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker") - property("mixin.debug.export", "true") - } - } - } - // Configures the mixins if we are building for forge, useful for when we are dealing with cross-platform projects. - if (project.platform.isForge) { - forge { - mixinConfig("mixins.${mod_id}.json") - } + // Sets up our Mixin refmap naming + if (!mcData.isNeoForge) { + useMixinRefMap(modData.id) } - // Configures the name of the mixin "refmap" using an experimental loom api. - mixin.defaultRefmapName.set("mixins.${mod_id}.refmap.json") -} -// Creates the shade/shadow configuration, so we can include libraries inside our mod, rather than having to add them separately. -val shade: Configuration by configurations.creating { - configurations.implementation.get().extendsFrom(this) + // Adds the tweak class if we are building legacy version of forge as per the documentation (https://docs.polyfrost.org) + if (mcData.isLegacyForge) { + useTweaker("org.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker", GameSide.CLIENT) + useForgeMixin(modData.id) // Configures the mixins if we are building for forge, useful for when we are dealing with cross-platform projects. + } } // Configures the output directory for when building from the `src/resources` directory. sourceSets { - val dummy by creating main { - dummy.compileClasspath += compileClasspath - compileClasspath += dummy.output output.setResourcesDir(java.classesDirectory) } } @@ -86,108 +43,14 @@ sourceSets { // Adds the Polyfrost maven repository so that we can get the libraries necessary to develop the mod. repositories { maven("https://repo.polyfrost.org/releases") + maven("https://repo.polyfrost.org/snapshots") } // Configures the libraries/dependencies for your mod. dependencies { - // Adds the OneConfig library, so we can develop with it. - modCompileOnly("cc.polyfrost:oneconfig-$platform:0.2.2-alpha+") - - modRuntimeOnly("me.djtheredstoner:DevAuth-${if (platform.isFabric) "fabric" else if (platform.isLegacyForge) "forge-legacy" else "forge-latest"}:1.2.0") - + implementation(shade("gs.mclo:api:3.0.1")!!) // If we are building for legacy forge, includes the launch wrapper with `shade` as we configured earlier. - if (platform.isLegacyForge) { + if (mcData.isLegacyForge) { compileOnly("org.spongepowered:mixin:0.7.11-SNAPSHOT") - shade("cc.polyfrost:oneconfig-wrapper-launchwrapper:1.0.0-beta17") - } -} - -tasks { - // Processes the `src/resources/mcmod.info or fabric.mod.json` and replaces - // the mod id, name and version with the ones in `gradle.properties` - processResources { - inputs.property("id", mod_id) - inputs.property("name", mod_name) - val java = if (project.platform.mcMinor >= 18) { - 17 // If we are playing on version 1.18, set the java version to 17 - } else { - // Else if we are playing on version 1.17, use java 16. - if (project.platform.mcMinor == 17) - 16 - else - 8 // For all previous versions, we **need** java 8 (for Forge support). - } - val compatLevel = "JAVA_${java}" - inputs.property("java", java) - inputs.property("java_level", compatLevel) - inputs.property("version", mod_version) - inputs.property("mcVersionStr", project.platform.mcVersionStr) - filesMatching(listOf("mcmod.info", "mixins.${mod_id}.json", "mods.toml")) { - expand( - mapOf( - "id" to mod_id, - "name" to mod_name, - "java" to java, - "java_level" to compatLevel, - "version" to mod_version, - "mcVersionStr" to project.platform.mcVersionStr - ) - ) - } - filesMatching("fabric.mod.json") { - expand( - mapOf( - "id" to mod_id, - "name" to mod_name, - "java" to java, - "java_level" to compatLevel, - "version" to mod_version, - "mcVersionStr" to project.platform.mcVersionStr.substringBeforeLast(".") + ".x" - ) - ) - } - } - - // Configures the resources to include if we are building for forge or fabric. - withType(Jar::class.java) { - if (project.platform.isFabric) { - exclude("mcmod.info", "mods.toml") - } else { - exclude("fabric.mod.json") - if (project.platform.isLegacyForge) { - exclude("mods.toml") - } else { - exclude("mcmod.info") - } - } - } - - // Configures our shadow/shade configuration, so we can - // include some dependencies within our mod jar file. - named("shadowJar") { - archiveClassifier.set("dev") // TODO: machete gets confused by the `dev` prefix. - configurations = listOf(shade) - duplicatesStrategy = DuplicatesStrategy.EXCLUDE - } - - remapJar { - inputFile.set(shadowJar.get().archiveFile) - archiveClassifier.set("") - } - - jar { - // Sets the jar manifest attributes. - if (platform.isLegacyForge) { - manifest.attributes += mapOf( - "ModSide" to "CLIENT", // We aren't developing a server-side mod, so this is fine. - "ForceLoadAsMod" to true, // We want to load this jar as a mod, so we force Forge to do so. - "TweakOrder" to "0", // Makes sure that the OneConfig launch wrapper is loaded as soon as possible. - "MixinConfigs" to "mixins.${mod_id}.json", // We want to use our mixin configuration, so we specify it here. - "TweakClass" to "cc.polyfrost.oneconfig.loader.stage0.LaunchWrapperTweaker" // Loads the OneConfig launch wrapper. - ) - } - dependsOn(shadowJar) - archiveClassifier.set("") - enabled = false } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index ff353e6..9fb8d30 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,12 +1,12 @@ -mod_name = GlintColorizer -mod_id = glintcolorizer -mod_version = 2.0.1 -mod_archives_name = GlintColorizer - # Gradle Configuration -- DO NOT TOUCH THESE VALUES. polyfrost.defaults.loom=3 org.gradle.daemon=true org.gradle.parallel=true org.gradle.configureoncommand=true org.gradle.parallel.threads=4 -org.gradle.jvmargs=-Xmx2G \ No newline at end of file +org.gradle.jvmargs=-Xmx2G + +mod.name=GlintColorizer +mod.id=glintcolorizer +mod.version=2.0.1 +mod.group=org.polyfrost \ No newline at end of file diff --git a/root.gradle.kts b/root.gradle.kts index e490f41..234330e 100644 --- a/root.gradle.kts +++ b/root.gradle.kts @@ -1,13 +1,7 @@ plugins { - kotlin("jvm") version "1.9.10" apply false - id("org.polyfrost.multi-version.root") - id("com.github.johnrengelman.shadow") version "8.1.1" apply false + id("dev.deftu.gradle.multiversion-root") } preprocess { -// "1.12.2-forge"(11202, "srg") { - "1.8.9-forge"(10809, "srg", -// rootProject.file("versions/1.12.2-1.8.9.txt") - ) -// } + "1.8.9-forge"(10809, "srg") {} } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts index b2cca22..70cb3f4 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,29 +1,39 @@ -@file:Suppress("PropertyName") +import groovy.lang.MissingPropertyException pluginManagement { repositories { + // Repositories + maven("https://maven.deftu.dev/releases") + maven("https://maven.fabricmc.net") + maven("https://maven.architectury.dev/") + maven("https://maven.minecraftforge.net") + maven("https://repo.essential.gg/repository/maven-public") + maven("https://server.bbkr.space/artifactory/libs-release/") + maven("https://jitpack.io/") + + // Snapshots + maven("https://maven.deftu.dev/snapshots") + mavenLocal() + + // Default repositories gradlePluginPortal() mavenCentral() - maven("https://repo.polyfrost.org/releases") // Adds the Polyfrost maven repository to get Polyfrost Gradle Toolkit } + plugins { - val pgtVersion = "0.6.5" // Sets the default versions for Polyfrost Gradle Toolkit - id("org.polyfrost.multi-version.root") version pgtVersion + kotlin("jvm") version("2.0.0") + id("dev.deftu.gradle.multiversion-root") version("2.11.2") } } -val mod_name: String by settings - -// Configures the root project Gradle name based on the value in `gradle.properties` -rootProject.name = mod_name +val projectName: String = extra["mod.name"]?.toString() + ?: throw MissingPropertyException("mod.name has not been set.") +rootProject.name = projectName rootProject.buildFileName = "root.gradle.kts" // Adds all of our build target versions to the classpath if we need to add version-specific code. listOf( "1.8.9-forge" -// , - // Update this if you want to remove/add a version, along with `build.gradle.kts` and `root.gradle.kts`. -// "1.12.2-forge" ).forEach { version -> include(":$version") project(":$version").apply { diff --git a/src/dummy/java/cc/polyfrost/oneconfig/internal/config/annotations/Option.java b/src/dummy/java/cc/polyfrost/oneconfig/internal/config/annotations/Option.java index aa0a9b7..52f386d 100644 --- a/src/dummy/java/cc/polyfrost/oneconfig/internal/config/annotations/Option.java +++ b/src/dummy/java/cc/polyfrost/oneconfig/internal/config/annotations/Option.java @@ -1,4 +1,4 @@ -package cc.polyfrost.oneconfig.internal.config.annotations; +package org.polyfrost.oneconfig.internal.config.annotations; public @interface Option { } \ No newline at end of file diff --git a/src/main/java/org/polyfrost/glintcolorizer/mixin/LayerArmorBaseMixin.java b/src/main/java/org/polyfrost/glintcolorizer/mixin/LayerArmorBaseMixin.java index 4fcfbc6..1e3795d 100644 --- a/src/main/java/org/polyfrost/glintcolorizer/mixin/LayerArmorBaseMixin.java +++ b/src/main/java/org/polyfrost/glintcolorizer/mixin/LayerArmorBaseMixin.java @@ -1,11 +1,11 @@ package org.polyfrost.glintcolorizer.mixin; -import cc.polyfrost.oneconfig.utils.color.ColorUtils; import net.minecraft.client.model.ModelBase; import net.minecraft.client.renderer.entity.layers.LayerRenderer; import net.minecraft.entity.EntityLivingBase; import org.polyfrost.glintcolorizer.config.GlintConfig; import net.minecraft.client.renderer.entity.layers.LayerArmorBase; +import org.polyfrost.polyui.color.ColorUtils; import org.spongepowered.asm.mixin.Mixin; import org.spongepowered.asm.mixin.injection.At; import org.spongepowered.asm.mixin.injection.Inject; @@ -40,7 +40,7 @@ public abstract class LayerArmorBaseMixin implements LayerR ) ) private void glintColorizer$modifyArmorColor(Args args) { - int color = GlintConfig.INSTANCE.getArmorColor().getRGB(); + int color = GlintConfig.INSTANCE.getArmorColor().getRgba(); args.set(0, (float) ColorUtils.getRed(color) / 255); args.set(1, (float) ColorUtils.getGreen(color) / 255); args.set(2, (float) ColorUtils.getBlue(color) / 255); diff --git a/src/main/java/org/polyfrost/glintcolorizer/mixin/RenderItemMixin_GlintCustomizer.java b/src/main/java/org/polyfrost/glintcolorizer/mixin/RenderItemMixin_GlintCustomizer.java index 7bdf639..0e2d9fd 100644 --- a/src/main/java/org/polyfrost/glintcolorizer/mixin/RenderItemMixin_GlintCustomizer.java +++ b/src/main/java/org/polyfrost/glintcolorizer/mixin/RenderItemMixin_GlintCustomizer.java @@ -158,8 +158,8 @@ public class RenderItemMixin_GlintCustomizer { @Unique private int glintColorizer$getColor(GlintEffectOptions settings, boolean isFirstStroke) { return settings.getIndividualStrokes() ? - (isFirstStroke ? settings.getStrokeOneColor().getRGB() : settings.getStrokeTwoColor().getRGB()) : - settings.getGlintColor().getRGB(); + (isFirstStroke ? settings.getStrokeOneColor().getRgba() : settings.getStrokeTwoColor().getRgba()) : + settings.getGlintColor().getRgba(); } @Unique diff --git a/src/main/java/org/polyfrost/glintcolorizer/mixin/oneconfig/ConfigMixin.java b/src/main/java/org/polyfrost/glintcolorizer/mixin/oneconfig/ConfigMixin.java index 2ae5e2f..9d1cec4 100644 --- a/src/main/java/org/polyfrost/glintcolorizer/mixin/oneconfig/ConfigMixin.java +++ b/src/main/java/org/polyfrost/glintcolorizer/mixin/oneconfig/ConfigMixin.java @@ -1,11 +1,11 @@ package org.polyfrost.glintcolorizer.mixin.oneconfig; -import cc.polyfrost.oneconfig.config.Config; -import cc.polyfrost.oneconfig.config.core.ConfigUtils; -import cc.polyfrost.oneconfig.config.data.Mod; -import cc.polyfrost.oneconfig.config.elements.BasicOption; -import cc.polyfrost.oneconfig.config.elements.OptionPage; -import cc.polyfrost.oneconfig.internal.config.annotations.Option; +import org.polyfrost.oneconfig.config.Config; +import org.polyfrost.oneconfig.config.core.ConfigUtils; +import org.polyfrost.oneconfig.config.data.Mod; +import org.polyfrost.oneconfig.config.elements.BasicOption; +import org.polyfrost.oneconfig.config.elements.OptionPage; +import org.polyfrost.oneconfig.internal.config.annotations.Option; import org.polyfrost.glintcolorizer.config.GlintEffectOptions; import org.polyfrost.glintcolorizer.config.annotation.ColorEntry; import org.spongepowered.asm.mixin.Mixin; diff --git a/src/main/kotlin/org/polyfrost/glintcolorizer/GlintColorizer.kt b/src/main/kotlin/org/polyfrost/glintcolorizer/GlintColorizer.kt index bb3709b..6653608 100644 --- a/src/main/kotlin/org/polyfrost/glintcolorizer/GlintColorizer.kt +++ b/src/main/kotlin/org/polyfrost/glintcolorizer/GlintColorizer.kt @@ -1,23 +1,23 @@ package org.polyfrost.glintcolorizer -import cc.polyfrost.oneconfig.utils.commands.CommandManager import net.minecraftforge.fml.common.Mod import net.minecraftforge.fml.common.event.FMLInitializationEvent import net.minecraftforge.fml.common.event.FMLPostInitializationEvent import org.polyfrost.glintcolorizer.command.GlintCommand import org.polyfrost.glintcolorizer.config.GlintConfig +import org.polyfrost.oneconfig.api.commands.v1.CommandManager @Mod( modid = GlintColorizer.ID, name = GlintColorizer.NAME, version = GlintColorizer.VER, - modLanguageAdapter = "cc.polyfrost.oneconfig.utils.KotlinLanguageAdapter" + modLanguageAdapter = "org.polyfrost.oneconfig.utils.KotlinLanguageAdapter" ) object GlintColorizer { - const val NAME: String = "@NAME@" - const val VER: String = "@VER@" - const val ID: String = "@ID@" + const val NAME: String = "@MOD_NAME@" + const val VER: String = "@MOD_VERSION@" + const val ID: String = "@MOD_ID@" @Mod.EventHandler fun onInit(event: FMLInitializationEvent?) { @@ -26,7 +26,7 @@ object GlintColorizer { @Mod.EventHandler fun postInit(event: FMLPostInitializationEvent?) { - CommandManager.INSTANCE.registerCommand(GlintCommand()) + CommandManager.registerCommand(GlintCommand()) } } diff --git a/src/main/kotlin/org/polyfrost/glintcolorizer/command/GlintCommand.kt b/src/main/kotlin/org/polyfrost/glintcolorizer/command/GlintCommand.kt index 73bb2ef..3fdc002 100644 --- a/src/main/kotlin/org/polyfrost/glintcolorizer/command/GlintCommand.kt +++ b/src/main/kotlin/org/polyfrost/glintcolorizer/command/GlintCommand.kt @@ -1,17 +1,16 @@ package org.polyfrost.glintcolorizer.command -import cc.polyfrost.oneconfig.utils.commands.annotations.Command -import cc.polyfrost.oneconfig.utils.commands.annotations.Main import org.polyfrost.glintcolorizer.GlintColorizer import org.polyfrost.glintcolorizer.config.GlintConfig +import org.polyfrost.oneconfig.api.commands.v1.factories.annotated.Command @Command( - value = GlintColorizer.ID, + value = [GlintColorizer.ID], description = "Access the " + GlintColorizer.NAME + " GUI." ) class GlintCommand { - @Main + @Command fun handle() { GlintConfig.openGui() } diff --git a/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintConfig.kt b/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintConfig.kt index 48ef718..fffa571 100644 --- a/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintConfig.kt +++ b/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintConfig.kt @@ -1,45 +1,46 @@ package org.polyfrost.glintcolorizer.config -import cc.polyfrost.oneconfig.config.Config -import cc.polyfrost.oneconfig.config.annotations.* -import cc.polyfrost.oneconfig.config.core.OneColor -import cc.polyfrost.oneconfig.config.data.Mod -import cc.polyfrost.oneconfig.config.data.ModType -import cc.polyfrost.oneconfig.config.migration.VigilanceMigrator import org.polyfrost.glintcolorizer.GlintColorizer import org.polyfrost.glintcolorizer.config.annotation.ColorEntry -import cc.polyfrost.oneconfig.config.annotations.Color -import java.io.File - -object GlintConfig : Config( - Mod( - GlintColorizer.NAME, ModType.UTIL_QOL, "/glintcolorizer_dark.svg", VigilanceMigrator( - File(File(File("./W-OVERFLOW"), GlintColorizer.NAME), GlintColorizer.ID + ".toml").path - ) - ), GlintColorizer.ID + ".json" -) { - - @Exclude val defaultColor = -8372020 - @Exclude var oldGlintValue = -10407781 +import org.polyfrost.oneconfig.api.config.v1.Config +import org.polyfrost.oneconfig.api.config.v1.annotations.Button +import org.polyfrost.oneconfig.api.config.v1.annotations.Checkbox +import org.polyfrost.oneconfig.api.config.v1.annotations.Color +import org.polyfrost.oneconfig.api.config.v1.annotations.Switch +import org.polyfrost.polyui.color.argb + +// +//object GlintConfig : Config( +// Mod( +// GlintColorizer.NAME, ModType.UTIL_QOL, "/glintcolorizer_dark.svg", VigilanceMigrator( +// File(File(File("./W-OVERFLOW"), GlintColorizer.NAME), GlintColorizer.ID + ".toml").path +// ) +// ), GlintColorizer.ID + ".json" +//) { + +object GlintConfig : Config("${GlintColorizer.ID}.json", "/glintcolorizer_dark.svg", GlintColorizer.NAME, Category.QOL) { + + const val DEFAULT_COLOR = -8372020 + private var oldGlintValue = -10407781 @Button( - name = "Reset ALL Colors Settings", + title = "Reset ALL Colors Settings", category = "Global", text = "Reset", description = "Resets ALL custom glint colors settings and defaults them back to the vanilla color." ) var resetColors = Runnable { - globalColor = OneColor(defaultColor) + globalColor = argb(DEFAULT_COLOR) heldItem.reset(true) guiItem.reset(true) droppedItem.reset(true) framedItem.reset(true) shinyPots.reset(true) - armorColor = OneColor(defaultColor) + armorColor = argb(DEFAULT_COLOR) } @Button( - name = "Reset ALL Transformation Settings", + title = "Reset ALL Transformation Settings", category = "Global", text = "Reset", description = "Resets ALL custom glint colors settings and defaults them back to the vanilla color." @@ -53,7 +54,7 @@ object GlintConfig : Config( } @Button( - name = "Reset ALL Shiny Pots Settings", + title = "Reset ALL Shiny Pots Settings", category = "Global", text = "Reset", description = "Resets ALL custom shiny pots settings." @@ -67,15 +68,15 @@ object GlintConfig : Config( } @Color( - name = "Global Glint Color", + title = "Global Glint Color", category = "Global", subcategory = "Configuration", description = "Modifies the color of the enchantment glint." ) - var globalColor = OneColor(defaultColor) + var globalColor = argb(DEFAULT_COLOR) @Button( - name = "Apply Global Glint Color", + title = "Apply Global Glint Color", category = "Global", subcategory = "Configuration", text = "Apply", @@ -83,12 +84,14 @@ object GlintConfig : Config( ) var applyColors = Runnable { /* Singular Colors */ - heldItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } - guiItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } - droppedItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } - framedItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } - shinyPots.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } - armorColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } + // TODO +// heldItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } +// guiItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } +// droppedItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } +// framedItem.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } +// shinyPots.glintColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } +// armorColor = globalColor.clone().also { it.setChromaSpeed(globalColor.dataBit) } + /* Stroke */ heldItem.individualStrokes = false guiItem.individualStrokes = false @@ -98,18 +101,18 @@ object GlintConfig : Config( } @Button( - name = "1.7 Glint Color", + title = "1.7 Glint Color", category = "Global", subcategory = "Configuration", text = "Apply", description = "Applies the 1.7 glint color to all transform types." ) var oldGlint = Runnable { - heldItem.glintColor = OneColor(oldGlintValue) + heldItem.glintColor = argb(oldGlintValue) /* GUI Items' glint color are actually the default 1.8 glint color! */ - droppedItem.glintColor = OneColor(oldGlintValue) - framedItem.glintColor = OneColor(oldGlintValue) - shinyPots.glintColor = OneColor(oldGlintValue) + droppedItem.glintColor = argb(oldGlintValue) + framedItem.glintColor = argb(oldGlintValue) + shinyPots.glintColor = argb(oldGlintValue) } /* Held Items */ @@ -138,18 +141,18 @@ object GlintConfig : Config( /* Armor */ @Button( - name = "Reset Armor Glint", + title = "Reset Armor Glint", category = "Armor", subcategory = "Configuration", text = "Reset", description = "Resets ALL custom glint colors." ) var resetArmor = Runnable { - armorColor = OneColor(defaultColor) + armorColor = argb(DEFAULT_COLOR) } @Switch( - name = "Disable Armor Glint", + title = "Disable Armor Glint", category = "Armor", subcategory = "Color", description = "Disables the enchantment glint on armor." @@ -157,35 +160,35 @@ object GlintConfig : Config( var armorGlintToggle = false @Color( - name = "Armor Glint Color", + title = "Armor Glint Color", category = "Armor", subcategory = "Color", description = "Modifies the color of the enchantment glint." ) - var armorColor = OneColor(defaultColor) + var armorColor = argb(DEFAULT_COLOR) /* Shiny Pots */ @Switch( - name = "Shiny Potions", + title = "Shiny Potions", category = "Shiny Pots" ) var potionGlint = false @Checkbox( - name = "Render Over Full Slot", + title = "Render Over Full Slot", category = "Shiny Pots" ) var potionGlintSize = false @Checkbox( - name = "Render Shiny Effect Only", + title = "Render Shiny Effect Only", description = "Disables the enchantment glint on the potion and solely renders the shiny effect.", category = "Shiny Pots" ) var potionGlintForeground = false @Checkbox( - name = "Custom Shiny Effect Color", + title = "Custom Shiny Effect Color", category = "Shiny Pots", subcategory = "Color" ) @@ -197,14 +200,10 @@ object GlintConfig : Config( var shinyPots = GlintEffectOptions() @Switch( - name = "Potion Color Based Glint", + title = "Potion Color Based Glint", category = "Shiny Pots", subcategory = "Color" ) var potionBasedColor = false - init { - initialize() - } - } \ No newline at end of file diff --git a/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintEffectOptions.kt b/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintEffectOptions.kt index c35fa86..6e917e8 100644 --- a/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintEffectOptions.kt +++ b/src/main/kotlin/org/polyfrost/glintcolorizer/config/GlintEffectOptions.kt @@ -1,13 +1,16 @@ package org.polyfrost.glintcolorizer.config -import cc.polyfrost.oneconfig.config.annotations.* -import cc.polyfrost.oneconfig.config.core.ConfigUtils -import cc.polyfrost.oneconfig.config.core.OneColor +import org.polyfrost.oneconfig.api.config.v1.annotations.Button +import org.polyfrost.oneconfig.api.config.v1.annotations.Color +import org.polyfrost.oneconfig.api.config.v1.annotations.Slider +import org.polyfrost.oneconfig.api.config.v1.annotations.Switch +import org.polyfrost.polyui.color.argb +import org.polyfrost.utils.v1.dsl.openUI class GlintEffectOptions { @Button( - name = "Reset Glint Colors", + title = "Reset Glint Colors", subcategory = "Configuration", text = "Reset", description = "Resets ALL custom glint colors." @@ -15,11 +18,11 @@ class GlintEffectOptions { var resetColor = Runnable { reset(false) GlintConfig.save() - GlintConfig.openGui() + GlintConfig.openUI() } @Button( - name = "Reset Transformations", + title = "Reset Transformations", category = "Held Item", subcategory = "Configuration", text = "Reset", @@ -28,80 +31,81 @@ class GlintEffectOptions { var resetTransforms = Runnable { reset2() GlintConfig.save() - GlintConfig.openGui() + GlintConfig.openUI() } @Switch( - name = "Modify Strokes Individually", + title = "Modify Strokes Individually", subcategory = "Color" ) var individualStrokes = false @Color( - name = "Glint Color", + title = "Glint Color", subcategory = "Color", description = "Modifies the color of the enchantment glint." ) - var glintColor = OneColor(GlintConfig.defaultColor) + var glintColor = argb(GlintConfig.DEFAULT_COLOR) @Color( - name = "Stroke 1 Color", + title = "Stroke 1 Color", subcategory = "Color", description = "Modifies the first stroke of the enchantment glint effect." ) - var strokeOneColor = OneColor(GlintConfig.defaultColor) + var strokeOneColor = argb(GlintConfig.DEFAULT_COLOR) @Color( - name = "Stroke 2 Color", + title = "Stroke 2 Color", subcategory = "Color", description = "Modifies the second stroke of the enchantment glint effect." ) - var strokeTwoColor = OneColor(GlintConfig.defaultColor) + var strokeTwoColor = argb(GlintConfig.DEFAULT_COLOR) @Slider( - name = "Speed", + title = "Speed", subcategory = "Speed", min = 0.1F, max = 10.0F, - instant = true +// instant = true ) var speed = 1.0F @Slider( - name = "Stroke 1 Rotation", + title = "Stroke 1 Rotation", subcategory = "Rotation", min = -180.0F, max = 180.0F, - instant = true +// instant = true ) var strokeRotOne = -50.0F @Slider( - name = "Stroke 2 Rotation", + title = "Stroke 2 Rotation", subcategory = "Rotation", min = -180.0F, max = 180.0F, - instant = true +// instant = true ) var strokeRotTwo = 10.0F @Slider( - name = "Scale", + title = "Scale", subcategory = "Scale", min = 0.0F, max = 8.0F, - instant = true +// instant = true ) var scale = 1.0F fun reset(resetAll: Boolean) { - val target = GlintEffectOptions() - val newFields = ConfigUtils.getClassFields(target::class.java) - val fields = ConfigUtils.getClassFields(this::class.java) - for (i in 0 until fields.size) { - if (!resetAll && fields[i].type != OneColor::class.java) continue - fields[i].set(this, ConfigUtils.getField(newFields[i], target)) - } + // TODO +// val target = GlintEffectOptions() +// val newFields = ConfigUtils.getClassFields(target::class.java) +// val fields = ConfigUtils.getClassFields(this::class.java) +// for (i in 0 until fields.size) { +// if (!resetAll && fields[i].type != OneColor::class.java) continue +// fields[i].set(this, ConfigUtils.getField(newFields[i], target)) +// } } fun reset2() {