aboutsummaryrefslogtreecommitdiff
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'src/main')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java60
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java17
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java19
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java37
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java16
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/assets/Colors.java5
9 files changed, 120 insertions, 47 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
index 9ed1cd9..5a06637 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneColor.java
@@ -16,26 +16,38 @@ import java.awt.*;
*/
@SuppressWarnings("unused")
public final class OneColor {
- transient private Integer rgba = null;
+ transient private Integer argb = null;
private short[] hsba;
private int dataBit = -1;
+ // hex constructor
+
+ /** Create a OneColor from the given hex.
+ */
+ public OneColor(String hex) {
+ hsba = new short[]{0, 0, 0, 0};
+ if(hex.length() > 7) {
+ hsba[3] = (short) Integer.parseInt(hex.substring(6, 8), 16);
+ }
+ setColorFromHex(hex);
+ }
+
// rgb constructors
/**
* Create a new OneColor, converting the RGBA color to HSBA.
*/
- public OneColor(int rgba) {
- this.rgba = rgba;
- this.hsba = RGBAtoHSBA(this.rgba);
+ public OneColor(int argb) {
+ this.argb = argb;
+ this.hsba = ARGBtoHSBA(this.argb);
}
/**
* Create a new OneColor from the given RGBA values.
*/
public OneColor(int r, int g, int b, int a) {
- this.rgba = ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF));
- this.hsba = RGBAtoHSBA(this.rgba);
+ this.argb = ((a & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF));
+ this.hsba = ARGBtoHSBA(this.argb);
}
/**
@@ -59,7 +71,7 @@ public final class OneColor {
*/
public OneColor(float hue, float saturation, float brightness, float alpha) {
this.hsba = new short[]{(short) hue, (short) saturation, (short) brightness, (short) alpha};
- this.rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ this.argb = HSBAtoARGB(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
}
@@ -86,7 +98,7 @@ public final class OneColor {
public OneColor(int hue, int saturation, int brightness, int alpha, int chromaSpeed) {
if (chromaSpeed == -1) {
this.hsba = new short[]{(short) hue, (short) saturation, (short) brightness, (short) alpha};
- this.rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ this.argb = HSBAtoARGB(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
} else {
this.dataBit = chromaSpeed;
this.hsba = new short[]{(short) hue, (short) saturation, (short) brightness, (short) alpha};
@@ -99,7 +111,7 @@ public final class OneColor {
/**
* Get the RGBA color from the HSB color, and apply the alpha.
*/
- public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) {
+ public static int HSBAtoARGB(float hue, float saturation, float brightness, int alpha) {
int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f);
return ((temp & 0x00ffffff) | (alpha << 24));
}
@@ -107,7 +119,7 @@ public final class OneColor {
/**
* Get the HSBA color from the RGBA color.
*/
- public static short[] RGBAtoHSBA(int rgba) {
+ public static short[] ARGBtoHSBA(int rgba) {
short[] hsb = new short[4];
float[] hsbArray = Color.RGBtoHSB((rgba >> 16 & 255), (rgba >> 8 & 255), (rgba & 255), null);
hsb[0] = (short) (hsbArray[0] * 360);
@@ -121,21 +133,21 @@ public final class OneColor {
* Get the red value of the color (0-255).
*/
public int getRed() {
- return rgba >> 16 & 255;
+ return argb >> 16 & 255;
}
/**
* Get the green value of the color (0-255).
*/
public int getGreen() {
- return rgba >> 8 & 255;
+ return argb >> 8 & 255;
}
/**
* Get the blue value of the color (0-255).
*/
public int getBlue() {
- return rgba & 255;
+ return argb & 255;
}
/**
@@ -168,7 +180,7 @@ public final class OneColor {
public void setAlpha(int alpha) {
this.hsba[3] = (short) alpha;
- rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ argb = HSBAtoARGB(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
}
/**
@@ -199,7 +211,7 @@ public final class OneColor {
this.hsba[1] = (short) saturation;
this.hsba[2] = (short) brightness;
this.hsba[3] = (short) alpha;
- this.rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ this.argb = HSBAtoARGB(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
}
public void setFromOneColor(OneColor color) {
@@ -217,8 +229,8 @@ public final class OneColor {
if (dataBit == 0) dataBit = -1;
if (dataBit == -1) {
// fix for when rgba is not set because of deserializing not calling constructor
- if (rgba == null) rgba = HSBAtoRGBA(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
- return rgba;
+ if (argb == null) argb = HSBAtoARGB(this.hsba[0], this.hsba[1], this.hsba[2], this.hsba[3]);
+ return argb;
} else {
int temp = Color.HSBtoRGB(System.currentTimeMillis() % dataBit / (float) dataBit, hsba[1] / 100f, hsba[2] / 100f);
hsba[0] = (short) ((System.currentTimeMillis() % dataBit / (float) dataBit) * 360);
@@ -239,7 +251,7 @@ public final class OneColor {
public int getRGBMax(boolean maxBrightness) {
if (dataBit == 0) dataBit = -1;
if (dataBit == -1) {
- return HSBAtoRGBA(this.hsba[0], 100, maxBrightness ? 100 : 0, this.hsba[3]);
+ return HSBAtoARGB(this.hsba[0], 100, maxBrightness ? 100 : 0, this.hsba[3]);
} else {
int temp = Color.HSBtoRGB(System.currentTimeMillis() % dataBit / (float) dataBit, 1, maxBrightness ? 1 : 0);
hsba[0] = (short) ((System.currentTimeMillis() % dataBit / (float) dataBit) * 360);
@@ -253,6 +265,9 @@ public final class OneColor {
public void setColorFromHex(String hex) {
hex = hex.replace("#", "");
+ if(hex.length() == 8) {
+ hsba[3] = (short) (Integer.parseInt(hex.substring(6, 8), 16));
+ }
if (hex.length() > 6) {
hex = hex.substring(0, 6);
}
@@ -270,12 +285,11 @@ public final class OneColor {
hexBuilder.append("0");
}
hex = hexBuilder.toString();
- //System.out.println(hex);
int r = Integer.valueOf(hex.substring(0, 2), 16);
int g = Integer.valueOf(hex.substring(2, 4), 16);
int b = Integer.valueOf(hex.substring(4, 6), 16);
- this.rgba = ((getAlpha() & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF));
- hsba = RGBAtoHSBA(rgba);
+ this.argb = ((getAlpha() & 0xFF) << 24) | ((r & 0xFF) << 16) | ((g & 0xFF) << 8) | ((b & 0xFF));
+ hsba = ARGBtoHSBA(argb);
}
private String charsToString(char... chars) {
@@ -286,6 +300,10 @@ public final class OneColor {
return sb.toString();
}
+ public Color toJavaColor() {
+ return new Color(getRGB(), true);
+ }
+
@Override
public String toString() {
return "OneColor{rgba=[r=" + getRed() + ", g=" + getGreen() + ", b=" + getBlue() + ", a=" + getAlpha() + "], hsba=[h=" + getHue() + ", s=" + getSaturation() + ", b=" + getBrightness() + ", a=" + getAlpha() + "], hex=" + getHex() + "}";
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
index 07ce53e..5f6a946 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/profiles/Profiles.java
@@ -16,7 +16,7 @@ public class Profiles {
public static String getCurrentProfile() {
if (!profileDir.exists() && !profileDir.mkdir()) {
- System.out.println("Could not create profiles folder");
+ OneConfig.LOGGER.fatal("Could not create profiles folder");
return null;
}
if (profiles == null) {
@@ -32,7 +32,7 @@ public class Profiles {
public static void createProfile(String name) {
File folder = new File(profileDir, name);
if (!folder.exists() && !folder.mkdir()) {
- System.out.println("Could not create profile folder");
+ OneConfig.LOGGER.fatal("Could not create profile folder");
return;
}
profiles.add(name);
@@ -65,14 +65,14 @@ public class Profiles {
profiles.remove(name);
profiles.add(newName);
} catch (IOException e) {
- System.out.println("Failed to rename profile");
+ OneConfig.LOGGER.error("Failed to rename profile");
}
}
public static void deleteProfile(String name) {
if (name.equals(getCurrentProfile())) {
if (profiles.size() == 1) {
- System.out.println("Cannot delete only profile!");
+ OneConfig.LOGGER.error("Cannot delete only profile!");
return;
}
loadProfile(profiles.stream().filter(entry -> !entry.equals(name)).findFirst().get());
@@ -81,7 +81,7 @@ public class Profiles {
FileUtils.deleteDirectory(getProfileDir(name));
profiles.remove(name);
} catch (IOException e) {
- System.out.println("Failed to delete profile");
+ OneConfig.LOGGER.error("Failed to delete profile");
}
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 3172336..c3ecb0c 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -8,8 +8,10 @@ import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
import cc.polyfrost.oneconfig.gui.elements.text.TextInputField;
import cc.polyfrost.oneconfig.gui.pages.ModsPage;
import cc.polyfrost.oneconfig.gui.pages.Page;
+import cc.polyfrost.oneconfig.internal.OneConfig;
import cc.polyfrost.oneconfig.internal.assets.Colors;
import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.libs.universal.*;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
import cc.polyfrost.oneconfig.internal.assets.SVGs;
@@ -17,10 +19,6 @@ import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
-import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
-import cc.polyfrost.oneconfig.libs.universal.UMatrixStack;
-import cc.polyfrost.oneconfig.libs.universal.UResolution;
-import cc.polyfrost.oneconfig.libs.universal.UScreen;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Mouse;
@@ -69,8 +67,6 @@ public class OneConfigGui extends UScreen {
public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks);
long start = System.nanoTime();
- int x2 = 0;
- int y2 = 0;
RenderManager.setupAndDraw((vg) -> {
if (currentPage == null) {
currentPage = new ModsPage();
@@ -96,8 +92,8 @@ public class OneConfigGui extends UScreen {
RenderManager.drawLine(vg, x + 224, y, x + 222, y + 800, 1, Colors.GRAY_700);
RenderManager.drawSvg(vg, SVGs.ONECONFIG, x + 19, y + 19, 42, 42);
- RenderManager.drawText(vg, "OneConfig", x + 69, y + 32, Colors.WHITE, 18f, Fonts.BOLD); // added half line height to center text
- RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, Colors.WHITE, 12f, Fonts.REGULAR);
+ RenderManager.drawText(vg, "OneConfig", x + 69, y + 32, -1, 18f, Fonts.BOLD); // added half line height to center text
+ RenderManager.drawText(vg, "By Polyfrost", x + 69, y + 51, -1, 12f, Fonts.REGULAR);
textInputField.draw(vg, x + 1020, y + 16);
sideBar.draw(vg, x, y);
@@ -139,7 +135,7 @@ public class OneConfigGui extends UScreen {
}
}
- ScissorManager.scissor(vg, x + 224, y + 88, 1056, 698);
+ ScissorManager.scissor(vg, x + 224, y + 72, 1056, 728);
if (prevPage != null && animation != null) {
float pageProgress = animation.get(GuiUtils.getDeltaTime());
if (!animation.isReversed()) {
@@ -191,8 +187,7 @@ public class OneConfigGui extends UScreen {
if (currentColorSelector != null) currentColorSelector.keyTyped(typedChar, keyCode);
currentPage.keyTyped(typedChar, keyCode);
} catch (Exception e) {
- e.printStackTrace();
- System.out.println("this should literally never happen");
+ OneConfig.LOGGER.error("Error while processing keyboard input; ignoring!");
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
index 98b2377..0c62443 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/animations/ColorAnimation.java
@@ -3,6 +3,7 @@ package cc.polyfrost.oneconfig.gui.animations;
import cc.polyfrost.oneconfig.utils.color.ColorPalette;
public class ColorAnimation {
+ private int speed = 100;
private ColorPalette palette;
/**
* 0 = nothing
@@ -35,15 +36,25 @@ public class ColorAnimation {
int state = pressed ? 2 : hovered ? 1 : 0;
if (state != prevState) {
float[] newColors = pressed ? palette.getPressedColorf() : hovered ? palette.getHoveredColorf() : palette.getNormalColorf();
- redAnimation = new EaseInOutQuad(100, redAnimation.get(), newColors[0], false);
- greenAnimation = new EaseInOutQuad(100, greenAnimation.get(), newColors[1], false);
- blueAnimation = new EaseInOutQuad(100, blueAnimation.get(), newColors[2], false);
- alphaAnimation = new EaseInOutQuad(100, alphaAnimation.get(), newColors[3], false);
+ redAnimation = new EaseInOutQuad(speed, redAnimation.get(), newColors[0], false);
+ greenAnimation = new EaseInOutQuad(speed, greenAnimation.get(), newColors[1], false);
+ blueAnimation = new EaseInOutQuad(speed, blueAnimation.get(), newColors[2], false);
+ alphaAnimation = new EaseInOutQuad(speed, alphaAnimation.get(), newColors[3], false);
prevState = state;
}
return ((int) (alphaAnimation.get() * 255) << 24) | ((int) (redAnimation.get() * 255) << 16) | ((int) (greenAnimation.get() * 255) << 8) | ((int) (blueAnimation.get() * 255));
}
+ /** Set the speed in milliseconds for the animation. */
+ public void setSpeed(int speed) {
+ this.speed = speed;
+ }
+
+ /** Get the speed in milliseconds for the animation. */
+ public int getSpeed() {
+ return speed;
+ }
+
/**
* Return the current alpha of the color. This method is used to get the alpha of pressed buttons that have text/icons on them, so they also darken accordingly.
*/
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
index 0e6695f..b85d113 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigPageButton.java
@@ -29,7 +29,7 @@ public class ConfigPageButton extends BasicOption {
@Override
public void draw(long vg, int x, int y) {
int height = description.equals("") ? 64 : 96;
- boolean hovered = InputUtils.isAreaHovered(x - 2, y, 1024, height) && isEnabled();
+ boolean hovered = InputUtils.isAreaHovered(x - 16, y, 1024, height) && isEnabled();
boolean clicked = hovered && InputUtils.isClicked();
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
index a43b969..c33896a 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java
@@ -455,7 +455,6 @@ public class TextInputField extends BasicElement {
endLine = caretLine;
start = x + 12 + this.getTextWidth(vg, wrappedText.get(caretLine).substring(0, getLineCaret(prevCaret, startLine)));
end = this.getTextWidth(vg, wrappedText.get(caretLine).substring(getLineCaret(prevCaret, startLine), getLineCaret(caretPos, startLine)));
- System.out.println(wrappedText.get(caretLine).substring(getLineCaret(prevCaret, startLine), getLineCaret(caretPos, startLine)));
} else {
start = x + 12 + this.getTextWidth(vg, input.substring(0, prevCaret));
end = this.getTextWidth(vg, input.substring(prevCaret, caretPos));
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
index b1bc083..882289d 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
@@ -1,9 +1,14 @@
package cc.polyfrost.oneconfig.gui.pages;
import cc.polyfrost.oneconfig.gui.animations.Animation;
+import cc.polyfrost.oneconfig.gui.animations.ColorAnimation;
import cc.polyfrost.oneconfig.gui.animations.EaseOutQuad;
+import cc.polyfrost.oneconfig.internal.assets.Colors;
+import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.scissor.Scissor;
import cc.polyfrost.oneconfig.renderer.scissor.ScissorManager;
+import cc.polyfrost.oneconfig.utils.InputUtils;
+import cc.polyfrost.oneconfig.utils.color.ColorPalette;
import org.lwjgl.input.Mouse;
/**
@@ -12,9 +17,14 @@ import org.lwjgl.input.Mouse;
public abstract class Page {
protected final String title;
private Animation scrollAnimation;
+ private final ColorAnimation colorAnimation = new ColorAnimation(new ColorPalette(Colors.TRANSPARENT, Colors.GRAY_400_60, Colors.GRAY_400_60));
private float scrollTarget;
+ private long scrollTime;
+ private boolean mouseWasDown, dragging;
+ private float yStart;
- protected Page(String title) {
+ public Page(String title) {
+ colorAnimation.setSpeed(200);
this.title = title;
}
@@ -32,10 +42,11 @@ public abstract class Page {
public void finishUpAndClose() {
}
- public void scrollWithDraw(long vg, int x, int y) { // TODO scroll bar
+ public void scrollWithDraw(long vg, int x, int y) {
int maxScroll = getMaxScrollHeight();
int scissorOffset = drawStatic(vg, x, y);
float scroll = scrollAnimation == null ? scrollTarget : scrollAnimation.get();
+ final float scrollBarLength = (728f / maxScroll) * 728f;
Scissor scissor = ScissorManager.scissor(vg, x, y + scissorOffset, x + 1056, y + 728 - scissorOffset);
int dWheel = Mouse.getDWheel();
if (dWheel != 0) {
@@ -45,6 +56,7 @@ public abstract class Page {
else if (scrollTarget < -maxScroll + 728) scrollTarget = -maxScroll + 728;
scrollAnimation = new EaseOutQuad(150, scroll, scrollTarget, false);
+ scrollTime = System.currentTimeMillis();
} else if (scrollAnimation != null && scrollAnimation.isFinished()) scrollAnimation = null;
if (maxScroll <= 728) {
draw(vg, x, y);
@@ -52,8 +64,29 @@ public abstract class Page {
return;
}
draw(vg, x, (int) (y + scroll));
+ if (dragging && InputUtils.isClicked(true)) {
+ dragging = false;
+ }
ScissorManager.resetScissor(vg, scissor);
+ if(!(scrollBarLength > 727f)) {
+ final float scrollBarY = (scroll / maxScroll) * 720f;
+ final boolean isMouseDown = Mouse.isButtonDown(0);
+ final boolean scrollHover = InputUtils.isAreaHovered(x + 1042, (int) (y - scrollBarY), 12, (int) scrollBarLength) || (System.currentTimeMillis() - scrollTime < 1000);
+ final boolean hovered = scrollHover && Mouse.isButtonDown(0);
+ if (hovered && isMouseDown && !mouseWasDown) {
+ yStart = InputUtils.mouseY();
+ dragging = true;
+ }
+ mouseWasDown = isMouseDown;
+ if(dragging) {
+ scrollTarget = -(InputUtils.mouseY() - yStart) * maxScroll / 728f;
+ if (scrollTarget > 0f) scrollTarget = 0f;
+ else if (scrollTarget < -maxScroll + 728) scrollTarget = -maxScroll + 728;
+ scrollAnimation = new EaseOutQuad(150, scroll, scrollTarget, false);
+ }
+ RenderManager.drawRoundedRect(vg, x + 1044, y - scrollBarY, 8, scrollBarLength, colorAnimation.getColor(scrollHover, dragging), 4f);
+ }
}
public String getTitle() {
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
index b3c6823..5f3b669 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
@@ -15,6 +15,8 @@ import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
import net.minecraftforge.fml.common.ModMetadata;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.ArrayList;
@@ -29,9 +31,11 @@ public class OneConfig {
public static final File oneConfigDir = new File("./OneConfig");
public static final List<Mod> loadedMods = new ArrayList<>();
public static final List<ModMetadata> loadedOtherMods = new ArrayList<>();
+ public static final Logger LOGGER = LogManager.getLogger("@NAME@");
public static OneConfigConfig config;
private static boolean preLaunched = false;
private static boolean initialized = false;
+ private static boolean isObfuscated = true;
/**
* Called before mods are loaded.
@@ -39,6 +43,12 @@ public class OneConfig {
*/
public static void preLaunch() {
if (preLaunched) return;
+ try {
+ OneConfig.class.getResourceAsStream("net/minecraft/world/World");
+ LOGGER.warn("OneConfig is NOT obfuscated!");
+ isObfuscated = false;
+ } catch (Exception ignored) {
+ }
if (!net.minecraft.launchwrapper.Launch.blackboard.containsKey("oneconfig.initialized")) {
throw new RuntimeException("OneConfig has not been initialized! Please add the OneConfig tweaker or call OneConfigInit via an ITweaker or a FMLLoadingPlugin!");
}
@@ -77,4 +87,10 @@ public class OneConfig {
if (modData.add(newMod)) loadedMods.add(newMod);
}
}
+
+ /** Returns weather this is an obfuscated environment, using a check for obfuscated name of net.minecraft.world.World.class.
+ * @return true if this is an obfuscated environment, which is normal for Minecraft or false if not. */
+ public static boolean isObfuscated() {
+ return isObfuscated;
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/assets/Colors.java b/src/main/java/cc/polyfrost/oneconfig/internal/assets/Colors.java
index a8d1e72..49a4ca3 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/assets/Colors.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/assets/Colors.java
@@ -15,6 +15,7 @@ public class Colors {
public static final int GRAY_500 = new Color(49, 51, 56, 255).getRGB(); // Gray 500 // button sidebar hover, button gray normal
public static final int GRAY_500_80 = new Color(49, 51, 56, 204).getRGB(); // Gray 500 80% // button sidebar pressed
public static final int GRAY_400 = new Color(55, 59, 69, 255).getRGB(); // Gray 400
+ public static final int GRAY_400_60 = new Color(55, 59, 69, 153).getRGB(); // Gray 400 60%
public static final int GRAY_300 = new Color(73, 79, 92, 255).getRGB(); // Gray 300 // button gray hover
public static final int GRAY_400_80 = new Color(55, 59, 69, 204).getRGB(); // Gray 400 80% // button gray pressed
public static final int PRIMARY_800 = new Color(13, 51, 128, 255).getRGB(); // Blue 800
@@ -23,11 +24,11 @@ public class Colors {
public static final int PRIMARY_600 = new Color(20, 82, 204, 255).getRGB(); // Blue 600 // button blue normal
public static final int PRIMARY_500 = new Color(25, 103, 255, 255).getRGB(); // Blue 500 // button blue hover
public static final int PRIMARY_400 = new Color(48, 129, 242, 255).getRGB();
- public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB(); // White 60%
+ public static final int WHITE_50 = new Color(255, 255, 255, 127).getRGB(); // White 50%
public static final int WHITE_60 = new Color(255, 255, 255, 153).getRGB(); // White 60%
public static final int WHITE_80 = new Color(255, 255, 255, 204).getRGB(); // White 80%
public static final int WHITE_90 = new Color(255, 255, 255, 229).getRGB(); // White 90%
- public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 90%
+ public static final int WHITE_95 = new Color(255, 255, 255, 242).getRGB(); // White 95%
public static final int WHITE = new Color(255, 255, 255, 255).getRGB(); // White 100%
public static final int SUCCESS_600 = new Color(3, 152, 85).getRGB();
public static final int SUCCESS_700 = new Color(2, 121, 72).getRGB();