aboutsummaryrefslogtreecommitdiff
path: root/src/main/java/cc/polyfrost/oneconfig/gui/elements
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/polyfrost/oneconfig/gui/elements
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/polyfrost/oneconfig/gui/elements')
-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
2 files changed, 6 insertions, 4 deletions
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;
+ }
}