mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-18 11:29:35 +00:00
Update buildscript & apply automatic formatting rules
This commit is contained in:
1 parent
a7683b885d
commit
f7a900e910
173 files changed
+4581
-5321
No files matched your search
@@ -1,24 +1,22 @@
|
||||
package codechicken.nei.config;
|
||||
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.TextField;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import static codechicken.lib.gui.GuiDraw.drawString;
|
||||
import static codechicken.lib.gui.GuiDraw.getStringWidth;
|
||||
|
||||
public class OptionTextField extends Option
|
||||
{
|
||||
import codechicken.lib.vec.Rectangle4i;
|
||||
import codechicken.nei.TextField;
|
||||
import codechicken.nei.config.GuiOptionList.OptionScrollSlot;
|
||||
import java.util.List;
|
||||
|
||||
public class OptionTextField extends Option {
|
||||
private boolean focused = false;
|
||||
private TextField textField = new TextField("test")
|
||||
{
|
||||
private TextField textField = new TextField("test") {
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if(focused() && isValidValue(text()))
|
||||
if(!defaulting() || !text().equals(getTag().getValue())) //don't override global if text hasn't changed
|
||||
getTag().setValue(text());
|
||||
if (focused() && isValidValue(text()))
|
||||
if (!defaulting()
|
||||
|| !text().equals(getTag().getValue())) // don't override global if text hasn't changed
|
||||
getTag().setValue(text());
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -28,8 +26,7 @@ public class OptionTextField extends Option
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus) {
|
||||
if (!focus && !isValidValue(text()))
|
||||
setText(renderTag().getValue());
|
||||
if (!focus && !isValidValue(text())) setText(renderTag().getValue());
|
||||
|
||||
focused = focus;
|
||||
}
|
||||
@@ -48,8 +45,7 @@ public class OptionTextField extends Option
|
||||
@Override
|
||||
public void update() {
|
||||
textField.update();
|
||||
if(!textField.focused())
|
||||
textField.setText(renderTag().getValue());
|
||||
if (!textField.focused()) textField.setText(renderTag().getValue());
|
||||
}
|
||||
|
||||
public String getPrefix() {
|
||||
@@ -72,8 +68,7 @@ public class OptionTextField extends Option
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mousex, int mousey, int button) {
|
||||
if (textField.contains(mousex, mousey))
|
||||
textField.handleClick(mousex, mousey, button);
|
||||
if (textField.contains(mousex, mousey)) textField.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -85,8 +80,7 @@ public class OptionTextField extends Option
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
|
||||
if (new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
String tip = translateN(name + ".tip");
|
||||
if (!tip.equals(name + ".tip"))
|
||||
currenttip.add(tip);
|
||||
if (!tip.equals(name + ".tip")) currenttip.add(tip);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user