From 2a6f0a8173018970ef35bcf8c2cea8f091f79056 Mon Sep 17 00:00:00 2001
From: DeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>
Date: Sat, 7 May 2022 14:27:19 +0200
Subject: some small changes

---
 .../java/cc/polyfrost/oneconfig/OneConfig.java     |   3 +-
 .../oneconfig/config/OneConfigConfig.java          |   2 +-
 .../java/cc/polyfrost/oneconfig/gui/HudGui.java    |   2 +-
 .../cc/polyfrost/oneconfig/gui/pages/ModsPage.java |   2 +-
 .../java/cc/polyfrost/oneconfig/hud/BasicHud.java  | 111 +++++++++++++++++++++
 .../java/cc/polyfrost/oneconfig/hud/HudCore.java   |   1 -
 .../oneconfig/hud/interfaces/BasicHud.java         | 111 ---------------------
 .../oneconfig/hud/interfaces/TextHud.java          |  94 -----------------
 .../java/cc/polyfrost/oneconfig/test/TestHud.java  |   2 +-
 9 files changed, 116 insertions(+), 212 deletions(-)
 create mode 100644 src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
 delete mode 100644 src/main/java/cc/polyfrost/oneconfig/hud/interfaces/BasicHud.java
 delete mode 100644 src/main/java/cc/polyfrost/oneconfig/hud/interfaces/TextHud.java

(limited to 'src')

diff --git a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
index eced81e..62bff81 100644
--- a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
@@ -72,9 +72,8 @@ public class OneConfig {
             loadedOtherMods.add(metadata);
             String author = metadata.authorList.size() > 0 ? metadata.authorList.get(0) : "";
             Mod newMod = new Mod(metadata.name, ModType.OTHER, author, metadata.version);
-            if (newMod.name.equals("Minecraft Coder Pack") || newMod.name.equals("Forge Mod Loader") || newMod.name.equals("Minecraft Forge")) {     // TODO add oneconfig
+            if (newMod.name.equals("Minecraft Coder Pack") || newMod.name.equals("Forge Mod Loader") || newMod.name.equals("Minecraft Forge") || newMod.name.equals("OneConfig"))
                 continue;
-            }
             if (modData.add(newMod)) loadedMods.add(newMod);     // anti duplicate fix
         }
     }
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
index 0fe06ab..efa9e9f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/OneConfigConfig.java
@@ -14,7 +14,6 @@ public class OneConfigConfig extends Config {
 
     public static String currentProfile = "Default Profile";
 
-    // TODO i dont know how this works so this is just gonna be here for now
     public static final int TRANSPARENT = new Color(0, 0, 0, 0).getRGB();                // Transparent      // button sidebar normal
 
     public static final int BLACK = new Color(0,0,0,255).getRGB();                     // Black
@@ -51,6 +50,7 @@ public class OneConfigConfig extends Config {
     public static float CORNER_RADIUS_WIN = 20f;
     public static float CORNER_RADIUS = 12f;
 
+    public static boolean thirdPartyAll = false;
 
     public OneConfigConfig() {
         super(null, "OneConfig.json");
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index c3437fa..a67c1d1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -1,7 +1,7 @@
 package cc.polyfrost.oneconfig.gui;
 
 import cc.polyfrost.oneconfig.hud.HudCore;
-import cc.polyfrost.oneconfig.hud.interfaces.BasicHud;
+import cc.polyfrost.oneconfig.hud.BasicHud;
 import cc.polyfrost.oneconfig.lwjgl.RenderManager;
 import net.minecraft.client.gui.Gui;
 import net.minecraft.client.gui.GuiScreen;
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
index fc20d35..f9b930b 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -48,7 +48,7 @@ public class ModsPage extends Page {
         int iX = x + 16;
         int iY = y + 72;
         for (ModCard modCard : modCards) {
-            if (modCategories.get(0).isToggled() || (modCategories.get(1).isToggled() && modCard.getModData().modType == ModType.PVP) || (modCategories.get(2).isToggled() && modCard.getModData().modType == ModType.HUD) || (modCategories.get(3).isToggled() && modCard.getModData().modType == ModType.UTIL_QOL) || (modCategories.get(4).isToggled() && modCard.getModData().modType == ModType.HYPIXEL) || (modCategories.get(5).isToggled() && modCard.getModData().modType == ModType.SKYBLOCK) || (modCategories.get(6).isToggled() && modCard.getModData().modType == ModType.OTHER)) {
+            if (modCategories.get(0).isToggled() && (OneConfigConfig.thirdPartyAll || modCard.getModData().modType != ModType.OTHER) || (modCategories.get(1).isToggled() && modCard.getModData().modType == ModType.PVP) || (modCategories.get(2).isToggled() && modCard.getModData().modType == ModType.HUD) || (modCategories.get(3).isToggled() && modCard.getModData().modType == ModType.UTIL_QOL) || (modCategories.get(4).isToggled() && modCard.getModData().modType == ModType.HYPIXEL) || (modCategories.get(5).isToggled() && modCard.getModData().modType == ModType.SKYBLOCK) || (modCategories.get(6).isToggled() && modCard.getModData().modType == ModType.OTHER)) {
                 modCard.draw(vg, iX, iY);
                 iX += 260;
                 if (iX > x + 796) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
new file mode 100644
index 0000000..12bc162
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/BasicHud.java
@@ -0,0 +1,111 @@
+package cc.polyfrost.oneconfig.hud;
+
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+
+import java.awt.*;
+
+public abstract class BasicHud {
+    public double xUnscaled = 0;
+    public double yUnscaled = 0;
+    public float scale = 1;
+    public int paddingX = 5;
+    public int paddingY = 5;
+    public boolean background = true;
+    public boolean rounded = false;
+    public BasicHud parent;
+    public BasicHud childRight;
+    public BasicHud childBottom;
+
+    public abstract int getWidth(float scale);
+
+    public abstract int getHeight(float scale);
+
+    public abstract void draw(int x, int y, float scale);
+
+    public int getExampleWidth(float scale) {
+        return getWidth(scale);
+    }
+
+    public int getExampleHeight(float scale) {
+        return getHeight(scale);
+    }
+
+    public void drawAll(float x, float y, float scale, boolean background) {
+        if (background) drawBackground(x, y, getTotalWidth(scale), getTotalHeight(scale), scale);
+        draw((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
+        if (childRight != null)
+            childRight.drawAll((int) x + paddingX * scale / 2f + getWidth(scale), (int) y, childRight.scale, false);
+        if (childBottom != null)
+            childBottom.drawAll((int) x, (int) y + paddingY * scale / 2f + getHeight(scale), childBottom.scale, false);
+    }
+
+    public void drawExampleAll(float x, float y, float scale, boolean background) {
+        if (background) drawBackground(x, y, getTotalExampleWidth(scale), getTotalExampleHeight(scale), scale);
+        drawExample((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
+        if (childRight != null)
+            childRight.drawExampleAll((int) x + paddingX * scale / 2f + getWidth(scale), (int) y, childRight.scale, false);
+        if (childBottom != null)
+            childBottom.drawExampleAll((int) x, (int) y + paddingY * scale / 2f + getHeight(scale), childBottom.scale, false);
+    }
+
+    public void drawExample(int x, int y, float scale) {
+        draw(x, y, scale);
+    }
+
+    private void drawBackground(float x, float y, float width, float height, float scale) {
+        RenderManager.setupAndDraw(true, (vg) -> RenderManager.drawRoundedRect(vg, x, y, (width + paddingX * scale),
+                (height + paddingY * scale), new Color(0, 0, 0, 120).getRGB(), 2 * scale));
+    }
+
+    public float getXScaled(int screenWidth) {
+        if (parent != null && parent.childRight == this) {
+            return parent.getXScaled(screenWidth) + parent.getWidth(parent.scale) + parent.paddingX * parent.scale / 2f;
+        } else if (parent != null) {
+            return parent.getXScaled(screenWidth);
+        }
+        if (xUnscaled <= 0.5) {
+            return (int) (screenWidth * xUnscaled);
+        }
+        return (float) (screenWidth - (1d - xUnscaled) * screenWidth - (getWidth(scale) + paddingX * scale));
+    }
+
+    public float getYScaled(int screenHeight) {
+        if (parent != null && parent.childBottom == this) {
+            return parent.getYScaled(screenHeight) + parent.getHeight(parent.scale) + parent.paddingY * parent.scale / 2f;
+        } else if (parent != null) {
+            return parent.getYScaled(screenHeight);
+        }
+        if (yUnscaled <= 0.5) {
+            return (int) (screenHeight * yUnscaled);
+        }
+        return (float) (screenHeight - (1d - yUnscaled) * screenHeight - (getHeight(scale) + paddingY * scale));
+    }
+
+    public float getTotalWidth(float scale) {
+        float width = getWidth(scale);
+        if (childRight != null) width += childRight.getTotalWidth(childRight.scale) + paddingY * scale / 2f;
+        if (childBottom != null) width = Math.max(childBottom.getTotalWidth(childBottom.scale), width);
+        return width;
+    }
+
+    public float getTotalHeight(float scale) {
+        float height = getHeight(scale);
+        if (childBottom != null) height += childBottom.getTotalHeight(childBottom.scale) + paddingY * scale / 2f;
+        if (childRight != null) height = Math.max(childRight.getTotalHeight(childRight.scale), height);
+        return height;
+    }
+
+    public float getTotalExampleWidth(float scale) {
+        float width = getExampleWidth(scale);
+        if (childRight != null) width += childRight.getTotalExampleWidth(childRight.scale) + paddingX * scale / 2f;
+        if (childBottom != null) width = Math.max(childBottom.getTotalExampleWidth(childBottom.scale), width);
+        return width;
+    }
+
+    public float getTotalExampleHeight(float scale) {
+        float height = getExampleHeight(scale);
+        if (childBottom != null) height += childBottom.getTotalExampleHeight(childBottom.scale) + paddingY * scale / 2f;
+        if (childRight != null) height = Math.max(childRight.getTotalExampleHeight(childRight.scale), height);
+        return height;
+    }
+}
\ No newline at end of file
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
index 072ba70..60ade17 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
@@ -1,6 +1,5 @@
 package cc.polyfrost.oneconfig.hud;
 
-import cc.polyfrost.oneconfig.hud.interfaces.BasicHud;
 import net.minecraft.client.Minecraft;
 import net.minecraft.client.gui.ScaledResolution;
 import net.minecraftforge.client.event.RenderGameOverlayEvent;
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/BasicHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/BasicHud.java
deleted file mode 100644
index e87b33d..0000000
--- a/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/BasicHud.java
+++ /dev/null
@@ -1,111 +0,0 @@
-package cc.polyfrost.oneconfig.hud.interfaces;
-
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-
-import java.awt.*;
-
-public abstract class BasicHud {
-    public double xUnscaled = 0;
-    public double yUnscaled = 0;
-    public float scale = 1;
-    public int paddingX = 5;
-    public int paddingY = 5;
-    public boolean background = true;
-    public boolean rounded = false;
-    public BasicHud parent;
-    public BasicHud childRight;
-    public BasicHud childBottom;
-
-    public abstract int getWidth(float scale);
-
-    public abstract int getHeight(float scale);
-
-    public abstract void draw(int x, int y, float scale);
-
-    public int getExampleWidth(float scale) {
-        return getWidth(scale);
-    }
-
-    public int getExampleHeight(float scale) {
-        return getHeight(scale);
-    }
-
-    public void drawAll(float x, float y, float scale, boolean background) {
-        if (background) drawBackground(x, y, getTotalWidth(scale), getTotalHeight(scale), scale);
-        draw((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
-        if (childRight != null)
-            childRight.drawAll((int) x + paddingX * scale / 2f + getWidth(scale), (int) y, childRight.scale, false);
-        if (childBottom != null)
-            childBottom.drawAll((int) x, (int) y + paddingY * scale / 2f + getHeight(scale), childBottom.scale, false);
-    }
-
-    public void drawExampleAll(float x, float y, float scale, boolean background) {
-        if (background) drawBackground(x, y, getTotalExampleWidth(scale), getTotalExampleHeight(scale), scale);
-        drawExample((int) (x + paddingX * scale / 2f), (int) (y + paddingY * scale / 2f), scale);
-        if (childRight != null)
-            childRight.drawExampleAll((int) x + paddingX * scale / 2f + getWidth(scale), (int) y, childRight.scale, false);
-        if (childBottom != null)
-            childBottom.drawExampleAll((int) x, (int) y + paddingY * scale / 2f + getHeight(scale), childBottom.scale, false);
-    }
-
-    public void drawExample(int x, int y, float scale) {
-        draw(x, y, scale);
-    }
-
-    private void drawBackground(float x, float y, float width, float height, float scale) {
-        RenderManager.setupAndDraw(true, (vg) -> RenderManager.drawRoundedRect(vg, x, y, (width + paddingX * scale),
-                (height + paddingY * scale), new Color(0, 0, 0, 120).getRGB(), 2 * scale));
-    }
-
-    public float getXScaled(int screenWidth) {
-        if (parent != null && parent.childRight == this) {
-            return parent.getXScaled(screenWidth) + parent.getWidth(parent.scale) + parent.paddingX * parent.scale / 2f;
-        } else if (parent != null) {
-            return parent.getXScaled(screenWidth);
-        }
-        if (xUnscaled <= 0.5) {
-            return (int) (screenWidth * xUnscaled);
-        }
-        return (float) (screenWidth - (1d - xUnscaled) * screenWidth - (getWidth(scale) + paddingX * scale));
-    }
-
-    public float getYScaled(int screenHeight) {
-        if (parent != null && parent.childBottom == this) {
-            return parent.getYScaled(screenHeight) + parent.getHeight(parent.scale) + parent.paddingY * parent.scale / 2f;
-        } else if (parent != null) {
-            return parent.getYScaled(screenHeight);
-        }
-        if (yUnscaled <= 0.5) {
-            return (int) (screenHeight * yUnscaled);
-        }
-        return (float) (screenHeight - (1d - yUnscaled) * screenHeight - (getHeight(scale) + paddingY * scale));
-    }
-
-    public float getTotalWidth(float scale) {
-        float width = getWidth(scale);
-        if (childRight != null) width += childRight.getTotalWidth(childRight.scale) + paddingY * scale / 2f;
-        if (childBottom != null) width = Math.max(childBottom.getTotalWidth(childBottom.scale), width);
-        return width;
-    }
-
-    public float getTotalHeight(float scale) {
-        float height = getHeight(scale);
-        if (childBottom != null) height += childBottom.getTotalHeight(childBottom.scale) + paddingY * scale / 2f;
-        if (childRight != null) height = Math.max(childRight.getTotalHeight(childRight.scale), height);
-        return height;
-    }
-
-    public float getTotalExampleWidth(float scale) {
-        float width = getExampleWidth(scale);
-        if (childRight != null) width += childRight.getTotalExampleWidth(childRight.scale) + paddingX * scale / 2f;
-        if (childBottom != null) width = Math.max(childBottom.getTotalExampleWidth(childBottom.scale), width);
-        return width;
-    }
-
-    public float getTotalExampleHeight(float scale) {
-        float height = getExampleHeight(scale);
-        if (childBottom != null) height += childBottom.getTotalExampleHeight(childBottom.scale) + paddingY * scale / 2f;
-        if (childRight != null) height = Math.max(childRight.getTotalExampleHeight(childRight.scale), height);
-        return height;
-    }
-}
\ No newline at end of file
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/TextHud.java b/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/TextHud.java
deleted file mode 100644
index 0027786..0000000
--- a/src/main/java/cc/polyfrost/oneconfig/hud/interfaces/TextHud.java
+++ /dev/null
@@ -1,94 +0,0 @@
-package cc.polyfrost.oneconfig.hud.interfaces;
-
-import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.FontRenderer;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.TickEvent;
-
-import java.util.List;
-
-public class TextHud extends BasicHud {
-    /**
-     * Currently doesn't work because of double extend, will have to be redone somehow (I have no idea how yet)
-     */
-    private final FontRenderer fb = Minecraft.getMinecraft().fontRendererObj;
-    boolean shadow = false;
-    boolean doExample = false;
-    private List<String> cachedLines;
-    private int cachedWidth;
-    private int cachedHeight;
-    private List<String> cachedExampleLines;
-    private int cachedExampleWidth;
-    private int cachedExampleHeight;
-
-    protected List<String> update() {
-        return null;
-    }
-
-    @SubscribeEvent
-    private void onTick(TickEvent.ClientTickEvent event) {
-        if (event.phase != TickEvent.Phase.START) return;
-        cachedLines = update();
-        if (cachedLines != null) {
-            cachedHeight = cachedLines.size() * (fb.FONT_HEIGHT + 3);
-            cachedWidth = 0;
-            for (String line : cachedLines) {
-                int width = fb.getStringWidth(line);
-                if (width > cachedWidth) cachedWidth = width;
-            }
-        }
-        if (doExample) {
-            cachedExampleLines = updateExample();
-            if (cachedExampleLines != null) {
-                cachedExampleHeight = cachedExampleLines.size() * 12;
-                cachedExampleWidth = 0;
-                for (String line : cachedExampleLines) {
-                    int width = fb.getStringWidth(line);
-                    if (width > cachedExampleWidth) cachedExampleWidth = width;
-                }
-            }
-        }
-    }
-
-    protected List<String> updateExample() {
-        return update();
-    }
-
-    @Override
-    public void draw(int x, int y, float scale) {
-        if (cachedLines != null) drawText(cachedLines, x, y, scale);
-    }
-
-    @Override
-    public void drawExample(int x, int y, float scale) {
-        doExample = true;
-        if (cachedExampleLines != null) drawText(cachedExampleLines, x, y, scale);
-    }
-
-    private void drawText(List<String> lines, int x, int y, float scale) {
-        for (int i = 0; i < lines.size(); i++) {
-            RenderManager.drawScaledString(lines.get(i), x, y + i * 12, 0xffffff, shadow, scale);
-        }
-    }
-
-    @Override
-    public int getWidth(float scale) {
-        return (int) (cachedWidth * scale);
-    }
-
-    @Override
-    public int getHeight(float scale) {
-        return (int) (cachedHeight * scale);
-    }
-
-    @Override
-    public int getExampleWidth(float scale) {
-        return (int) (cachedExampleWidth * scale);
-    }
-
-    @Override
-    public int getExampleHeight(float scale) {
-        return (int) (cachedExampleHeight * scale);
-    }
-}
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
index ccb7c6b..e225987 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
@@ -1,6 +1,6 @@
 package cc.polyfrost.oneconfig.test;
 
-import cc.polyfrost.oneconfig.hud.interfaces.BasicHud;
+import cc.polyfrost.oneconfig.hud.BasicHud;
 import cc.polyfrost.oneconfig.lwjgl.RenderManager;
 import net.minecraft.client.Minecraft;
 
-- 
cgit