aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
index f7f0049f..d0947539 100644
--- a/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
+++ b/src/main/java/io/github/moulberry/notenoughupdates/NEUOverlay.java
@@ -39,6 +39,7 @@ import io.github.moulberry.notenoughupdates.miscfeatures.SunTzu;
import io.github.moulberry.notenoughupdates.miscgui.NeuSearchCalculator;
import io.github.moulberry.notenoughupdates.miscgui.pricegraph.GuiPriceGraph;
import io.github.moulberry.notenoughupdates.options.NEUConfigEditor;
+import io.github.moulberry.notenoughupdates.util.Calculator;
import io.github.moulberry.notenoughupdates.util.Constants;
import io.github.moulberry.notenoughupdates.util.GuiTextures;
import io.github.moulberry.notenoughupdates.util.LerpingFloat;
@@ -86,6 +87,8 @@ import org.lwjgl.util.vector.Vector2f;
import java.awt.*;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
+import java.math.BigDecimal;
+import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Comparator;
import java.util.HashMap;
@@ -103,6 +106,8 @@ import java.util.concurrent.Executors;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.concurrent.atomic.AtomicReference;
+import static io.github.moulberry.notenoughupdates.miscgui.NeuSearchCalculator.PROVIDE_LOWEST_BIN;
+
public class NEUOverlay extends Gui {
private static final ResourceLocation SUPERGEHEIMNISVERMOGEN = new ResourceLocation(
"notenoughupdates:supersecretassets/bald.png");
@@ -1059,6 +1064,14 @@ public class NEUOverlay extends Gui {
return true;
}
+ if (Keyboard.getEventKey() == Keyboard.KEY_RETURN && searchBarHasFocus) {
+ try {
+ BigDecimal calculate = Calculator.calculate(textField.getText(), PROVIDE_LOWEST_BIN);
+ textField.setText(calculate.toPlainString());
+ } catch (Calculator.CalculatorException ignored) {
+ }
+ }
+
if (searchBarHasFocus) {
if (keyPressed == 1) {
searchBarHasFocus = false;