浏览代码

Update dependencies

Lortseam 4 年之前
父节点
当前提交
d778d95cee

+ 4 - 4
gradle.properties

@@ -2,7 +2,7 @@ org.gradle.jvmargs=-Xmx1G
 
 # Fabric Properties
 minecraft_version=1.16.5
-yarn_mappings=1.16.5+build.3
+yarn_mappings=1.16.5+build.4
 loader_version=0.11.1
 
 # Mod Properties
@@ -11,7 +11,7 @@ maven_group=me.lortseam
 archives_base_name=uglyscoreboardfix
 
 # Dependencies
-modmenu_version=1.14.13+build.19
-completeconfig_version=0.11.0
+modmenu_version=1.16.6
+completeconfig_version=0.12.0
 cloth_config_version=4.8.3
-lombok_version=1.18.16
+lombok_version=1.18.18

+ 8 - 2
src/main/java/me/lortseam/uglyscoreboardfix/UglyScoreboardFix.java

@@ -1,6 +1,8 @@
 package me.lortseam.uglyscoreboardfix;
 
-import me.lortseam.uglyscoreboardfix.config.Config;
+import lombok.Getter;
+import me.lortseam.completeconfig.data.Config;
+import me.lortseam.uglyscoreboardfix.config.Settings;
 import net.fabricmc.api.ClientModInitializer;
 import net.fabricmc.api.EnvType;
 import net.fabricmc.api.Environment;
@@ -9,10 +11,14 @@ import net.fabricmc.api.Environment;
 public class UglyScoreboardFix implements ClientModInitializer {
 
     public static final String MOD_ID = "uglyscoreboardfix";
+    @Getter
+    private static Config config;
 
     @Override
     public void onInitializeClient() {
-        Config.register();
+        config = Config.builder(UglyScoreboardFix.MOD_ID)
+                .add(new Settings())
+                .build();
     }
 
 }

+ 8 - 3
src/main/java/me/lortseam/uglyscoreboardfix/config/ModMenuIntegration.java

@@ -1,13 +1,18 @@
 package me.lortseam.uglyscoreboardfix.config;
 
-import io.github.prospector.modmenu.api.ConfigScreenFactory;
-import io.github.prospector.modmenu.api.ModMenuApi;
+import com.terraformersmc.modmenu.api.ConfigScreenFactory;
+import com.terraformersmc.modmenu.api.ModMenuApi;
+import me.lortseam.completeconfig.gui.ConfigScreenBuilder;
+import me.lortseam.completeconfig.gui.cloth.ClothConfigScreenBuilder;
+import me.lortseam.uglyscoreboardfix.UglyScoreboardFix;
 
 public class ModMenuIntegration implements ModMenuApi {
 
+    private final ConfigScreenBuilder screenBuilder = new ClothConfigScreenBuilder();
+
     @Override
     public ConfigScreenFactory<?> getModConfigScreenFactory() {
-        return parent -> Config.getHandler().buildScreen(parent);
+        return parent -> screenBuilder.build(parent, UglyScoreboardFix.getConfig());
     }
 
 }

+ 2 - 15
src/main/java/me/lortseam/uglyscoreboardfix/config/Config.java → src/main/java/me/lortseam/uglyscoreboardfix/config/Settings.java

@@ -3,30 +3,17 @@ package me.lortseam.uglyscoreboardfix.config;
 import lombok.AccessLevel;
 import lombok.Getter;
 import lombok.NoArgsConstructor;
-import me.lortseam.completeconfig.ConfigHandler;
+import me.lortseam.completeconfig.api.ConfigContainer;
 import me.lortseam.completeconfig.api.ConfigEntry;
-import me.lortseam.completeconfig.api.ConfigEntryContainer;
 import me.lortseam.completeconfig.api.ConfigGroup;
 import me.lortseam.uglyscoreboardfix.HidePart;
 import me.lortseam.uglyscoreboardfix.SidebarPosition;
-import me.lortseam.uglyscoreboardfix.UglyScoreboardFix;
 import net.minecraft.scoreboard.ScoreboardObjective;
 import net.minecraft.scoreboard.ScoreboardPlayerScore;
 import net.minecraft.text.TextColor;
 import net.minecraft.util.Formatting;
 
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class Config implements ConfigEntryContainer {
-
-    @Getter(AccessLevel.PACKAGE)
-    @ConfigEntry.Ignore
-    private static ConfigHandler handler;
-
-    public static void register() {
-        handler = me.lortseam.completeconfig.data.Config.builder(UglyScoreboardFix.MOD_ID)
-                .add(new Config())
-                .build();
-    }
+public final class Settings implements ConfigContainer {
 
     @Override
     public boolean isConfigPOJO() {

+ 12 - 12
src/main/java/me/lortseam/uglyscoreboardfix/mixin/InGameHudMixin.java

@@ -1,6 +1,6 @@
 package me.lortseam.uglyscoreboardfix.mixin;
 
-import me.lortseam.uglyscoreboardfix.config.Config;
+import me.lortseam.uglyscoreboardfix.config.Settings;
 import me.lortseam.uglyscoreboardfix.HidePart;
 import me.lortseam.uglyscoreboardfix.SidebarPosition;
 import net.minecraft.client.font.TextRenderer;
@@ -21,29 +21,29 @@ public abstract class InGameHudMixin {
 
     @Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
     private void uglyscoreboardfix$hide(MatrixStack matrices, ScoreboardObjective objective, CallbackInfo ci) {
-        if (Config.Sidebar.Hiding.shouldHide(HidePart.SIDEBAR, objective)) {
+        if (Settings.Sidebar.Hiding.shouldHide(HidePart.SIDEBAR, objective)) {
             ci.cancel();
         }
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At("STORE"))
     private String uglyscoreboardfix$modifyScore(String score, MatrixStack matrices, ScoreboardObjective objective) {
-        return Config.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? "" : score;
+        return Settings.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? "" : score;
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At("STORE"), ordinal = 2)
     private int uglyscoreboardfix$modifySeperatorWidth(int seperatorWidth, MatrixStack matrices, ScoreboardObjective objective) {
-        return Config.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? 0 : seperatorWidth;
+        return Settings.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? 0 : seperatorWidth;
     }
 
     @Redirect(method = "renderScoreboardSidebar", slice = @Slice(from = @At(value = "INVOKE", target = "Ljava/util/Iterator;hasNext()Z")), at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;getWidth(Ljava/lang/String;)I", ordinal = 0))
     private int uglyscoreboardfix$modifyScoreWidth(TextRenderer textRenderer, String score, MatrixStack matrices, ScoreboardObjective objective) {
-        return Config.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? 0 : textRenderer.getWidth(score);
+        return Settings.Sidebar.Hiding.shouldHide(HidePart.SCORES, objective) ? 0 : textRenderer.getWidth(score);
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 5)
     private int uglyscoreboardfix$modifyX1(int x1) {
-        if (Config.Sidebar.getPosition() == SidebarPosition.LEFT) {
+        if (Settings.Sidebar.getPosition() == SidebarPosition.LEFT) {
             xShift = x1;
             return 2;
         }
@@ -52,7 +52,7 @@ public abstract class InGameHudMixin {
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 11)
     private int uglyscoreboardfix$modifyX2(int x2) {
-        if (Config.Sidebar.getPosition() == SidebarPosition.LEFT) {
+        if (Settings.Sidebar.getPosition() == SidebarPosition.LEFT) {
             return x2 - xShift;
         }
         return x2;
@@ -60,27 +60,27 @@ public abstract class InGameHudMixin {
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 8)
     private int uglyscoreboardfix$modifyHeadingBackgroundColor(int color) {
-        return Config.Sidebar.Background.getHeadingColor();
+        return Settings.Sidebar.Background.getHeadingColor();
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 7)
     private int uglyscoreboardfix$modifyBackgroundColor(int color) {
-        return Config.Sidebar.Background.getColor();
+        return Settings.Sidebar.Background.getColor();
     }
 
     @ModifyArg(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Text;FFI)I", ordinal = 1), index = 4)
     private int uglyscoreboardfix$modifyHeadingColor(int color) {
-        return Config.Sidebar.Text.getHeadingColor().getRgb();
+        return Settings.Sidebar.Text.getHeadingColor().getRgb();
     }
 
     @ModifyArg(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/text/Text;FFI)I", ordinal = 0), index = 4)
     private int uglyscoreboardfix$modifyTextColor(int color) {
-        return Config.Sidebar.Text.getColor().getRgb();
+        return Settings.Sidebar.Text.getColor().getRgb();
     }
 
     @Redirect(method = "renderScoreboardSidebar", at = @At(value = "INVOKE", target = "Lnet/minecraft/client/font/TextRenderer;draw(Lnet/minecraft/client/util/math/MatrixStack;Ljava/lang/String;FFI)I", ordinal = 0))
     private int uglyscoreboardfix$modifyScoreColor(TextRenderer textRenderer, MatrixStack matrices, String text, float x, float y, int color) {
-        return textRenderer.draw(matrices, Formatting.strip(text), x, y, Config.Sidebar.Text.getScoreColor().getRgb());
+        return textRenderer.draw(matrices, Formatting.strip(text), x, y, Settings.Sidebar.Text.getScoreColor().getRgb());
     }
 
 }