Shorten SnowyConfigScreen in ConfigScreen.kt
This commit is contained in:
parent
cd4d25951c
commit
34de53beee
|
@ -24,8 +24,17 @@ private fun supplyComponent(string: String?): Optional<Component> = string?.run
|
||||||
Optional.of(TranslatableComponent(string))
|
Optional.of(TranslatableComponent(string))
|
||||||
} ?: Optional.empty()
|
} ?: Optional.empty()
|
||||||
|
|
||||||
val SnowyConfigScreen: Screen get() {
|
val SnowyConfigScreen: Screen = object: Screen(translationComponent) {
|
||||||
return try {
|
override fun isPauseScreen(): Boolean = false
|
||||||
|
override fun render(poseStack: PoseStack, i: Int, j: Int, f: Float) {
|
||||||
|
super.renderBackground(poseStack)
|
||||||
|
FontUtil.drawScaled(poseStack,
|
||||||
|
text = "An appropriate version of the Cloth Config mod is required for the configuration of snowygui.", 16.0, 16.0,
|
||||||
|
color = Colors.WHITE, scaleFactor = 0.85F
|
||||||
|
)
|
||||||
|
}
|
||||||
|
override fun onClose() { minecraft?.screen = configScreenParent }
|
||||||
|
}; get() = try {
|
||||||
Class.forName("me.shedaniel.clothconfig2.api.ConfigBuilder")
|
Class.forName("me.shedaniel.clothconfig2.api.ConfigBuilder")
|
||||||
val macrosBox: ClickBox = ClickGui.components.find {
|
val macrosBox: ClickBox = ClickGui.components.find {
|
||||||
(it is ClickBox) && it.isCategory(Category.MACROS)
|
(it is ClickBox) && it.isCategory(Category.MACROS)
|
||||||
|
@ -88,22 +97,10 @@ val SnowyConfigScreen: Screen get() {
|
||||||
macrosButtons.add(newMacro)
|
macrosButtons.add(newMacro)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}; if (it.isEmpty().also { empty -> macrosBox.hidden = empty })
|
||||||
if (it.isEmpty().also { empty -> macrosBox.hidden = empty }) macrosButtons.clear()
|
macrosButtons.clear()
|
||||||
}.build())
|
|
||||||
}
|
|
||||||
}.build()
|
}.build()
|
||||||
} catch (e: ClassNotFoundException) {
|
|
||||||
object: Screen(translationComponent) {
|
|
||||||
override fun isPauseScreen(): Boolean = false
|
|
||||||
override fun render(poseStack: PoseStack, i: Int, j: Int, f: Float) {
|
|
||||||
super.renderBackground(poseStack)
|
|
||||||
FontUtil.drawScaled(poseStack,
|
|
||||||
text = "An appropriate version of the Cloth Config mod is required for the configuration of snowygui.", 16.0, 16.0,
|
|
||||||
color = Colors.WHITE, scaleFactor = 0.85F
|
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
override fun onClose() { minecraft?.screen = configScreenParent }
|
}.build()
|
||||||
}
|
} catch (e: ClassNotFoundException) { field }
|
||||||
}
|
|
||||||
}
|
|
Loading…
Reference in New Issue