mirror of
https://github.com/GTNewHorizons/NotEnoughItems.git
synced 2026-11-12 16:37:45 +00:00
Add option to adjust FPS rendering of items (#612)
Co-authored-by: slprime <history-21@yandex.ru> Co-authored-by: Martin Robertz <dream-master@gmx.net>
This commit is contained in:
3 files changed
+29
-4
No files matched your search
@@ -355,6 +355,15 @@ public class NEIClientConfig {
|
||||
tag.getTag("inventory.gridRenderingCacheMode").getIntValue(0);
|
||||
API.addOption(new OptionCycled("inventory.gridRenderingCacheMode", 3, true));
|
||||
|
||||
tag.getTag("inventory.gridRenderingCacheFPS").getIntValue(8);
|
||||
API.addOption(new OptionIntegerField("inventory.gridRenderingCacheFPS", 1, 144) {
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return OpenGlHelper.framebufferSupported && getIntSetting("inventory.gridRenderingCacheMode") == 1;
|
||||
}
|
||||
|
||||
});
|
||||
tag.getTag("inventory.hotkeysHelpText").getBooleanValue(true);
|
||||
API.addOption(new OptionToggleButton("inventory.hotkeysHelpText", true));
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ import codechicken.nei.TextField;
|
||||
|
||||
public class OptionTextField extends Option {
|
||||
|
||||
protected final TextField textField = new TextField("test") {
|
||||
protected final TextField textField = new TextField("option-text-field") {
|
||||
|
||||
{
|
||||
this.h = 20;
|
||||
@@ -19,6 +19,7 @@ public class OptionTextField extends Option {
|
||||
// don't override global if text hasn't changed
|
||||
if (focused() && isValidValue(text()) && (!defaulting() || !text().equals(getTag().getValue()))) {
|
||||
getTag().setValue(text());
|
||||
OptionTextField.this.onTextChange(text());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -27,12 +28,20 @@ public class OptionTextField extends Option {
|
||||
if (!focus && !isValidValue(text())) setText(renderTag().getValue());
|
||||
super.setFocus(focus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey) {
|
||||
this.field.setEnabled(isEnabled());
|
||||
super.draw(mousex, mousey);
|
||||
}
|
||||
};
|
||||
|
||||
public OptionTextField(String name) {
|
||||
super(name);
|
||||
}
|
||||
|
||||
public void onTextChange(String text) {}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
textField.update();
|
||||
@@ -47,6 +56,10 @@ public class OptionTextField extends Option {
|
||||
return slot.slotWidth();
|
||||
}
|
||||
|
||||
public boolean isEnabled() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void draw(int mousex, int mousey, float frame) {
|
||||
GuiDraw.drawString(getPrefix(), 10, 6, -1);
|
||||
@@ -59,12 +72,14 @@ public class OptionTextField extends Option {
|
||||
|
||||
@Override
|
||||
public void keyTyped(char c, int keycode) {
|
||||
textField.handleKeyPress(keycode, c);
|
||||
if (isEnabled()) {
|
||||
textField.handleKeyPress(keycode, c);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void mouseClicked(int mousex, int mousey, int button) {
|
||||
if (textField.contains(mousex, mousey)) textField.handleClick(mousex, mousey, button);
|
||||
if (isEnabled() && textField.contains(mousex, mousey)) textField.handleClick(mousex, mousey, button);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -74,7 +89,7 @@ public class OptionTextField extends Option {
|
||||
|
||||
@Override
|
||||
public List<String> handleTooltip(int mousex, int mousey, List<String> currenttip) {
|
||||
if (new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
if (isEnabled() && new Rectangle4i(10, 0, textField.x - 10, 20).contains(mousex, mousey)) {
|
||||
String tip = translateN(name + ".tip");
|
||||
if (!tip.equals(namespaced(name + ".tip"))) currenttip.add(tip);
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user