aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc
diff options
context:
space:
mode:
authorDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-11 13:12:19 +0200
committerDeDiamondPro <67508414+DeDiamondPro@users.noreply.github.com>2022-05-11 13:12:19 +0200
commit333b4099972260d0e348ec20f8a00a430471aac8 (patch)
tree18680345cab8a241c2e7bc9b1c0950149497a88f /src/main/java/cc
parent5c16cd384103e0bdbef68fe378f49eb491eacef8 (diff)
parentfd70b3f28f9682e3195f798ae7e1417e81bede7b (diff)
downloadOneConfig-333b4099972260d0e348ec20f8a00a430471aac8.tar.gz
OneConfig-333b4099972260d0e348ec20f8a00a430471aac8.tar.bz2
OneConfig-333b4099972260d0e348ec20f8a00a430471aac8.zip
Merge branch 'master' of github.com:Polyfrost/OneConfig
Diffstat (limited to 'src/main/java/cc')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/OneConfig.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java48
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java6
13 files changed, 76 insertions, 51 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
index 8a993e5..0d6763f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
@@ -12,6 +12,7 @@ import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.test.TestConfig;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.ScaledResolution;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.Loader;
@@ -78,4 +79,17 @@ public class OneConfig {
if (modData.add(newMod)) loadedMods.add(newMod);
}
}
+
+ public static int[] getScaledResolution() {
+ ScaledResolution resolution = new ScaledResolution(mc);
+ return new int[]{resolution.getScaledWidth(), resolution.getScaledHeight()};
+ }
+
+ public static int getDisplayWidth() {
+ return mc.displayWidth;
+ }
+
+ public static int getDisplayHeight() {
+ return mc.displayHeight;
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java b/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
index e6a91d9..eccaf01 100644
--- a/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
+++ b/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
@@ -2,9 +2,9 @@ package cc.polyfrost.oneconfig.command;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.HudGui;
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.test.TestNanoVGGui;
import cc.polyfrost.oneconfig.utils.TickDelay;
-import net.minecraft.client.Minecraft;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -13,8 +13,6 @@ import java.util.List;
public class OneConfigCommand extends CommandBase {
- private static final Minecraft mc = Minecraft.getMinecraft();
-
@Override
public String getCommandName() {
return "oneconfig";
@@ -35,14 +33,14 @@ public class OneConfigCommand extends CommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if (args.length == 0) new TickDelay(() -> mc.displayGuiScreen(OneConfigGui.create()), 1);
+ if (args.length == 0) new TickDelay(() -> RenderManager.displayGuiScreen(OneConfigGui.create()), 1);
else {
switch (args[0]) {
case "hud":
- new TickDelay(() -> mc.displayGuiScreen(new HudGui()), 1);
+ new TickDelay(() -> RenderManager.displayGuiScreen(new HudGui()), 1);
break;
case "lwjgl":
- new TickDelay(() -> mc.displayGuiScreen(new TestNanoVGGui()), 1);
+ new TickDelay(() -> RenderManager.displayGuiScreen(new TestNanoVGGui()), 1);
break;
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
index 906153e..9eecc52 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
@@ -11,8 +11,8 @@ import cc.polyfrost.oneconfig.config.profiles.Profiles;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.config.*;
import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
+import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import com.google.gson.*;
-import net.minecraft.client.Minecraft;
import java.io.*;
import java.lang.reflect.Field;
@@ -194,6 +194,6 @@ public class Config {
*/
public void openGui() {
if (mod == null) return;
- Minecraft.getMinecraft().displayGuiScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage)));
+ RenderManager.displayGuiScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage)));
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
index a67c1d1..5465652 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -3,7 +3,6 @@ package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.hud.HudCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import net.minecraft.client.gui.Gui;
import net.minecraft.client.gui.GuiScreen;
import org.lwjgl.input.Keyboard;
@@ -26,7 +25,7 @@ public class HudGui extends GuiScreen {
@Override
public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- Gui.drawRect(0, 0, this.width, this.height, new Color(80, 80, 80, 50).getRGB());
+ RenderManager.drawGlRect(0, 0, this.width, this.height, new Color(80, 80, 80, 50).getRGB());
if (isDragging) {
setPosition(mouseX - xOffset, mouseY - yOffset, true);
@@ -67,7 +66,7 @@ public class HudGui extends GuiScreen {
if (editingHud == hud) {
color = new Color(43, 159, 235).getRGB();
if (isDragging)
- Gui.drawRect(x, y, x + width, y + height, new Color(108, 176, 255, 60).getRGB());
+ RenderManager.drawGlRect(x, y, width, height, new Color(108, 176, 255, 60).getRGB());
}
int finalColor = color;
RenderManager.setupAndDraw(true, (vg) -> {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 45d92b7..ae70758 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -1,5 +1,6 @@
package cc.polyfrost.oneconfig.gui;
+import cc.polyfrost.oneconfig.OneConfig;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.elements.BasicElement;
import cc.polyfrost.oneconfig.gui.elements.ColorSelector;
@@ -14,14 +15,12 @@ import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
-import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
import org.lwjgl.nanovg.NanoVG;
-import java.awt.*;
import java.util.ArrayList;
public class OneConfigGui extends GuiScreen {
@@ -71,7 +70,7 @@ public class OneConfigGui extends GuiScreen {
currentPage = new HomePage();
parents.add(currentPage);
}
- scale = Minecraft.getMinecraft().displayWidth / 1920f;
+ scale = OneConfig.getDisplayWidth() / 1920f;
NanoVG.nvgScale(vg, scale, scale);
if (OneConfigConfig.ROUNDED_CORNERS) {
RenderManager.drawRoundedRect(vg, x + 224, y, 1056, 800, OneConfigConfig.GRAY_800, OneConfigConfig.CORNER_RADIUS_WIN);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index 0b180b7..c3e99e0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -8,7 +8,6 @@ import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.utils.MathUtils;
-import net.minecraft.client.Minecraft;
import java.util.ArrayList;
import java.util.List;
@@ -31,12 +30,12 @@ public class SideBar {
btnList.add(new BasicButton(192, 36, "Themes Browser", Images.SEARCH, null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Packs Library", Images.MOD_BOX, null, -3, BasicButton.ALIGNMENT_LEFT));
btnList.add(new BasicButton(192, 36, "Packs Browser", Images.SEARCH, null, -3, BasicButton.ALIGNMENT_LEFT));
- btnList.add(new BasicButton(192, 36, "Close", Images.CLOSE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> Minecraft.getMinecraft().displayGuiScreen(null)));
+ btnList.add(new BasicButton(192, 36, "Close", Images.CLOSE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> RenderManager.displayGuiScreen(null)));
btnList.add(new BasicButton(192, 36, "Minimize", Images.MINIMIZE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> {
OneConfigGui.instanceToRestore = OneConfigGui.INSTANCE;
- Minecraft.getMinecraft().displayGuiScreen(null);
+ RenderManager.displayGuiScreen(null);
}));
- btnList.add(new BasicButton(192, 36, "Edit HUD", Images.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> Minecraft.getMinecraft().displayGuiScreen(new HudGui())));
+ btnList.add(new BasicButton(192, 36, "Edit HUD", Images.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> RenderManager.displayGuiScreen(new HudGui())));
}
public void draw(long vg, int x, int y) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
index 7e4bd65..b18502f 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -12,7 +12,6 @@ import cc.polyfrost.oneconfig.lwjgl.image.Images;
import cc.polyfrost.oneconfig.utils.ColorUtils;
import cc.polyfrost.oneconfig.utils.InputUtils;
import net.minecraft.client.Minecraft;
-import net.minecraft.command.CommandException;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.fml.common.ModMetadata;
import org.jetbrains.annotations.NotNull;
@@ -109,7 +108,7 @@ public class ModCard extends BasicElement {
if (possibleCommands.contains(command)) {
try {
ClientCommandHandler.instance.getCommands().get(command).processCommand(Minecraft.getMinecraft().thePlayer, new String[]{});
- } catch (CommandException e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
break;
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 dbca002..349e7af 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
@@ -8,7 +8,6 @@ import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.utils.InputUtils;
import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.util.ChatAllowedCharacters;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -344,7 +343,7 @@ public class TextInputField extends BasicElement {
if (!Character.isDefined(key)) return;
if (!Character.isDefined(c)) return;
if (GuiScreen.isCtrlKeyDown()) return;
- if (ChatAllowedCharacters.isAllowedCharacter(c)) {
+ if (isAllowedCharacter(c)) {
if (selectedText != null) {
if (caretPos > prevCaret) {
input = input.substring(0, prevCaret) + input.substring(prevCaret, caretPos);
@@ -426,4 +425,8 @@ public class TextInputField extends BasicElement {
return RenderManager.getTextWidth(vg, s, 14.0f, Fonts.REGULAR);
}
}
+
+ public static boolean isAllowedCharacter(char character) {
+ return character != 167 && character >= ' ' && character != 127;
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
index 9b54bff..dd73183 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/HomePage.java
@@ -12,8 +12,6 @@ import cc.polyfrost.oneconfig.utils.InputUtils;
import java.awt.*;
-import java.awt.*;
-
public class HomePage extends Page {
private final BasicButton btn = new BasicButton(184, 36, "Socials", Images.SHARE, Images.LAUNCH, 1, BasicButton.ALIGNMENT_CENTER);
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
index 60ade17..50303be 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
@@ -1,7 +1,6 @@
package cc.polyfrost.oneconfig.hud;
-import net.minecraft.client.Minecraft;
-import net.minecraft.client.gui.ScaledResolution;
+import cc.polyfrost.oneconfig.OneConfig;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -14,9 +13,9 @@ public class HudCore {
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post event) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL || editing) return;
- ScaledResolution sr = new ScaledResolution(Minecraft.getMinecraft());
+ int[] sr = OneConfig.getScaledResolution();
for (BasicHud hud : huds) {
- hud.drawAll(hud.getXScaled(sr.getScaledWidth()), hud.getYScaled(sr.getScaledHeight()), hud.scale, true);
+ hud.drawAll(hud.getXScaled(sr[0]), hud.getYScaled(sr[1]), hud.scale, true);
}
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
index 423ecee..7a4ae1e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/OneColor.java
@@ -155,7 +155,7 @@ public class OneColor {
/**
* Get the RGBA color from the HSB color, and apply the alpha.
*/
- public int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) {
+ public static int HSBAtoRGBA(float hue, float saturation, float brightness, int alpha) {
int temp = Color.HSBtoRGB(hue / 360f, saturation / 100f, brightness / 100f);
return ((temp & 0x00ffffff) | (alpha << 24));
}
@@ -163,7 +163,7 @@ public class OneColor {
/**
* Get the HSBA color from the RGBA color.
*/
- public short[] RGBAtoHSBA(int rgba) {
+ public static short[] RGBAtoHSBA(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);
@@ -181,4 +181,9 @@ public class OneColor {
rgba = Integer.parseInt(hex, 16);
hsba = RGBAtoHSBA(rgba);
}
+
+ @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/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index 5966e9b..0a9ccce 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -1,20 +1,21 @@
package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
-import cc.polyfrost.oneconfig.lwjgl.font.Font;
import cc.polyfrost.oneconfig.lwjgl.font.FontManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Image;
import cc.polyfrost.oneconfig.lwjgl.image.ImageLoader;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
import net.minecraft.client.Minecraft;
+import net.minecraft.client.gui.Gui;
+import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.gui.ScaledResolution;
-import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.shader.Framebuffer;
import org.lwjgl.nanovg.NVGColor;
import org.lwjgl.nanovg.NVGPaint;
import org.lwjgl.opengl.Display;
import org.lwjgl.opengl.GL11;
+import org.lwjgl.opengl.GL14;
import java.awt.*;
import java.util.function.LongConsumer;
@@ -63,7 +64,7 @@ public final class RenderManager {
nvgEndFrame(vg);
- GlStateManager.popAttrib();
+ GL11.glPopAttrib();
}
public static void drawRectangle(long vg, float x, float y, float width, float height, int color) { // TODO make everything use this one day
@@ -309,10 +310,10 @@ public final class RenderManager {
}
public static void drawScaledString(String text, float x, float y, int color, boolean shadow, float scale) {
- GlStateManager.pushMatrix();
- GlStateManager.scale(scale, scale, 1);
+ GL11.glPushMatrix();
+ GL11.glScalef(scale, scale, 1);
Minecraft.getMinecraft().fontRendererObj.drawString(text, x * (1 / scale), y * (1 / scale), color, shadow);
- GlStateManager.popMatrix();
+ GL11.glPopMatrix();
}
public static void glColor(int color) {
@@ -320,29 +321,40 @@ public final class RenderManager {
float f1 = (float) (color >> 16 & 255) / 255.0F;
float f2 = (float) (color >> 8 & 255) / 255.0F;
float f3 = (float) (color & 255) / 255.0F;
- GlStateManager.color(f1, f2, f3, f);
+ GL11.glColor4f(f1, f2, f3, f);
}
public static void drawDottedLine(float sx, float sy, float ex, float ey, int width, int factor, int color) {
- GlStateManager.pushMatrix();
+ GL11.glPushMatrix();
GL11.glLineStipple(factor, (short) 0xAAAA);
GL11.glEnable(GL11.GL_LINE_STIPPLE);
- GlStateManager.pushMatrix();
- GlStateManager.disableTexture2D();
- GlStateManager.enableBlend();
- GlStateManager.disableAlpha();
- GlStateManager.tryBlendFuncSeparate(770, 771, 1, 0);
+ GL11.glPushMatrix();
+ GL11.glDisable(GL11.GL_TEXTURE_2D);
+ GL11.glEnable(GL11.GL_BLEND);
+ GL11.glDisable(GL11.GL_ALPHA);
+ GL14.glBlendFuncSeparate(770, 771, 1, 0); // this should never fail because it's a GL14 call, and we import GL31
glColor(color);
GL11.glLineWidth(width);
GL11.glBegin(GL11.GL_LINES);
GL11.glVertex2d(sx, sy);
GL11.glVertex2d(ex, ey);
GL11.glEnd();
- GlStateManager.disableBlend();
- GlStateManager.enableAlpha();
- GlStateManager.enableTexture2D();
- GlStateManager.popMatrix();
+ GL11.glDisable(GL11.GL_BLEND);
+ GL11.glEnable(GL11.GL_ALPHA);
+ GL11.glEnable(GL11.GL_TEXTURE_2D);
+ GL11.glPopMatrix();
GL11.glDisable(GL11.GL_LINE_STIPPLE);
- GlStateManager.popMatrix();
+ GL11.glPopMatrix();
+ }
+
+ public static void drawGlRect(int x, int y, int width, int height, int color) {
+ Gui.drawRect(x, y, x + width, y + height, color);
+ }
+
+
+
+ // other minecraft functions
+ public static void displayGuiScreen(GuiScreen guiScreen) {
+ Minecraft.getMinecraft().displayGuiScreen(guiScreen);
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
index 7f2e5d2..80f5175 100644
--- a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
+++ b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
@@ -1,7 +1,7 @@
package cc.polyfrost.oneconfig.utils;
+import cc.polyfrost.oneconfig.OneConfig;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
-import net.minecraft.client.Minecraft;
import org.lwjgl.input.Mouse;
public class InputUtils {
@@ -30,7 +30,7 @@ public class InputUtils {
}
public static int mouseY() {
- if (OneConfigGui.INSTANCE == null) return Minecraft.getMinecraft().displayHeight - Math.abs(Mouse.getY());
- return (int) ((Minecraft.getMinecraft().displayHeight - Math.abs(Mouse.getY())) / OneConfigGui.INSTANCE.getScaleFactor());
+ if (OneConfigGui.INSTANCE == null) return OneConfig.getDisplayHeight() - Math.abs(Mouse.getY());
+ return (int) ((OneConfig.getDisplayHeight() - Math.abs(Mouse.getY())) / OneConfigGui.INSTANCE.getScaleFactor());
}
}