mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-16 18:54:45 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd18d2b775 |
No files matched your search
+1
-1
@@ -2,4 +2,4 @@ mc_version=1.7.10
|
||||
forge_version=10.13.4.1614-1.7.10
|
||||
ccl_version=1.1.3.138
|
||||
ccc_version=1.0.7.+
|
||||
mod_version=2.1.9-GTNH
|
||||
mod_version=2.1.10-GTNH
|
||||
@@ -7,30 +7,25 @@ public class ItemQuantityField extends TextField
|
||||
centered = true;
|
||||
}
|
||||
|
||||
// Find a way to work this back in
|
||||
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);
|
||||
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()));
|
||||
@@ -38,7 +33,6 @@ public class ItemQuantityField extends TextField
|
||||
|
||||
@Override
|
||||
public void onTextChange(String oldText) {
|
||||
if (intValue(oldText) != intValue())//hacky recursion stopper
|
||||
NEIClientUtils.setItemQuantity(intValue());
|
||||
NEIClientUtils.setItemQuantity(intValue());
|
||||
}
|
||||
}
|
||||
@@ -423,7 +423,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
|
||||
setItemQuantity(quantity);
|
||||
LayoutManager.quantity.setText(Integer.toString(quantity));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -440,7 +440,7 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
if (quantity < 0)
|
||||
quantity = 0;
|
||||
|
||||
setItemQuantity(quantity);
|
||||
LayoutManager.quantity.setText(Integer.toString(quantity));
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -626,8 +626,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
@Override
|
||||
public void load(GuiContainer gui) {
|
||||
if (isEnabled()) {
|
||||
setInputFocused(null);
|
||||
|
||||
if(!itemsLoaded) {
|
||||
ItemList.loadItems.restart();
|
||||
itemsLoaded = true;
|
||||
@@ -762,19 +760,6 @@ public class LayoutManager implements IContainerInputHandler, IContainerTooltipH
|
||||
return itemPanel.draggedStack == null;
|
||||
}
|
||||
|
||||
public static Widget getInputFocused() {
|
||||
return inputFocused;
|
||||
}
|
||||
|
||||
public static void setInputFocused(Widget widget) {
|
||||
if (inputFocused != null)
|
||||
inputFocused.loseFocus();
|
||||
|
||||
inputFocused = widget;
|
||||
if (inputFocused != null)
|
||||
inputFocused.gainFocus();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void renderSlotUnderlay(GuiContainer gui, Slot slot) {
|
||||
if (overlayRenderer != null)
|
||||
|
||||
@@ -352,7 +352,6 @@ public class NEIClientUtils extends NEIServerUtils
|
||||
public static void setItemQuantity(int i) {
|
||||
world.nbt.setInteger("quantity", i);
|
||||
world.saveNBT();
|
||||
LayoutManager.quantity.setText(Integer.toString(i));
|
||||
}
|
||||
|
||||
public static GuiContainer getGuiContainer() {
|
||||
|
||||
@@ -121,8 +121,10 @@ public abstract class TextField extends Widget
|
||||
if (focus) {
|
||||
previousKeyboardRepeatEnabled = Keyboard.areRepeatEventsEnabled();
|
||||
Keyboard.enableRepeatEvents(true);
|
||||
gainFocus();
|
||||
} else {
|
||||
Keyboard.enableRepeatEvents(previousKeyboardRepeatEnabled);
|
||||
loseFocus();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user