From 3c7d145ca84303d6799f67e9046a11c1a5874ce3 Mon Sep 17 00:00:00 2001 From: Username404 Date: Wed, 28 Jul 2021 19:57:59 +0200 Subject: [PATCH] Make a few overridden methods of ButtonImpl.kt final and rename the mixins .json files --- build.gradle.kts | 2 +- .../fr/username404/snowygui/gui/feature/ButtonImpl.kt | 6 +++--- .../{snowygui-mixins.json => snowygui-common.mixins.json} | 0 fabric/src/main/resources/fabric.mod.json | 4 ++-- ...wygui-mixins-fabric.json => snowygui-fabric.mixins.json} | 0 5 files changed, 6 insertions(+), 6 deletions(-) rename common/src/main/resources/{snowygui-mixins.json => snowygui-common.mixins.json} (100%) rename fabric/src/main/resources/{snowygui-mixins-fabric.json => snowygui-fabric.mixins.json} (100%) diff --git a/build.gradle.kts b/build.gradle.kts index 3ecd361..ef559ee 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -61,7 +61,7 @@ subprojects { officialMojangMappings().crane("dev.architectury:crane:${rootProject.architectury.minecraft}+build.+") } silentMojangMappingsLicense() - mixinConfig("snowygui-mixins.json") + mixinConfig("snowygui-${project.name}.mixins.json") refmapName = "snowygui-${project.name}-refmap.json" } apply(plugin = "com.github.johnrengelman.shadow") diff --git a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt index dcea4e6..dc0e389 100644 --- a/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt +++ b/common/src/main/kotlin/fr/username404/snowygui/gui/feature/ButtonImpl.kt @@ -72,7 +72,7 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { } private fun lightUp() { opacity += ButtonInfo.lightningFactor } private fun lightDown() { opacity -= ButtonInfo.lightningFactor } - override fun mouseClicked(d: Double, e: Double, i: Int): Boolean { + final override fun mouseClicked(d: Double, e: Double, i: Int): Boolean { wasWithinBounds = isWithinBounds(d, e).also { if (it) { if (info.kind == Type.TOGGLE) { @@ -83,13 +83,13 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { return false } - override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { + final override fun mouseReleased(d: Double, e: Double, i: Int): Boolean { if (wasWithinBounds && (info.kind == Type.CLICK)) { execAction() lightDown() }; return false } - override fun render(poseStack: PoseStack?) { + final override fun render(poseStack: PoseStack?) { prepareDraw() defaultRectFunc() endDraw() diff --git a/common/src/main/resources/snowygui-mixins.json b/common/src/main/resources/snowygui-common.mixins.json similarity index 100% rename from common/src/main/resources/snowygui-mixins.json rename to common/src/main/resources/snowygui-common.mixins.json diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index f332e62..c702ea3 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -29,8 +29,8 @@ ] }, "mixins": [ - "snowygui-mixins.json", - "snowygui-mixins-fabric.json" + "snowygui-common.mixins.json", + "snowygui-fabric.mixins.json" ], "depends": { "fabricloader": ">=0.11.0", diff --git a/fabric/src/main/resources/snowygui-mixins-fabric.json b/fabric/src/main/resources/snowygui-fabric.mixins.json similarity index 100% rename from fabric/src/main/resources/snowygui-mixins-fabric.json rename to fabric/src/main/resources/snowygui-fabric.mixins.json