aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/cc')
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java22
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java2
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigKeyBind.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java5
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java16
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java17
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java6
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/InternalConfig.java47
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java28
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/Preferences.java25
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java1
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/config/core/KeyBindHandler.java27
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/gui/BlurHandler.java3
-rw-r--r--src/main/java/cc/polyfrost/oneconfig/internal/plugin/LoadingPlugin.java9
17 files changed, 176 insertions, 46 deletions
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 d62247c..229e4d1 100644
--- a/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
+++ b/src/main/java/cc/polyfrost/oneconfig/config/core/OneKeyBind.java
@@ -5,22 +5,38 @@ import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
import java.util.ArrayList;
public class OneKeyBind {
- private final ArrayList<Integer> keyBinds = new ArrayList<>();
+ protected final ArrayList<Integer> keyBinds = new ArrayList<>();
+ protected final Runnable runnable;
+ protected boolean hasRun;
- public OneKeyBind(int... keys) {
+ public OneKeyBind(Runnable runnable, int... keys) {
+ this.runnable = runnable;
for (int key : keys) {
keyBinds.add(key);
}
}
+ public OneKeyBind(int... keys) {
+ this(null, keys);
+ }
+
public boolean isActive() {
if (keyBinds.size() == 0) return false;
for (int keyBind : keyBinds) {
- if (!UKeyboard.isKeyDown(keyBind)) return false;
+ if (!UKeyboard.isKeyDown(keyBind)) {
+ hasRun = false;
+ return false;
+ }
}
return true;
}
+ public void run() {
+ if (runnable == null || hasRun) return;
+ runnable.run();
+ hasRun = true;
+ }
+
public String getDisplay() {
StringBuilder sb = new StringBuilder();
for (int keyBind : keyBinds) {
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
index bda24a2..4652ae0 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/SideBar.java
@@ -5,7 +5,9 @@ import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
import cc.polyfrost.oneconfig.gui.animations.EaseInOutQuart;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
import cc.polyfrost.oneconfig.gui.pages.CreditsPage;
+import cc.polyfrost.oneconfig.gui.pages.ModConfigPage;
import cc.polyfrost.oneconfig.gui.pages.ModsPage;
+import cc.polyfrost.oneconfig.internal.OneConfig;
import cc.polyfrost.oneconfig.internal.assets.Colors;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
@@ -40,6 +42,7 @@ public class SideBar {
public SideBar() {
buttons.get(0).setClickAction(new CreditsPage());
buttons.get(2).setClickAction(new ModsPage());
+ buttons.get(8).setClickAction(new ModConfigPage(OneConfig.preferences.mod.defaultPage, true));
HUDButton.setClickAction(() -> GuiUtils.displayScreen(new HudGui()));
CloseButton.setClickAction(GuiUtils::closeScreen);
for (BasicButton button : buttons) {
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 e5d187f..ac12f07 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/ModCard.java
@@ -44,6 +44,7 @@ public class ModCard extends BasicElement {
@Override
public void draw(long vg, int x, int y) {
super.update(x, y);
+ String cleanName = modData.name.replaceAll("ยง.", "");
Scissor scissor = ScissorManager.scissor(vg, x, y, width, height);
isHoveredMain = InputUtils.isAreaHovered(x, y, width, 87);
@@ -57,11 +58,11 @@ public class ModCard extends BasicElement {
RenderManager.drawSvg(vg, modData.modIcon, x + 98, y + 19, 48, 48);
else RenderManager.drawImage(vg, modData.modIcon, x + 98, y + 19, 48, 48);
} else {
- RenderManager.drawText(vg, modData.name, x + 122 - RenderManager.getTextWidth(vg, modData.name, 16, Fonts.MINECRAFT_BOLD) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD);
+ RenderManager.drawText(vg, cleanName, x + Math.max(0, (244 - RenderManager.getTextWidth(vg, cleanName, 16, Fonts.MINECRAFT_BOLD))) / 2f, y + 44, ColorUtils.setAlpha(Colors.WHITE, (int) (colorFrame.getAlpha() * 255)), 16, Fonts.MINECRAFT_BOLD);
}
favoriteButton.draw(vg, x + 212, y + 87);
favorite = favoriteButton.isToggled();
- RenderManager.drawText(vg, modData.name, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM);
+ RenderManager.drawText(vg, cleanName, x + 12, y + 103, ColorUtils.setAlpha(Colors.WHITE, (int) (colorToggle.getAlpha() * 255)), 14f, Fonts.MEDIUM);
if (favorite) favoriteButton.setLeftIcon(SVGs.HEART_FILL);
else favoriteButton.setLeftIcon(SVGs.HEART_OUTLINE);
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
index 5efebdd..67488d7 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/elements/config/ConfigColorElement.java
@@ -39,7 +39,7 @@ public class ConfigColorElement extends BasicOption {
public void draw(long vg, int x, int y) {
if (!isEnabled()) RenderManager.setAlpha(vg, 0.5f);
hexField.disable(!isEnabled());
- alphaField.disable(!isEnabled() || allowAlpha);
+ alphaField.disable(!isEnabled() || !allowAlpha);
element.disable(!isEnabled());
int x1 = size == 1 ? x : x + 512;
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 b7d1a68..1aa5d66 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
@@ -6,6 +6,7 @@ import cc.polyfrost.oneconfig.config.core.OneKeyBind;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
+import cc.polyfrost.oneconfig.internal.config.core.KeyBindHandler;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
import cc.polyfrost.oneconfig.internal.assets.SVGs;
@@ -22,6 +23,7 @@ public class ConfigKeyBind extends BasicOption {
super(field, parent, name, category, subcategory, size);
button = new BasicButton(256, 32, "", SVGs.KEYSTROKE, null, BasicButton.ALIGNMENT_JUSTIFIED, ColorPalette.SECONDARY);
button.setToggleable(true);
+ KeyBindHandler.addKeyBind(getKeyBind());
}
public static ConfigKeyBind create(Field field, Object parent) {
@@ -71,6 +73,7 @@ public class ConfigKeyBind extends BasicOption {
private OneKeyBind getKeyBind() {
OneKeyBind keyBind = new OneKeyBind();
try {
+ field.setAccessible(true);
keyBind = (OneKeyBind) get();
} catch (IllegalAccessException ignored) {
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java
index 455a538..a101071 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/CreditsPage.java
@@ -32,4 +32,9 @@ public class CreditsPage extends Page {
RenderManager.drawText(vg, " - Quiltflower (Quilt Team) - Gradle decompiler", x + 20, y + 415, -1, 12, Fonts.REGULAR);
RenderManager.drawText(vg, " - Seraph (Scherso) - Locraw and Multithreading utilities", x + 20, y + 430, -1, 12, Fonts.REGULAR);
}
+
+ @Override
+ public boolean isBase() {
+ return true;
+ }
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
index 3e8fbf8..fb04dc2 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModConfigPage.java
@@ -3,6 +3,7 @@ package cc.polyfrost.oneconfig.gui.pages;
import cc.polyfrost.oneconfig.config.elements.OptionPage;
import cc.polyfrost.oneconfig.config.elements.OptionSubcategory;
import cc.polyfrost.oneconfig.config.elements.BasicOption;
+import cc.polyfrost.oneconfig.gui.animations.DummyAnimation;
import cc.polyfrost.oneconfig.gui.elements.BasicButton;
import cc.polyfrost.oneconfig.renderer.RenderManager;
import cc.polyfrost.oneconfig.renderer.font.Fonts;
@@ -17,10 +18,12 @@ public class ModConfigPage extends Page {
private final ArrayList<BasicButton> categories = new ArrayList<>();
private String selectedCategory;
private int totalSize = 724;
+ private final boolean base;
- public ModConfigPage(OptionPage page) {
+ public ModConfigPage(OptionPage page, boolean base) {
super(page.name);
this.page = page;
+ this.base = base;
if (page.categories.size() == 0) return;
for (String category : page.categories.keySet()) {
selectedCategory = category;
@@ -36,6 +39,10 @@ public class ModConfigPage extends Page {
}
}
+ public ModConfigPage(OptionPage page) {
+ this(page, false);
+ }
+
@Override
public void draw(long vg, int x, int y) {
if (page.categories.size() == 0) return;
@@ -84,6 +91,8 @@ public class ModConfigPage extends Page {
for (BasicButton button : categories) {
if (button.getText().equals(newCategory)) continue;
button.setToggled(false);
+ scrollTarget = 0;
+ scrollAnimation = null;
}
}
@@ -91,4 +100,9 @@ public class ModConfigPage extends Page {
public int getMaxScrollHeight() {
return totalSize;
}
+
+ @Override
+ public boolean isBase() {
+ return base;
+ }
}
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 797512f..10852ab 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/ModsPage.java
@@ -100,8 +100,7 @@ public class ModsPage extends Page {
@Override
public int getMaxScrollHeight() {
- //return size;
- return 3298046;
+ return size;
}
@Override
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 882289d..fff9482 100644
--- a/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
+++ b/src/main/java/cc/polyfrost/oneconfig/gui/pages/Page.java
@@ -16,9 +16,9 @@ import org.lwjgl.input.Mouse;
*/
public abstract class Page {
protected final String title;
- private Animation scrollAnimation;
+ protected Animation scrollAnimation;
private final ColorAnimation colorAnimation = new ColorAnimation(new ColorPalette(Colors.TRANSPARENT, Colors.GRAY_400_60, Colors.GRAY_400_60));
- private float scrollTarget;
+ protected float scrollTarget;
private long scrollTime;
private boolean mouseWasDown, dragging;
private float yStart;
@@ -69,23 +69,24 @@ public abstract class Page {
}
ScissorManager.resetScissor(vg, scissor);
- if(!(scrollBarLength > 727f)) {
+ 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) {
+ final boolean scrollHover = InputUtils.isAreaHovered(x + 1042, (int) (y - scrollBarY), 12, (int) scrollBarLength);
+ final boolean scrollTimePeriod = (System.currentTimeMillis() - scrollTime < 1000);
+ final boolean hovered = (scrollHover || scrollTimePeriod) && Mouse.isButtonDown(0);
+ if (scrollHover && isMouseDown && !mouseWasDown) {
yStart = InputUtils.mouseY();
dragging = true;
}
mouseWasDown = isMouseDown;
- if(dragging) {
+ 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);
+ RenderManager.drawRoundedRect(vg, x + 1044, y - scrollBarY, 8, scrollBarLength, colorAnimation.getColor(scrollHover || scrollTimePeriod, dragging), 4f);
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
index 5f3b669..c3e2750 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/OneConfig.java
@@ -5,12 +5,15 @@ import cc.polyfrost.oneconfig.config.data.ModType;
import cc.polyfrost.oneconfig.events.EventManager;
import cc.polyfrost.oneconfig.internal.command.OneConfigCommand;
import cc.polyfrost.oneconfig.internal.config.OneConfigConfig;
+import cc.polyfrost.oneconfig.internal.config.Preferences;
import cc.polyfrost.oneconfig.internal.config.core.ConfigCore;
+import cc.polyfrost.oneconfig.internal.config.core.KeyBindHandler;
import cc.polyfrost.oneconfig.internal.gui.BlurHandler;
import cc.polyfrost.oneconfig.internal.hud.HudCore;
import cc.polyfrost.oneconfig.utils.commands.CommandManager;
import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
import cc.polyfrost.oneconfig.utils.hypixel.HypixelUtils;
+import net.minecraftforge.common.MinecraftForge;
import net.minecraftforge.fml.common.DummyModContainer;
import net.minecraftforge.fml.common.Loader;
import net.minecraftforge.fml.common.ModContainer;
@@ -33,6 +36,7 @@ public class OneConfig {
public static final List<ModMetadata> loadedOtherMods = new ArrayList<>();
public static final Logger LOGGER = LogManager.getLogger("@NAME@");
public static OneConfigConfig config;
+ public static Preferences preferences;
private static boolean preLaunched = false;
private static boolean initialized = false;
private static boolean isObfuscated = true;
@@ -55,6 +59,7 @@ public class OneConfig {
oneConfigDir.mkdirs();
new File(oneConfigDir, "profiles").mkdirs();
config = new OneConfigConfig();
+ preferences = new Preferences();
preLaunched = true;
}
@@ -70,6 +75,7 @@ public class OneConfig {
CommandManager.INSTANCE.registerCommand(OneConfigCommand.class);
EventManager.INSTANCE.register(new HudCore());
EventManager.INSTANCE.register(HypixelUtils.INSTANCE);
+ MinecraftForge.EVENT_BUS.register(new KeyBindHandler());
reloadModsList();
initialized = true;
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/InternalConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/InternalConfig.java
new file mode 100644
index 0000000..f0b065e
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/InternalConfig.java
@@ -0,0 +1,47 @@
+package cc.polyfrost.oneconfig.internal.config;
+
+import cc.polyfrost.oneconfig.config.Config;
+import cc.polyfrost.oneconfig.config.data.Mod;
+import cc.polyfrost.oneconfig.utils.JsonUtils;
+
+import java.io.*;
+import java.nio.charset.StandardCharsets;
+import java.nio.file.Files;
+import java.nio.file.Paths;
+
+public abstract class InternalConfig extends Config {
+ /**
+ * @param title title that is displayed
+ * @param configFile file where config is stored
+ */
+ public InternalConfig(String title, String configFile) {
+ super(new Mod(title, null), configFile);
+ }
+
+ @Override
+ public void init(Mod mod) {
+ if (new File("OneConfig/" + configFile).exists()) load();
+ else save();
+ generateOptionList(this, mod.defaultPage, mod, false);
+ mod.config = this;
+ this.mod = mod;
+ }
+
+ @Override
+ public void save() {
+ try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
+ writer.write(gson.toJson(this));
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+
+ @Override
+ public void load() {
+ try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
+ deserializePart(JsonUtils.PARSER.parse(reader).getAsJsonObject(), this);
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java
index a0e25fc..1986e9e 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/OneConfigConfig.java
@@ -11,7 +11,7 @@ import java.nio.file.Files;
import java.nio.file.Paths;
import java.util.ArrayList;
-public class OneConfigConfig extends Config {
+public class OneConfigConfig extends InternalConfig {
public static String currentProfile = "Default Profile";
public static boolean autoUpdate = true;
/**
@@ -26,30 +26,6 @@ public class OneConfigConfig extends Config {
public static boolean australia = false;
public OneConfigConfig() {
- super(null, "OneConfig.json");
- }
-
- @Override
- public void init(Mod mod) {
- if (new File("OneConfig/" + configFile).exists()) load();
- else save();
- }
-
- @Override
- public void save() {
- try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(Files.newOutputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
- writer.write(gson.toJson(this));
- } catch (IOException e) {
- e.printStackTrace();
- }
- }
-
- @Override
- public void load() {
- try (BufferedReader reader = new BufferedReader(new InputStreamReader(Files.newInputStream(Paths.get("OneConfig/" + configFile)), StandardCharsets.UTF_8))) {
- deserializePart(JsonUtils.PARSER.parse(reader).getAsJsonObject(), this);
- } catch (IOException e) {
- e.printStackTrace();
- }
+ super("", "OneConfig.json");
}
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/Preferences.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/Preferences.java
new file mode 100644
index 0000000..10c14a8
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/Preferences.java
@@ -0,0 +1,25 @@
+package cc.polyfrost.oneconfig.internal.config;
+
+import cc.polyfrost.oneconfig.config.annotations.KeyBind;
+import cc.polyfrost.oneconfig.config.annotations.Switch;
+import cc.polyfrost.oneconfig.config.core.OneKeyBind;
+import cc.polyfrost.oneconfig.gui.OneConfigGui;
+import cc.polyfrost.oneconfig.libs.universal.UKeyboard;
+import cc.polyfrost.oneconfig.utils.gui.GuiUtils;
+
+public class Preferences extends InternalConfig {
+ @Switch(
+ name = "Enable Blur"
+ )
+ public static boolean enableBlur = true;
+
+ @KeyBind(
+ name = "OneConfig Keybind",
+ size = 2
+ )
+ public static OneKeyBind oneConfigKeyBind = new OneKeyBind(() -> GuiUtils.displayScreen(OneConfigGui.create()), UKeyboard.KEY_RSHIFT);
+
+ public Preferences() {
+ super("Preferences", "Preferences.json");
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java
index 02ac8f8..5a9dd0b 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/core/ConfigCore.java
@@ -18,6 +18,7 @@ public class ConfigCore {
ArrayList<Mod> data = new ArrayList<>(oneConfigMods);
oneConfigMods.clear();
HudCore.huds.clear();
+ KeyBindHandler.clearKeyBinds();
for (Mod modData : data) {
modData.config.init(modData);
}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/config/core/KeyBindHandler.java b/src/main/java/cc/polyfrost/oneconfig/internal/config/core/KeyBindHandler.java
new file mode 100644
index 0000000..da82951
--- /dev/null
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/config/core/KeyBindHandler.java
@@ -0,0 +1,27 @@
+package cc.polyfrost.oneconfig.internal.config.core;
+
+import cc.polyfrost.oneconfig.config.core.OneKeyBind;
+import net.minecraftforge.fml.common.eventhandler.SubscribeEvent;
+import net.minecraftforge.fml.common.gameevent.InputEvent;
+
+import java.util.ArrayList;
+
+public class KeyBindHandler {
+ private static final ArrayList<OneKeyBind> keyBinds = new ArrayList<>();
+
+ @SubscribeEvent
+ public void onKeyPressed(InputEvent.KeyInputEvent event) {
+ for (OneKeyBind keyBind : keyBinds) {
+ if (keyBind.isActive()) keyBind.run();
+ }
+ }
+
+ public static void addKeyBind(OneKeyBind keyBind) {
+ if (keyBind == null) return;
+ keyBinds.add(keyBind);
+ }
+
+ public static void clearKeyBinds() {
+ keyBinds.clear();
+ }
+}
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/gui/BlurHandler.java b/src/main/java/cc/polyfrost/oneconfig/internal/gui/BlurHandler.java
index 4aa94d9..697f2d4 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/gui/BlurHandler.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/gui/BlurHandler.java
@@ -5,6 +5,7 @@ import cc.polyfrost.oneconfig.events.event.RenderEvent;
import cc.polyfrost.oneconfig.events.event.ScreenOpenEvent;
import cc.polyfrost.oneconfig.events.event.Stage;
import cc.polyfrost.oneconfig.gui.OneConfigGui;
+import cc.polyfrost.oneconfig.internal.config.Preferences;
import cc.polyfrost.oneconfig.internal.mixin.ShaderGroupAccessor;
import cc.polyfrost.oneconfig.libs.universal.UMinecraft;
import cc.polyfrost.oneconfig.libs.universal.UScreen;
@@ -119,7 +120,7 @@ public class BlurHandler {
// If a shader is not already active and the UI is
// a one of ours, we should load our own blur!
- if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive() && gui instanceof OneConfigGui) {
+ if (!UMinecraft.getMinecraft().entityRenderer.isShaderActive() && gui instanceof OneConfigGui && Preferences.enableBlur) {
UMinecraft.getMinecraft().entityRenderer.loadShader(this.blurShader);
this.start = System.currentTimeMillis();
diff --git a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/LoadingPlugin.java b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/LoadingPlugin.java
index 825dab8..cdd0d83 100644
--- a/src/main/java/cc/polyfrost/oneconfig/internal/plugin/LoadingPlugin.java
+++ b/src/main/java/cc/polyfrost/oneconfig/internal/plugin/LoadingPlugin.java
@@ -4,12 +4,13 @@ import cc.polyfrost.oneconfig.internal.init.OneConfigInit;
import cc.polyfrost.oneconfig.internal.plugin.asm.ClassTransformer;
import net.minecraft.launchwrapper.Launch;
import net.minecraft.launchwrapper.LaunchClassLoader;
+import net.minecraftforge.fml.relauncher.IFMLLoadingPlugin;
import java.lang.reflect.Field;
import java.util.Map;
import java.util.Set;
-public class LoadingPlugin {
+public class LoadingPlugin implements IFMLLoadingPlugin {
/**
* Taken from LWJGLTwoPointFive under The Unlicense
@@ -28,23 +29,27 @@ public class LoadingPlugin {
}
}
+ @Override
public String[] getASMTransformerClass() {
Launch.blackboard.put("oneconfig.init.registered_transformer", true);
return new String[]{ClassTransformer.class.getName()};
}
+ @Override
public String getModContainerClass() {
return null;
}
+ @Override
public String getSetupClass() {
return null;
}
+ @Override
public void injectData(Map<String, Object> data) {
-
}
+ @Override
public String getAccessTransformerClass() {
return null;
}