Lortseam преди 4 години
родител
ревизия
79dc69095d

+ 21 - 9
src/main/java/me/lortseam/uglyscoreboardfix/config/Config.java

@@ -17,34 +17,46 @@ public final class Config {
 
     @Getter(AccessLevel.PACKAGE)
     private static ConfigHandler handler;
-    public static final Sidebar SIDEBAR = new Sidebar();
+    public static final Sidebar sidebar = new Sidebar();
 
     public static void register() {
         handler = me.lortseam.completeconfig.data.Config.builder(UglyScoreboardFix.MOD_ID)
-                .add(SIDEBAR)
+                .add(sidebar)
                 .build();
     }
 
     @NoArgsConstructor(access = AccessLevel.PRIVATE)
     public static final class Sidebar implements ConfigGroup {
 
-        public final Hiding HIDING = new Hiding();
+        public final Background background = new Background();
+        public final Hiding hiding = new Hiding();
 
         @Getter
         @ConfigEntry(comment = "RIGHT (default) or LEFT")
         private SidebarPosition position = SidebarPosition.RIGHT;
-        @Getter
-        @ConfigEntry.Color(alphaMode = true)
-        private int headingColor = 1711276032;
-        @Getter
-        @ConfigEntry.Color(alphaMode = true)
-        private int color = 1275068416;
 
         @Override
         public boolean isConfigPOJO() {
             return true;
         }
 
+        @NoArgsConstructor(access = AccessLevel.PRIVATE)
+        public static final class Background implements ConfigGroup {
+
+            @Getter
+            @ConfigEntry.Color(alphaMode = true)
+            private int headingColor = 1711276032;
+            @Getter
+            @ConfigEntry.Color(alphaMode = true)
+            private int color = 1275068416;
+
+            @Override
+            public boolean isConfigPOJO() {
+                return true;
+            }
+
+        }
+
         @NoArgsConstructor(access = AccessLevel.PRIVATE)
         public static final class Hiding implements ConfigGroup {
 

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

@@ -20,29 +20,29 @@ public abstract class InGameHudMixin {
 
     @Inject(method = "renderScoreboardSidebar", at = @At("HEAD"), cancellable = true)
     private void uglyscoreboardfix$modifySidebar(MatrixStack matrices, ScoreboardObjective objective, CallbackInfo ci) {
-        if (Config.SIDEBAR.HIDING.shouldHide(HidePart.SIDEBAR, objective)) {
+        if (Config.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 Config.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 Config.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 Config.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 (Config.sidebar.getPosition() == SidebarPosition.LEFT) {
             xShift = x1;
             return 2;
         }
@@ -51,20 +51,20 @@ 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 (Config.sidebar.getPosition() == SidebarPosition.LEFT) {
             return x2 - xShift;
         }
         return x2;
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 8)
-    private int uglyscoreboardfix$modifyHeadingColor(int color) {
-        return Config.SIDEBAR.getHeadingColor();
+    private int uglyscoreboardfix$modifyBackgroundHeadingColor(int color) {
+        return Config.sidebar.background.getHeadingColor();
     }
 
     @ModifyVariable(method = "renderScoreboardSidebar", at = @At(value = "STORE", ordinal = 0), ordinal = 7)
-    private int uglyscoreboardfix$modifyColor(int color) {
-        return Config.SIDEBAR.getColor();
+    private int uglyscoreboardfix$modifyBackgroundColor(int color) {
+        return Config.sidebar.background.getColor();
     }
 
 }

+ 3 - 2
src/main/resources/assets/uglyscoreboardfix/lang/de_de.json

@@ -16,6 +16,7 @@
   "config.uglyscoreboardfix.sidebar.position": "Position der Sidebar",
   "config.uglyscoreboardfix.sidebar.position.right": "Rechts",
   "config.uglyscoreboardfix.sidebar.position.left": "Links",
-  "config.uglyscoreboardfix.sidebar.headingColor": "Farbe der Überschrift",
-  "config.uglyscoreboardfix.sidebar.color": "Farbe"
+  "config.uglyscoreboardfix.sidebar.background": "Hintegrund",
+  "config.uglyscoreboardfix.sidebar.background.headingColor": "Farbe der Überschrift",
+  "config.uglyscoreboardfix.sidebar.background.color": "Farbe"
 }

+ 3 - 2
src/main/resources/assets/uglyscoreboardfix/lang/en_us.json

@@ -16,6 +16,7 @@
   "config.uglyscoreboardfix.sidebar.position": "Sidebar position",
   "config.uglyscoreboardfix.sidebar.position.right": "Right",
   "config.uglyscoreboardfix.sidebar.position.left": "Left",
-  "config.uglyscoreboardfix.sidebar.headingColor": "Heading color",
-  "config.uglyscoreboardfix.sidebar.color": "Color"
+  "config.uglyscoreboardfix.sidebar.background": "Background",
+  "config.uglyscoreboardfix.sidebar.background.headingColor": "Heading color",
+  "config.uglyscoreboardfix.sidebar.background.color": "Color"
 }