shift-click in GUI to jump 5 increments
This commit is contained in:
@@ -2,6 +2,8 @@ package mods.betterfoliage.client.gui;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.lwjgl.input.Keyboard;
|
||||
|
||||
import mods.betterfoliage.client.gui.widget.IOptionWidget;
|
||||
import net.minecraft.client.gui.GuiButton;
|
||||
import net.minecraft.client.gui.GuiScreen;
|
||||
@@ -51,7 +53,7 @@ public class ConfigGuiScreenBase extends GuiScreen {
|
||||
@Override
|
||||
protected void actionPerformed(GuiButton button) {
|
||||
super.actionPerformed(button);
|
||||
for (IOptionWidget widget : widgets) widget.onAction(button.id);
|
||||
for (IOptionWidget widget : widgets) widget.onAction(button.id, Keyboard.isKeyDown(42));
|
||||
onButtonPress(button.id);
|
||||
updateButtons();
|
||||
}
|
||||
|
||||
@@ -14,6 +14,6 @@ public interface IOptionWidget {
|
||||
|
||||
public void addButtons(List<GuiButton> buttonList, int xOffset, int yOffset);
|
||||
public void drawStrings(GuiScreen screen, FontRenderer fontRenderer, int xOffset, int yOffset, int labelColor, int numColor);
|
||||
public void onAction(int buttonId);
|
||||
public void onAction(int buttonId, boolean shiftPressed);
|
||||
|
||||
}
|
||||
@@ -46,8 +46,8 @@ public class OptionDoubleWidget implements IOptionWidget {
|
||||
screen.drawCenteredString(fontRenderer, String.format(formatString, option.value), xOffset + x + width - 20 - numWidth / 2, yOffset + y + 5, numColor);
|
||||
}
|
||||
|
||||
public void onAction(int buttonId) {
|
||||
if (buttonId == idDecrement) option.decrement();
|
||||
if (buttonId == idIncrement) option.increment();
|
||||
public void onAction(int buttonId, boolean shiftPressed) {
|
||||
if (buttonId == idDecrement) option.decrement(shiftPressed ? 5 :1);
|
||||
if (buttonId == idIncrement) option.increment(shiftPressed ? 5 :1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,8 +43,8 @@ public class OptionIntegerWidget implements IOptionWidget {
|
||||
screen.drawCenteredString(fontRenderer, Integer.toString(option.value), xOffset + x + width - 20 - numWidth / 2, yOffset + y + 5, numColor);
|
||||
}
|
||||
|
||||
public void onAction(int buttonId) {
|
||||
if (buttonId == idDecrement) option.decrement();
|
||||
if (buttonId == idIncrement) option.increment();
|
||||
public void onAction(int buttonId, boolean shiftPressed) {
|
||||
if (buttonId == idDecrement) option.decrement(shiftPressed ? 5 :1);
|
||||
if (buttonId == idIncrement) option.increment(shiftPressed ? 5 :1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ public class OptionDouble {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void increment() {
|
||||
value += step;
|
||||
public void increment(int times) {
|
||||
value += times * step;
|
||||
if (value > max) value = max;
|
||||
}
|
||||
|
||||
public void decrement() {
|
||||
value -= step;
|
||||
public void decrement(int times) {
|
||||
value -= times * step;
|
||||
if (value < min) value = min;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,13 +14,13 @@ public class OptionInteger {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
public void increment() {
|
||||
value += step;
|
||||
public void increment(int times) {
|
||||
value += times * step;
|
||||
if (value > max) value = max;
|
||||
}
|
||||
|
||||
public void decrement() {
|
||||
value -= step;
|
||||
public void decrement(int times) {
|
||||
value -= times * step;
|
||||
if (value < min) value = min;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user