From d215d11ead6c34370eba2969062c097cd58ae110 Mon Sep 17 00:00:00 2001 From: Daniel Norris Date: Wed, 12 Jun 2024 12:08:25 +0100 Subject: [PATCH] ref(forge): update config screen registry to use new method --- src/main/java/yalter/mousetweaks/ConfigScreen.java | 1 - .../yalter/mousetweaks/forge/ClientHelper.java | 14 -------------- .../yalter/mousetweaks/forge/MouseTweaksForge.java | 7 ++----- 3 files changed, 2 insertions(+), 20 deletions(-) delete mode 100644 src/main/java/yalter/mousetweaks/forge/ClientHelper.java diff --git a/src/main/java/yalter/mousetweaks/ConfigScreen.java b/src/main/java/yalter/mousetweaks/ConfigScreen.java index 8994a7f..60dd916 100644 --- a/src/main/java/yalter/mousetweaks/ConfigScreen.java +++ b/src/main/java/yalter/mousetweaks/ConfigScreen.java @@ -1,6 +1,5 @@ package yalter.mousetweaks; -import com.mojang.blaze3d.vertex.PoseStack; import net.minecraft.client.gui.GuiGraphics; import net.minecraft.client.gui.components.Button; import net.minecraft.client.gui.components.CycleButton; diff --git a/src/main/java/yalter/mousetweaks/forge/ClientHelper.java b/src/main/java/yalter/mousetweaks/forge/ClientHelper.java deleted file mode 100644 index 70e25a9..0000000 --- a/src/main/java/yalter/mousetweaks/forge/ClientHelper.java +++ /dev/null @@ -1,14 +0,0 @@ -package yalter.mousetweaks.forge; - -import net.minecraftforge.client.ConfigScreenHandler.ConfigScreenFactory; -import yalter.mousetweaks.ConfigScreen; - -/** - * Functions accessing client-only classes, extracted so that they can be called from MouseTweaksForge - * without causing class-loading errors on the server. - */ -public class ClientHelper { - public static ConfigScreenFactory createConfigScreenFactory() { - return new ConfigScreenFactory((minecraft, screen) -> new ConfigScreen(screen)); - } -} diff --git a/src/main/java/yalter/mousetweaks/forge/MouseTweaksForge.java b/src/main/java/yalter/mousetweaks/forge/MouseTweaksForge.java index 9d3b919..25b5c30 100644 --- a/src/main/java/yalter/mousetweaks/forge/MouseTweaksForge.java +++ b/src/main/java/yalter/mousetweaks/forge/MouseTweaksForge.java @@ -12,10 +12,7 @@ import net.minecraftforge.fml.ModLoadingContext; import net.minecraftforge.fml.common.Mod; import net.minecraftforge.fml.loading.FMLEnvironment; -import yalter.mousetweaks.Constants; -import yalter.mousetweaks.Logger; -import yalter.mousetweaks.Main; -import yalter.mousetweaks.MouseButton; +import yalter.mousetweaks.*; @Mod(Constants.MOD_ID) public class MouseTweaksForge { @@ -23,7 +20,7 @@ public MouseTweaksForge() { Main.initialize(); MinecraftForge.EVENT_BUS.register(this); - ModLoadingContext.get().registerExtensionPoint(ConfigScreenFactory.class, ClientHelper::createConfigScreenFactory); + MinecraftForge.registerConfigScreen(ConfigScreen::new); } @SubscribeEvent