mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 16:37:45 +00:00
* Update build script * Update build script to import fix for shadow in dev and sources artifacts * Update fixed build script to shadow csv dependency in dev jar as well * Moved jitpack * Move new files
39 lines
794 B
Java
39 lines
794 B
Java
package codechicken.nei;
|
|
|
|
public class ItemQuantityField extends TextField
|
|
{
|
|
public ItemQuantityField(String ident) {
|
|
super(ident);
|
|
centered = true;
|
|
}
|
|
|
|
public int intValue() {
|
|
return intValue(text());
|
|
}
|
|
|
|
public int intValue(String s) {
|
|
try {
|
|
return Math.max(0, Integer.parseInt(s));
|
|
} catch (NumberFormatException nfe) {
|
|
return 0;
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void gainFocus() {
|
|
if (text().equals("0")) {
|
|
setText("");
|
|
}
|
|
}
|
|
|
|
@Override
|
|
public void loseFocus() {
|
|
setText(Integer.toString(NEIClientConfig.getItemQuantity()));
|
|
}
|
|
|
|
@Override
|
|
public void onTextChange(String oldText) {
|
|
NEIClientUtils.setItemQuantity(intValue());
|
|
}
|
|
}
|