aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc/polyfrost/oneconfig')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/OneConfig.java36
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java10
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java9
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java48
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java36
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java7
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java4
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/text/TextInputField.java44
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java20
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java52
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java44
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/mixin/ShaderGroupAccessor.java14
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestHud.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java27
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java6
20 files changed, 179 insertions, 196 deletions
diff --git a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
index 0d6763f..2dfca40 100644
--- a/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/OneConfig.java
@@ -11,16 +11,14 @@ import cc.polyfrost.oneconfig.lwjgl.RenderManager;
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 cc.polyfrost.oneconfig.utils.InputUtils;
+import net.minecraft.launchwrapper.Launch;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.common.MinecraftForge;
+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 net.minecraftforge.fml.common.event.FMLInitializationEvent;
-import net.minecraftforge.fml.common.event.FMLPostInitializationEvent;
-import net.minecraftforge.fml.common.event.FMLPreInitializationEvent;
import java.io.File;
import java.util.ArrayList;
@@ -29,9 +27,8 @@ import java.util.List;
@net.minecraftforge.fml.common.Mod(modid = "@ID@", name = "@NAME@", version = "@VER@")
public class OneConfig {
- private static final Minecraft mc = Minecraft.getMinecraft();
public static File jarFile;
- public static File oneConfigDir = new File(mc.mcDataDir, "OneConfig/");
+ public static File oneConfigDir = new File("./OneConfig/");
public static File themesDir = new File(oneConfigDir, "themes/");
public static OneConfigConfig config;
public static TestConfig testConfig;
@@ -39,7 +36,10 @@ public class OneConfig {
public static List<ModMetadata> loadedOtherMods = new ArrayList<>();
@net.minecraftforge.fml.common.Mod.EventHandler
- public void onPreFMLInit(FMLPreInitializationEvent event) {
+ public void onPreFMLInit(net.minecraftforge.fml.common.event.FMLPreInitializationEvent event) {
+ if (!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!");
+ }
jarFile = event.getSourceFile();
oneConfigDir.mkdirs();
themesDir.mkdirs();
@@ -47,12 +47,13 @@ public class OneConfig {
}
@net.minecraftforge.fml.common.Mod.EventHandler
- public void onFMLInitialization(FMLInitializationEvent event) {
+ public void onFMLInitialization(net.minecraftforge.fml.common.event.FMLInitializationEvent event) {
BlurHandler.INSTANCE.load();
testConfig = new TestConfig();
ClientCommandHandler.instance.registerCommand(new OneConfigCommand());
MinecraftForge.EVENT_BUS.register(this);
MinecraftForge.EVENT_BUS.register(new HudCore());
+ MinecraftForge.EVENT_BUS.register(new InputUtils());
RenderManager.setupAndDraw((vg) -> {
RenderManager.drawRoundedRect(vg, -100, -100, 50, 50, -1, 12f);
RenderManager.drawString(vg, "OneConfig loading...", -100, -100, -1, 12f, Fonts.MEDIUM);
@@ -61,7 +62,7 @@ public class OneConfig {
}
@net.minecraftforge.fml.common.Mod.EventHandler
- public void onPostFMLInit(FMLPostInitializationEvent event) {
+ public void onPostFMLInit(net.minecraftforge.fml.common.event.FMLPostInitializationEvent event) {
reloadModsList();
}
@@ -74,22 +75,9 @@ public class OneConfig {
String author = metadata.authorList.size() > 0 ? metadata.authorList.get(0) : "";
Mod newMod = new Mod(metadata.name, ModType.THIRD_PARTY, author, metadata.version);
newMod.isShortCut = true;
- if (newMod.name.equals("Minecraft Coder Pack") || newMod.name.equals("Forge Mod Loader") || newMod.name.equals("Minecraft Forge") || newMod.name.equals("OneConfig"))
+ if (mod instanceof DummyModContainer || newMod.name.equals("OneConfig"))
continue;
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 eccaf01..f21e569 100644
--- a/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
+++ b/src/main/java/cc/polyfrost/oneconfig/command/OneConfigCommand.java
@@ -1,10 +1,10 @@
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.gui.OneConfigGui;
import cc.polyfrost.oneconfig.test.TestNanoVGGui;
import cc.polyfrost.oneconfig.utils.TickDelay;
+import gg.essential.universal.UScreen;
import net.minecraft.command.CommandBase;
import net.minecraft.command.ICommandSender;
@@ -33,14 +33,14 @@ public class OneConfigCommand extends CommandBase {
@Override
public void processCommand(ICommandSender sender, String[] args) {
- if (args.length == 0) new TickDelay(() -> RenderManager.displayGuiScreen(OneConfigGui.create()), 1);
+ if (args.length == 0) new TickDelay(() -> UScreen.displayScreen(OneConfigGui.create()), 1);
else {
switch (args[0]) {
case "hud":
- new TickDelay(() -> RenderManager.displayGuiScreen(new HudGui()), 1);
+ new TickDelay(() -> UScreen.displayScreen(new HudGui()), 1);
break;
case "lwjgl":
- new TickDelay(() -> RenderManager.displayGuiScreen(new TestNanoVGGui()), 1);
+ new TickDelay(() -> UScreen.displayScreen(new TestNanoVGGui()), 1);
break;
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
index f39e1c7..d455411 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
@@ -1,9 +1,6 @@
package cc.polyfrost.oneconfig.config.core;
-import net.minecraftforge.common.MinecraftForge;
-import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
-import net.minecraftforge.fml.common.gameevent.InputEvent;
-import org.lwjgl.input.Keyboard;
+import gg.essential.universal.UKeyboard;
import java.util.ArrayList;
@@ -19,7 +16,7 @@ public class OneKeyBind {
public boolean isActive() {
if (keyBinds.size() == 0) return false;
for (int keyBind : keyBinds) {
- if (!Keyboard.isKeyDown(keyBind)) return false;
+ if (!UKeyboard.isKeyDown(keyBind)) return false;
}
return true;
}
@@ -28,7 +25,7 @@ public class OneKeyBind {
StringBuilder sb = new StringBuilder();
for (int keyBind : keyBinds) {
if (sb.length() != 0) sb.append(" + ");
- sb.append(Keyboard.getKeyName(keyBind));
+ sb.append(UKeyboard.getKeyName(keyBind, -1));
}
return sb.toString().trim();
}
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 cbd4b08..a11b1d2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/interfaces/Config.java
@@ -12,6 +12,7 @@ import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.hud.HudCore;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import com.google.gson.*;
+import gg.essential.universal.UScreen;
import java.io.*;
import java.lang.reflect.Field;
@@ -230,7 +231,7 @@ public class Config {
*/
public void openGui() {
if (mod == null) return;
- RenderManager.displayGuiScreen(new OneConfigGui(new ModConfigPage(mod.defaultPage)));
+ UScreen.displayScreen(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 a0f1e6c..e81fb86 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/HudGui.java
@@ -1,17 +1,19 @@
package cc.polyfrost.oneconfig.gui;
import cc.polyfrost.oneconfig.config.core.ConfigCore;
-import cc.polyfrost.oneconfig.hud.HudCore;
import cc.polyfrost.oneconfig.hud.BasicHud;
+import cc.polyfrost.oneconfig.hud.HudCore;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import net.minecraft.client.gui.GuiScreen;
-import org.lwjgl.input.Keyboard;
+import gg.essential.universal.UKeyboard;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UScreen;
+import org.jetbrains.annotations.NotNull;
+import org.jetbrains.annotations.Nullable;
import java.awt.*;
-import java.io.IOException;
import java.util.ArrayList;
-public class HudGui extends GuiScreen {
+public class HudGui extends UScreen {
private BasicHud editingHud;
private boolean isDragging;
private boolean isScaling;
@@ -19,13 +21,14 @@ public class HudGui extends GuiScreen {
private int yOffset;
@Override
- public void initGui() {
+ public void initScreen(int width, int height) {
HudCore.editing = true;
- Keyboard.enableRepeatEvents(true);
+ UKeyboard.allowRepeatEvents(true);
+ super.initScreen(width, height);
}
@Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
+ public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
RenderManager.drawGlRect(0, 0, this.width, this.height, new Color(80, 80, 80, 50).getRGB());
if (isDragging) {
@@ -78,9 +81,7 @@ public class HudGui extends GuiScreen {
});
if (hud == editingHud && !isDragging) {
- RenderManager.setupAndDraw(true, (vg) -> {
- RenderManager.drawCircle(vg, x + width, y + height, 3, new Color(43, 159, 235).getRGB());
- });
+ RenderManager.setupAndDraw(true, (vg) -> RenderManager.drawCircle(vg, x + width, y + height, 3, new Color(43, 159, 235).getRGB()));
}
if (hud.childBottom != null) processHud(hud.childBottom, mouseX);
@@ -255,7 +256,8 @@ public class HudGui extends GuiScreen {
}
@Override
- protected void mouseClicked(int mouseX, int mouseY, int mouseButton) {
+ public void onMouseClicked(double mouseX, double mouseY, int mouseButton) {
+ super.onMouseClicked(mouseX, mouseY, mouseButton);
if (mouseButton == 0) {
if (editingHud != null) {
int width = (int) (editingHud.getWidth(editingHud.scale) + editingHud.paddingX * editingHud.scale);
@@ -270,7 +272,7 @@ public class HudGui extends GuiScreen {
editingHud = null;
for (BasicHud hud : HudCore.huds) {
if (!hud.enabled) continue;
- if (mouseClickedHud(hud, mouseX, mouseY))
+ if (mouseClickedHud(hud, (int) mouseX, (int) mouseY))
break;
}
}
@@ -292,38 +294,40 @@ public class HudGui extends GuiScreen {
}
@Override
- protected void mouseReleased(int mouseX, int mouseY, int state) {
+ public void onMouseReleased(double mouseX, double mouseY, int state) {
+ super.onMouseReleased(mouseX, mouseY, state);
isDragging = false;
isScaling = false;
}
@Override
- protected void keyTyped(char typedChar, int keyCode) throws IOException {
+ public void onKeyPressed(int keyCode, char typedChar, @Nullable UKeyboard.Modifiers modifiers) {
if (editingHud != null) {
float x = editingHud.getXScaled(this.width);
float y = editingHud.getYScaled(this.height);
switch (keyCode) {
- case Keyboard.KEY_UP:
+ case UKeyboard.KEY_UP:
setPosition(x, y - 1, false);
break;
- case Keyboard.KEY_DOWN:
+ case UKeyboard.KEY_DOWN:
setPosition(x, y + 1, false);
break;
- case Keyboard.KEY_LEFT:
+ case UKeyboard.KEY_LEFT:
setPosition(x - 1, y, false);
break;
- case Keyboard.KEY_RIGHT:
+ case UKeyboard.KEY_RIGHT:
setPosition(x + 1, y, false);
break;
}
}
- super.keyTyped(typedChar, keyCode);
+ super.onKeyPressed(keyCode, typedChar, modifiers);
}
@Override
- public void onGuiClosed() {
+ public void onScreenClose() {
+ super.onScreenClose();
HudCore.editing = false;
- Keyboard.enableRepeatEvents(false);
+ UKeyboard.allowRepeatEvents(false);
ConfigCore.saveAll();
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
index 468f59e..db32c92 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/OneConfigGui.java
@@ -1,6 +1,5 @@
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;
@@ -9,21 +8,24 @@ import cc.polyfrost.oneconfig.gui.pages.HomePage;
import cc.polyfrost.oneconfig.gui.pages.Page;
import cc.polyfrost.oneconfig.lwjgl.OneColor;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
-import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
+import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
+import cc.polyfrost.oneconfig.lwjgl.scissor.ScissorManager;
import cc.polyfrost.oneconfig.utils.InputUtils;
import cc.polyfrost.oneconfig.utils.MathUtils;
-import net.minecraft.client.gui.GuiScreen;
+import gg.essential.universal.UKeyboard;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UResolution;
+import gg.essential.universal.UScreen;
import org.jetbrains.annotations.NotNull;
-import org.lwjgl.input.Keyboard;
+import org.jetbrains.annotations.Nullable;
import org.lwjgl.input.Mouse;
import org.lwjgl.nanovg.NanoVG;
import java.util.ArrayList;
-public class OneConfigGui extends GuiScreen {
+public class OneConfigGui extends UScreen {
public static OneConfigGui INSTANCE;
public final int x = 320;
public final int y = 140;
@@ -63,15 +65,15 @@ public class OneConfigGui extends GuiScreen {
}
@Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
+ public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
+ super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks);
long start = System.nanoTime();
RenderManager.setupAndDraw((vg) -> {
if (currentPage == null) {
currentPage = new HomePage();
parents.add(currentPage);
}
- scale = OneConfig.getDisplayWidth() / 1920f;
+ scale = UResolution.getWindowWidth() / 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);
@@ -172,13 +174,14 @@ public class OneConfigGui extends GuiScreen {
mouseDown = Mouse.isButtonDown(0);
}
- protected void keyTyped(char key, int keyCode) {
- Keyboard.enableRepeatEvents(true);
+ @Override
+ public void onKeyPressed(int keyCode, char typedChar, @Nullable UKeyboard.Modifiers modifiers) {
+ UKeyboard.allowRepeatEvents(true);
try {
- if (allowClose) super.keyTyped(key, keyCode);
- textInputField.keyTyped(key, keyCode);
- if (currentColorSelector != null) currentColorSelector.keyTyped(key, keyCode);
- currentPage.keyTyped(key, keyCode);
+ if (allowClose) super.onKeyPressed(keyCode, typedChar, modifiers);
+ textInputField.keyTyped(typedChar, keyCode);
+ if (currentColorSelector != null) currentColorSelector.keyTyped(typedChar, keyCode);
+ currentPage.keyTyped(typedChar, keyCode);
} catch (Exception e) {
e.printStackTrace();
System.out.println("this should literally never happen");
@@ -250,8 +253,9 @@ public class OneConfigGui extends GuiScreen {
}
@Override
- public void onGuiClosed() {
+ public void onScreenClose() {
currentPage.finishUpAndClose();
INSTANCE = null;
+ super.onScreenClose();
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index c3e99e0..85d88f9 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -8,6 +8,7 @@ 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 gg.essential.universal.UScreen;
import java.util.ArrayList;
import java.util.List;
@@ -30,12 +31,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, () -> RenderManager.displayGuiScreen(null)));
+ btnList.add(new BasicButton(192, 36, "Close", Images.CLOSE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> UScreen.displayScreen(null)));
btnList.add(new BasicButton(192, 36, "Minimize", Images.MINIMIZE, null, -1, BasicButton.ALIGNMENT_LEFT, () -> {
OneConfigGui.instanceToRestore = OneConfigGui.INSTANCE;
- RenderManager.displayGuiScreen(null);
+ UScreen.displayScreen(null);
}));
- btnList.add(new BasicButton(192, 36, "Edit HUD", Images.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> RenderManager.displayGuiScreen(new HudGui())));
+ btnList.add(new BasicButton(192, 36, "Edit HUD", Images.HUD, null, 0, BasicButton.ALIGNMENT_LEFT, () -> UScreen.displayScreen(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 b18502f..9af35f1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -11,7 +11,7 @@ import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
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 gg.essential.universal.wrappers.UPlayer;
import net.minecraftforge.client.ClientCommandHandler;
import net.minecraftforge.fml.common.ModMetadata;
import org.jetbrains.annotations.NotNull;
@@ -107,7 +107,7 @@ public class ModCard extends BasicElement {
for (String command : ClientCommandHandler.instance.getCommands().keySet()) {
if (possibleCommands.contains(command)) {
try {
- ClientCommandHandler.instance.getCommands().get(command).processCommand(Minecraft.getMinecraft().thePlayer, new String[]{});
+ ClientCommandHandler.instance.getCommands().get(command).processCommand(UPlayer.getPlayer(), new String[]{});
} catch (Exception e) {
throw new RuntimeException(e);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
index f8669a2..01a2bd2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java
@@ -8,7 +8,7 @@ import cc.polyfrost.oneconfig.gui.elements.BasicButton;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.image.Images;
-import org.lwjgl.input.Keyboard;
+import gg.essential.universal.UKeyboard;
import org.lwjgl.nanovg.NanoVG;
import java.lang.reflect.Field;
@@ -53,7 +53,7 @@ public class ConfigKeyBind extends BasicOption {
public void keyTyped(char key, int keyCode) {
if (!button.isToggled()) return;
OneKeyBind keyBind = getKeyBind();
- if (keyCode == Keyboard.KEY_ESCAPE) {
+ if (keyCode == UKeyboard.KEY_ESCAPE) {
keyBind.clearKeys();
button.setToggled(false);
OneConfigGui.INSTANCE.allowClose = true;
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 349e7af..9d87717 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
@@ -3,11 +3,11 @@ package cc.polyfrost.oneconfig.gui.elements.text;
import cc.polyfrost.oneconfig.config.OneConfigConfig;
import cc.polyfrost.oneconfig.gui.elements.BasicElement;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
import cc.polyfrost.oneconfig.lwjgl.scissor.Scissor;
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 gg.essential.universal.UKeyboard;
import org.jetbrains.annotations.NotNull;
import org.lwjgl.input.Keyboard;
import org.lwjgl.input.Mouse;
@@ -195,13 +195,13 @@ public class TextInputField extends BasicElement {
public void keyTyped(char c, int key) {
try {
if (toggled) {
- if (GuiScreen.isKeyComboCtrlC(key)) {
+ if (UKeyboard.isKeyComboCtrlC(key)) {
if (selectedText != null && start != 0f && end != 0f) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(selectedText), null);
}
return;
}
- if (GuiScreen.isKeyComboCtrlV(key) || key == Keyboard.KEY_INSERT) {
+ if (UKeyboard.isKeyComboCtrlV(key) || key == Keyboard.KEY_INSERT) { //todo find the UKeyboard equivalent for insert
try {
String clip = Toolkit.getDefaultToolkit().getSystemClipboard().getContents(null).getTransferData(DataFlavor.stringFlavor).toString();
input = input.substring(0, caretPos) + clip + input.substring(caretPos);
@@ -211,13 +211,13 @@ public class TextInputField extends BasicElement {
e.printStackTrace();
}
}
- if (key == Keyboard.KEY_DELETE) {
+ if (key == UKeyboard.KEY_DELETE) {
input = "";
}
- if (GuiScreen.isCtrlKeyDown()) {
- if (key == Keyboard.KEY_BACK && !GuiScreen.isKeyComboCtrlX(key)) {
+ if (UKeyboard.isCtrlKeyDown()) {
+ if (key == UKeyboard.KEY_BACKSPACE && !UKeyboard.isKeyComboCtrlX(key)) {
try {
input = input.substring(0, input.lastIndexOf(" "));
caretPos = input.length();
@@ -227,7 +227,7 @@ public class TextInputField extends BasicElement {
}
return;
}
- if (GuiScreen.isKeyComboCtrlA(key)) {
+ if (UKeyboard.isKeyComboCtrlA(key)) {
prevCaret = 0;
caretPos = input.length();
start = !centered ? x + 12 : x + this.width / 2f - this.getTextWidth(vg, input) / 2f;
@@ -235,22 +235,22 @@ public class TextInputField extends BasicElement {
end = this.getTextWidth(vg, input);
return;
}
- if (GuiScreen.isKeyComboCtrlX(key)) {
+ if (UKeyboard.isKeyComboCtrlX(key)) {
if (selectedText != null && start != 0f && end != 0f) {
Toolkit.getDefaultToolkit().getSystemClipboard().setContents(new StringSelection(selectedText), null);
- key = Keyboard.KEY_BACK;
+ key = UKeyboard.KEY_BACKSPACE;
} else return;
}
- if (key == Keyboard.KEY_LEFT) {
+ if (key == UKeyboard.KEY_LEFT) {
caretPos = input.substring(0, caretPos).lastIndexOf(' ') + 1;
}
- if (key == Keyboard.KEY_RIGHT) {
+ if (key == UKeyboard.KEY_RIGHT) {
caretPos = input.indexOf(' ', caretPos);
if (caretPos == -1) caretPos = input.length();
}
}
- if (key == Keyboard.KEY_BACK) {
+ if (key == UKeyboard.KEY_BACKSPACE) {
if (input.length() > 0) {
if (start != 0f && end != 0f) {
start = 0f;
@@ -273,14 +273,14 @@ public class TextInputField extends BasicElement {
}
return;
}
- if (key == Keyboard.KEY_TAB) {
+ if (key == UKeyboard.KEY_TAB) {
if (onlyNums) return;
input += " ";
caretPos += 4;
return;
}
- if (key == Keyboard.KEY_RIGHT) {
+ if (key == UKeyboard.KEY_RIGHT) {
caretPos++;
if (caretPos > input.length()) {
caretPos = input.length();
@@ -291,7 +291,7 @@ public class TextInputField extends BasicElement {
}
return;
}
- if (key == Keyboard.KEY_LEFT) {
+ if (key == UKeyboard.KEY_LEFT) {
caretPos--;
if (caretPos < 0) {
caretPos = 0;
@@ -302,7 +302,7 @@ public class TextInputField extends BasicElement {
}
return;
}
- if (key == Keyboard.KEY_UP || key == 201) { // 201 = page up
+ if (key == UKeyboard.KEY_UP || key == 201) { // 201 = page up
caretPos = 0;
if (start != 0f && end != 0f) {
start = 0f;
@@ -310,7 +310,7 @@ public class TextInputField extends BasicElement {
}
return;
}
- if (key == Keyboard.KEY_DOWN || key == 209) { // 209 = page down
+ if (key == UKeyboard.KEY_DOWN || key == 209) { // 209 = page down
caretPos = input.length();
if (start != 0f && end != 0f) {
start = 0f;
@@ -320,7 +320,7 @@ public class TextInputField extends BasicElement {
}
- if (key == Keyboard.KEY_RETURN) {
+ if (key == UKeyboard.KEY_ENTER) {
onClose();
toggled = false;
if (start != 0f && end != 0f) {
@@ -328,13 +328,13 @@ public class TextInputField extends BasicElement {
end = 0f;
}
}
- if (key == Keyboard.KEY_END) {
+ if (key == UKeyboard.KEY_END) {
onClose();
toggled = false;
}
- if (key == Keyboard.KEY_LCONTROL || key == Keyboard.KEY_RCONTROL || key == Keyboard.KEY_LMENU || key == Keyboard.KEY_RMENU || key == Keyboard.KEY_LMETA || key == Keyboard.KEY_RMETA || key == Keyboard.KEY_LSHIFT || key == Keyboard.KEY_RSHIFT || key == Keyboard.KEY_RETURN || key == Keyboard.KEY_CAPITAL || key == 221 || key == Keyboard.KEY_HOME) {
+ if (key == UKeyboard.KEY_LCONTROL || key == UKeyboard.KEY_RCONTROL || key == UKeyboard.KEY_LMENU || key == UKeyboard.KEY_RMENU || key == UKeyboard.KEY_LMETA || key == UKeyboard.KEY_RMETA || key == UKeyboard.KEY_LSHIFT || key == UKeyboard.KEY_RSHIFT || key == UKeyboard.KEY_ENTER || key == UKeyboard.KEY_CAPITAL || key == 221 || key == UKeyboard.KEY_HOME) {
return;
}
if (onlyNums) {
@@ -342,7 +342,7 @@ public class TextInputField extends BasicElement {
}
if (!Character.isDefined(key)) return;
if (!Character.isDefined(c)) return;
- if (GuiScreen.isCtrlKeyDown()) return;
+ if (UKeyboard.isCtrlKeyDown()) return;
if (isAllowedCharacter(c)) {
if (selectedText != null) {
if (caretPos > prevCaret) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
index 08baaee..f307349 100644
--- a/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/hud/HudCore.java
@@ -1,6 +1,6 @@
package cc.polyfrost.oneconfig.hud;
-import cc.polyfrost.oneconfig.OneConfig;
+import gg.essential.universal.UResolution;
import net.minecraftforge.client.event.RenderGameOverlayEvent;
import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
@@ -13,9 +13,8 @@ public class HudCore {
@SubscribeEvent
public void onRender(RenderGameOverlayEvent.Post event) {
if (event.type != RenderGameOverlayEvent.ElementType.ALL || editing) return;
- int[] sr = OneConfig.getScaledResolution();
for (BasicHud hud : huds) {
- if(hud.enabled) hud.drawAll(hud.getXScaled(sr[0]), hud.getYScaled(sr[1]), hud.scale, true);
+ if(hud.enabled) hud.drawAll(hud.getXScaled(UResolution.getScaledWidth()), hud.getYScaled(UResolution.getScaledHeight()), hud.scale, true);
}
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
new file mode 100644
index 0000000..9c9595d
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/init/OneConfigInit.java
@@ -0,0 +1,20 @@
+package cc.polyfrost.oneconfig.init;
+
+import net.minecraft.launchwrapper.Launch;
+import org.spongepowered.asm.launch.MixinBootstrap;
+import org.spongepowered.asm.mixin.Mixins;
+
+/**
+ * Initializes the OneConfig mod.
+ * <p>MUST BE CALLED VIA AN ITWEAKER / FMLLOADINGPLUGIN FOR 1.12 AND BELOW, OR A PRELAUNCH TWEAKER FOR 1.14+ FABRIC.</p>
+ */
+@SuppressWarnings("unused")
+public class OneConfigInit {
+ public static void initialize(String[] args) {
+ if (!Launch.blackboard.containsKey("oneconfig.initialized")) {
+ Launch.blackboard.put("oneconfig.initialized", true);
+ MixinBootstrap.init();
+ Mixins.addConfiguration("mixins.oneconfig.json");
+ }
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
index 7fc725a..973677e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/BlurHandler.java
@@ -1,11 +1,12 @@
package cc.polyfrost.oneconfig.lwjgl;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
+import cc.polyfrost.oneconfig.mixin.ShaderGroupAccessor;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UScreen;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.renderer.EntityRenderer;
import net.minecraft.client.shader.Shader;
-import net.minecraft.client.shader.ShaderGroup;
import net.minecraft.client.shader.ShaderUniform;
import net.minecraft.util.ResourceLocation;
import net.minecraftforge.client.event.GuiOpenEvent;
@@ -15,7 +16,6 @@ import net.minecraftforge.fml.common.gameevent.TickEvent;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
-import java.lang.reflect.Field;
import java.util.List;
/**
@@ -34,8 +34,6 @@ import java.util.List;
public class BlurHandler {
private final ResourceLocation blurShader = new ResourceLocation("shaders/post/fade_in_blur.json");
private final Logger logger = LogManager.getLogger("OneConfig - Blur");
- private final Minecraft mc = Minecraft.getMinecraft();
- private Field shaderList = null;
private long start;
private float lastProgress = 0;
@@ -56,22 +54,17 @@ public class BlurHandler {
@SubscribeEvent
public void onRenderTick(final TickEvent.RenderTickEvent event) {
- this.mc.mcProfiler.startSection("blur");
-
if (event.phase != TickEvent.Phase.END) {
- this.mc.mcProfiler.endSection();
return;
}
// Only blur on our own menus
- if (this.mc.currentScreen == null) {
- this.mc.mcProfiler.endSection();
+ if (UScreen.getCurrentScreen() == null) {
return;
}
// Only update the shader if one is active
- if (!this.mc.entityRenderer.isShaderActive()) {
- this.mc.mcProfiler.endSection();
+ if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive()) {
return;
}
@@ -81,7 +74,6 @@ public class BlurHandler {
// will skip the frame update, which (hopefully) resolves the issue
// with the heavy computations after the "animation" is complete.
if (progress == this.lastProgress) {
- this.mc.mcProfiler.endSection();
return;
}
@@ -92,11 +84,10 @@ public class BlurHandler {
// Why is this being computed every tick? Surely there is a better way?
// This needs to be optimized.
try {
- final List<Shader> listShaders = getShaderList();
+ final List<Shader> listShaders = ((ShaderGroupAccessor) Minecraft.getMinecraft().entityRenderer.getShaderGroup()).getListShaders();
// Should not happen. Something bad happened.
if (listShaders == null) {
- this.mc.mcProfiler.endSection();
return;
}
@@ -114,8 +105,6 @@ public class BlurHandler {
} catch (IllegalArgumentException ex) {
this.logger.error("An error.png occurred while updating OneConfig's blur. Please report this!", ex);
}
-
- this.mc.mcProfiler.endSection();
}
/**
@@ -125,35 +114,27 @@ public class BlurHandler {
*/
public void reloadBlur(GuiScreen gui) {
// Don't do anything if no world is loaded
- if (this.mc.theWorld == null) {
+ if (UMinecraft.getWorld() == null) {
return;
}
- EntityRenderer er = this.mc.entityRenderer;
-
// If a shader is not already active and the UI is
// a one of ours, we should load our own blur!
- if (!er.isShaderActive() && gui instanceof OneConfigGui) {
- this.mc.entityRenderer.loadShader(this.blurShader);
- try {
- shaderList = ShaderGroup.class.getDeclaredField("listShaders");
- shaderList.setAccessible(true);
- } catch (NoSuchFieldException ignored) {
- }
+ if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive() && gui instanceof OneConfigGui) {
+ UMinecraft.getMinecraft().entityRenderer.loadShader(this.blurShader);
this.start = System.currentTimeMillis();
// If a shader is active and the incoming UI is null or we have blur disabled, stop using the shader.
- } else if (er.isShaderActive() && (gui == null)) {
- String name = er.getShaderGroup().getShaderGroupName();
+ } else if (UMinecraft.getMinecraft().entityRenderer.isShaderActive() && (gui == null)) {
+ String name = UMinecraft.getMinecraft().entityRenderer.getShaderGroup().getShaderGroupName();
// Only stop our specific blur ;)
if (!name.endsWith("fade_in_blur.json")) {
return;
}
- er.stopUseShader();
- shaderList = null;
+ UMinecraft.getMinecraft().entityRenderer.stopUseShader();
}
}
@@ -165,13 +146,4 @@ public class BlurHandler {
private float getBlurStrengthProgress() {
return Math.min((System.currentTimeMillis() - this.start) / 50F, 5.0F);
}
-
- private List<Shader> getShaderList() {
- if (shaderList == null) return null;
- try {
- return (List<Shader>) shaderList.get(this.mc.entityRenderer.getShaderGroup());
- } catch (IllegalAccessException ignored) {
- return null;
- }
- }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
index d23f1dd..4276865 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/RenderManager.java
@@ -6,18 +6,15 @@ 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 gg.essential.universal.UGraphics;
+import gg.essential.universal.UMinecraft;
+import gg.essential.universal.UResolution;
import net.minecraft.client.gui.Gui;
-import net.minecraft.client.gui.GuiScreen;
-import net.minecraft.client.gui.ScaledResolution;
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;
import static org.lwjgl.nanovg.NanoVG.*;
@@ -46,18 +43,17 @@ public final class RenderManager {
FontManager.INSTANCE.initialize(vg);
}
- Framebuffer fb = Minecraft.getMinecraft().getFramebuffer();
+ Framebuffer fb = UMinecraft.getMinecraft().getFramebuffer();
if (!fb.isStencilEnabled()) {
fb.enableStencil();
}
GL11.glPushAttrib(GL11.GL_ALL_ATTRIB_BITS);
if (mcScaling) {
- ScaledResolution resolution = new ScaledResolution(Minecraft.getMinecraft());
- nvgBeginFrame(vg, (float) resolution.getScaledWidth_double(), (float) resolution.getScaledHeight_double(), resolution.getScaleFactor());
+ nvgBeginFrame(vg, (float) UResolution.getScaledWidth(), (float) UResolution.getScaledHeight(), (float) UResolution.getScaleFactor());
} else {
// If we get blurry problems with high DPI monitors, 1 might need to be replaced with Display.getPixelScaleFactor()
- nvgBeginFrame(vg, Display.getWidth(), Display.getHeight(), 1);
+ nvgBeginFrame(vg, UResolution.getWindowWidth(), UResolution.getWindowHeight(), 1);
}
consumer.accept(vg);
@@ -305,33 +301,15 @@ public final class RenderManager {
// gl
- public static void glColor(Color color) {
- glColor(color.getRGB());
- }
-
- public static void drawScaledString(String text, float x, float y, int color, boolean shadow, float scale) {
- GL11.glPushMatrix();
- GL11.glScalef(scale, scale, 1);
- Minecraft.getMinecraft().fontRendererObj.drawString(text, x * (1 / scale), y * (1 / scale), color, shadow);
- GL11.glPopMatrix();
- }
- public static void glColor(int color) {
- float f = (float) (color >> 24 & 255) / 255.0F;
- float f1 = (float) (color >> 16 & 255) / 255.0F;
- float f2 = (float) (color >> 8 & 255) / 255.0F;
- float f3 = (float) (color & 255) / 255.0F;
- GL11.glColor4f(f1, f2, f3, f);
+ public static void drawScaledString(String text, float x, float y, int color, boolean shadow, float scale) { //todo replace eventually with either nanovg or UMatrixStack
+ UGraphics.GL.pushMatrix();
+ UGraphics.GL.scale(scale, scale, 1);
+ UMinecraft.getFontRenderer().drawString(text, x * (1 / scale), y * (1 / scale), color, shadow);
+ UGraphics.GL.popMatrix();
}
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/lwjgl/plugin/ClassTransformer.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java
index 858d615..8e388dc 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/ClassTransformer.java
@@ -10,6 +10,7 @@ import org.objectweb.asm.tree.*;
* Taken from LWJGLTwoPointFive under The Unlicense
* <a href="https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/">https://github.com/DJtheRedstoner/LWJGLTwoPointFive/blob/master/LICENSE/</a>
*/
+@SuppressWarnings("unused")
public class ClassTransformer implements IClassTransformer {
@Override
public byte[] transform(String name, String transformedName, byte[] basicClass) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java
index b2ae799..6cd8911 100644
--- a/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java
+++ b/src/main/java/cc/polyfrost/oneconfig/lwjgl/plugin/LoadingPlugin.java
@@ -1,5 +1,6 @@
package cc.polyfrost.oneconfig.lwjgl.plugin;
+import cc.polyfrost.oneconfig.init.OneConfigInit;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
@@ -20,6 +21,7 @@ public class LoadingPlugin implements IFMLLoadingPlugin {
f_exceptions.setAccessible(true);
Set<String> exceptions = (Set<String>) f_exceptions.get(Launch.classLoader);
exceptions.remove("org.lwjgl.");
+ OneConfigInit.initialize(new String[]{});
} catch (Exception e) {
throw new RuntimeException("e");
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/mixin/ShaderGroupAccessor.java b/src/main/java/cc/polyfrost/oneconfig/mixin/ShaderGroupAccessor.java
new file mode 100644
index 0000000..cf8754e
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/mixin/ShaderGroupAccessor.java
@@ -0,0 +1,14 @@
+package cc.polyfrost.oneconfig.mixin;
+
+import net.minecraft.client.shader.Shader;
+import net.minecraft.client.shader.ShaderGroup;
+import org.spongepowered.asm.mixin.Mixin;
+import org.spongepowered.asm.mixin.gen.Accessor;
+
+import java.util.List;
+
+@Mixin(ShaderGroup.class)
+public interface ShaderGroupAccessor {
+ @Accessor("listShaders")
+ List<Shader> getListShaders();
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
index 80f3bbc..c4349e8 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestHud.java
@@ -2,6 +2,7 @@ package cc.polyfrost.oneconfig.test;
import cc.polyfrost.oneconfig.hud.BasicHud;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
+import gg.essential.universal.UMinecraft;
import net.minecraft.client.Minecraft;
public class TestHud extends BasicHud {
@@ -11,7 +12,7 @@ public class TestHud extends BasicHud {
@Override
public int getWidth(float scale) {
- return (int) (Minecraft.getMinecraft().fontRendererObj.getStringWidth("FPS: " + Minecraft.getDebugFPS()) * scale);
+ return (int) (UMinecraft.getFontRenderer().getStringWidth("FPS: " + Minecraft.getDebugFPS()) * scale);
}
@Override
diff --git a/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java
index 60cfe2f..dac7e12 100644
--- a/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java
+++ b/src/main/java/cc/polyfrost/oneconfig/test/TestNanoVGGui.java
@@ -1,26 +1,27 @@
package cc.polyfrost.oneconfig.test;
import cc.polyfrost.oneconfig.lwjgl.RenderManager;
-import net.minecraft.client.gui.GuiScreen;
+import cc.polyfrost.oneconfig.lwjgl.font.Fonts;
+import gg.essential.universal.UMatrixStack;
+import gg.essential.universal.UScreen;
+import org.jetbrains.annotations.NotNull;
import java.awt.*;
-public class TestNanoVGGui extends GuiScreen {
+public class TestNanoVGGui extends UScreen {
@Override
- public void drawScreen(int mouseX, int mouseY, float partialTicks) {
- super.drawScreen(mouseX, mouseY, partialTicks);
+ public void onDrawScreen(@NotNull UMatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
+ super.onDrawScreen(matrixStack, mouseX, mouseY, partialTicks);
drawRect(0, 0, width, height, Color.BLACK.getRGB());
long startTime = System.nanoTime();
RenderManager.setupAndDraw((vg) -> {
- //RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
- //RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
- //RenderManager.drawString(vg, "Hello!", 80, 20, Color.WHITE.getRGB(), 50, Fonts.MC_REGULAR);
- //RenderManager.drawString(vg, "Hello!", 100, 100, Color.WHITE.getRGB(), 50, Fonts.INTER_BOLD);
- //RenderManager.drawLine(vg, 0, 0, 100, 100, 7, Color.PINK.getRGB());
- //RenderManager.drawCircle(vg, 200, 200, 50, Color.WHITE.getRGB());
- //RenderManager.drawString(vg, (float) (System.nanoTime() - startTime) / 1000000f + "ms", 500, 500, Color.WHITE.getRGB(), 100, Fonts.INTER_BOLD);
+ RenderManager.drawRect(vg, 0, 0, 100, 100, Color.BLUE.getRGB());
+ RenderManager.drawRoundedRect(vg, 305, 305, 100, 100, Color.YELLOW.getRGB(), 8);
+ RenderManager.drawString(vg, "Hello!", 100, 100, Color.WHITE.getRGB(), 50, Fonts.BOLD);
+ RenderManager.drawLine(vg, 0, 0, 100, 100, 7, Color.PINK.getRGB());
+ RenderManager.drawCircle(vg, 200, 200, 50, Color.WHITE.getRGB());
+ RenderManager.drawString(vg, (float) (System.nanoTime() - startTime) / 1000000f + "ms", 500, 500, Color.WHITE.getRGB(), 100, Fonts.BOLD);
});
- drawString(fontRendererObj, "Hello!", 0, 0, -1);
- } // hi
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java b/src/main/java/cc/polyfrost/oneconfig/utils/InputUtils.java
index 80f5175..ee0bafd 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 gg.essential.universal.UResolution;
import org.lwjgl.input.Mouse;
public class InputUtils {
@@ -30,7 +30,7 @@ public class InputUtils {
}
public static int mouseY() {
- if (OneConfigGui.INSTANCE == null) return OneConfig.getDisplayHeight() - Math.abs(Mouse.getY());
- return (int) ((OneConfig.getDisplayHeight() - Math.abs(Mouse.getY())) / OneConfigGui.INSTANCE.getScaleFactor());
+ if (OneConfigGui.INSTANCE == null) return UResolution.getWindowHeight() - Math.abs(Mouse.getY());
+ return (int) ((UResolution.getWindowHeight() - Math.abs(Mouse.getY())) / OneConfigGui.INSTANCE.getScaleFactor());
}
}