Move TitleScreenMixin to fabric, to replace it using a RegisterMenuScreensEvent in neoforge

Signed-off-by: Username404-59 <w.iron.zombie@gmail.com>
This commit is contained in:
Username404-59 2025-02-02 19:48:02 +01:00
parent febeddb093
commit 2fa0575f68
Signed by: Username404-59
GPG Key ID: 7AB361FBB257A5D1
6 changed files with 17 additions and 2 deletions

View File

@ -13,7 +13,7 @@ import net.minecraft.client.gui.GuiGraphics
import kotlin.reflect.full.findAnnotation import kotlin.reflect.full.findAnnotation
sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) { sealed class ButtonImpl: ColoredElement(0.0, 0.0, 73, 8, opacity = 0.60F) {
internal companion object { companion object {
private fun addButtons(vararg buttons: ButtonImpl) { private fun addButtons(vararg buttons: ButtonImpl) {
buttons.groupBy { impl -> buttons.groupBy { impl ->
ClickGui.clickBoxes.find { box -> ClickGui.clickBoxes.find { box ->

View File

@ -5,7 +5,6 @@
"client": [ "client": [
"KeysAccessor", "KeysAccessor",
"KeyMappings", "KeyMappings",
"TitleScreenMixin",
"OptionValueAccessor" "OptionValueAccessor"
], ],
"injectors": { "injectors": {

View File

@ -4,6 +4,7 @@
"compatibilityLevel": "JAVA_18", "compatibilityLevel": "JAVA_18",
"client": [ "client": [
"EndTickMixin", "EndTickMixin",
"TitleScreenMixin",
"ZoomMixin", "ZoomMixin",
"OkZoomerAlternativeMixin" "OkZoomerAlternativeMixin"
], ],

View File

@ -30,6 +30,7 @@ class ForgeInit(container: ModContainer): Snowy() {
container.eventBus!!.run { container.eventBus!!.run {
addListener(this@ForgeInit::initSetup) addListener(this@ForgeInit::initSetup)
register(EndTickHandler) register(EndTickHandler)
register(MiscHandlers)
register(HudHandler) register(HudHandler)
register(ZoomHandler) register(ZoomHandler)
} }

View File

@ -0,0 +1,14 @@
package fr.username404.snowygui.forge
import fr.username404.snowygui.ClickGui
import fr.username404.snowygui.gui.feature.ButtonImpl
import net.neoforged.bus.api.SubscribeEvent
import net.neoforged.neoforge.client.event.RegisterMenuScreensEvent
object MiscHandlers {
@SubscribeEvent
fun handleClickGuiInit(event: RegisterMenuScreensEvent) {
ClickGui.tick()
ButtonImpl.initButtons()
}
}