mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-19 20:00:00 +00:00
Cleaned and generalised item loading/searching
Reimplemented subsets Added regex searching Fixed format error on delete all Fixed GuiButton handling clicks before NEI widgets could override Re-Implemented banned blocks implementation Added brewing recipes again note test obf ASM beacons Fixed some calls being intercepted by item panel when mouse was over a gui element Fixed crash on closing potion window with escape Disabled fast transfer, scrolling, and drag 'n' drop in creative Added item panel sorting Removed TMI uninstaller Fixed /give command Updated to 1.7.10
This commit is contained in:
1 parent
3c9ebc6961
commit
3c84527806
67 files changed
+3251
-2319
No files matched your search
@@ -15,96 +15,94 @@ public class OptionTextField extends Option
|
||||
private TextField textField = new TextField("")
|
||||
{
|
||||
@Override
|
||||
public void onTextChange(String oldText)
|
||||
{
|
||||
if(!text().equals(renderTag().getValue()))
|
||||
public boolean isValid(String string) {
|
||||
return super.isValid(string) && isValidInput(string);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if(focused() && isValidValue(text()))
|
||||
getTag().setValue(text());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean focused()
|
||||
{
|
||||
public boolean focused() {
|
||||
return focused;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFocus(boolean focus)
|
||||
{
|
||||
if(focus == true && renderDefault())
|
||||
public void setFocus(boolean focus) {
|
||||
if (focus && defaulting())
|
||||
return;
|
||||
|
||||
|
||||
if (!focus && !isValidValue(text()))
|
||||
setText(getTag().getValue());
|
||||
|
||||
focused = focus;
|
||||
}
|
||||
};
|
||||
|
||||
public OptionTextField(String name)
|
||||
{
|
||||
|
||||
public OptionTextField(String name) {
|
||||
super(name);
|
||||
textField.height = 20;
|
||||
textField.y = 2;
|
||||
textField.h = 20;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onAdded(OptionScrollSlot slot)
|
||||
{
|
||||
public void onAdded(OptionScrollSlot slot) {
|
||||
super.onAdded(slot);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void update()
|
||||
{
|
||||
textField.setText(renderText());
|
||||
public void update() {
|
||||
textField.update();
|
||||
if(!textField.focused())
|
||||
textField.setText(renderTag().getValue());
|
||||
}
|
||||
|
||||
public String getPrefix()
|
||||
{
|
||||
|
||||
public String getPrefix() {
|
||||
return translateN(name);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey, float frame)
|
||||
{
|
||||
drawString(getPrefix(), 10, 8, -1);
|
||||
|
||||
textField.setText(renderText());
|
||||
textField.width = slot.contentWidth()-getStringWidth(getPrefix())-16;
|
||||
textField.x = slot.contentWidth()-textField.width;
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
drawString(getPrefix(), 10, 6, -1);
|
||||
|
||||
textField.w = slot.slotWidth() - getStringWidth(getPrefix()) - 16;
|
||||
textField.x = slot.slotWidth() - textField.w;
|
||||
textField.draw(mousex, mousey);
|
||||
}
|
||||
|
||||
public String renderText()
|
||||
{
|
||||
return renderTag().getValue();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int keycode)
|
||||
{
|
||||
public void keyTyped(char c, int keycode) {
|
||||
textField.handleKeyPress(keycode, c);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mousex, int mousey, int button)
|
||||
{
|
||||
if(textField.contains(mousex, mousey))
|
||||
public void mouseClicked(int mousex, int mousey, int button) {
|
||||
if (textField.contains(mousex, mousey))
|
||||
textField.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMouseClicked(int mousex, int mousey, int button)
|
||||
{
|
||||
public void onMouseClicked(int mousex, int mousey, int button) {
|
||||
textField.onGuiClick(mousex, mousey);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip)
|
||||
{
|
||||
if(new Rectangle4i(10, 2, textField.x-10, 20).contains(mousex, mousey))
|
||||
{
|
||||
String tip = translateN(name+".tip");
|
||||
if(!tip.equals(name+".tip"))
|
||||
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);
|
||||
}
|
||||
return currenttip;
|
||||
}
|
||||
|
||||
public boolean isValidInput(String s) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isValidValue(String s) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user