Make a few overridden methods of ButtonImpl.kt final and rename the mixins .json files

This commit is contained in:
Username404 2021-07-28 19:57:59 +02:00
parent 596eb27fff
commit 3c7d145ca8
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
5 changed files with 6 additions and 6 deletions

View File

@ -61,7 +61,7 @@ subprojects {
officialMojangMappings().crane("dev.architectury:crane:${rootProject.architectury.minecraft}+build.+") officialMojangMappings().crane("dev.architectury:crane:${rootProject.architectury.minecraft}+build.+")
} }
silentMojangMappingsLicense() silentMojangMappingsLicense()
mixinConfig("snowygui-mixins.json") mixinConfig("snowygui-${project.name}.mixins.json")
refmapName = "snowygui-${project.name}-refmap.json" refmapName = "snowygui-${project.name}-refmap.json"
} }
apply(plugin = "com.github.johnrengelman.shadow") apply(plugin = "com.github.johnrengelman.shadow")

View File

@ -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 lightUp() { opacity += ButtonInfo.lightningFactor }
private fun lightDown() { 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 { wasWithinBounds = isWithinBounds(d, e).also {
if (it) { if (it) {
if (info.kind == Type.TOGGLE) { if (info.kind == Type.TOGGLE) {
@ -83,13 +83,13 @@ sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
return false 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)) { if (wasWithinBounds && (info.kind == Type.CLICK)) {
execAction() execAction()
lightDown() lightDown()
}; return false }; return false
} }
override fun render(poseStack: PoseStack?) { final override fun render(poseStack: PoseStack?) {
prepareDraw() prepareDraw()
defaultRectFunc() defaultRectFunc()
endDraw() endDraw()

View File

@ -29,8 +29,8 @@
] ]
}, },
"mixins": [ "mixins": [
"snowygui-mixins.json", "snowygui-common.mixins.json",
"snowygui-mixins-fabric.json" "snowygui-fabric.mixins.json"
], ],
"depends": { "depends": {
"fabricloader": ">=0.11.0", "fabricloader": ">=0.11.0",