mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-13 00:47:35 +00:00
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
45 lines
1003 B
Java
45 lines
1003 B
Java
package codechicken.nei;
|
|
|
|
public class ItemQuantityField extends TextField
|
|
{
|
|
public ItemQuantityField(String ident) {
|
|
super(ident);
|
|
centered = true;
|
|
}
|
|
|
|
@Override
|
|
public boolean isValid(String string) {
|
|
if (string.equals(""))
|
|
return true;
|
|
|
|
try {
|
|
return Integer.parseInt(string) >= 0;
|
|
} catch (NumberFormatException nfe) {
|
|
return false;
|
|
}
|
|
}
|
|
|
|
public int intValue() {
|
|
return intValue(text());
|
|
}
|
|
|
|
public int intValue(String s) {
|
|
try {
|
|
return Integer.parseInt(s);
|
|
} catch (NumberFormatException nfe) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void loseFocus() {
|
|
setText(Integer.toString(NEIClientConfig.getItemQuantity()));
|
|
}
|
|
|
|
@Override
|
|
public void onTextChange(String oldText) {
|
|
if (intValue(oldText) != intValue())//hacky recursion stopper
|
|
NEIClientUtils.setItemQuantity(intValue());
|
|
}
|
|
}
|