Formatting fixes
This commit is contained in:
@@ -1,10 +1,7 @@
|
||||
package appeng.client.gui;
|
||||
|
||||
public enum NumberEntryType {
|
||||
CRAFT_ITEM_COUNT(Long.class),
|
||||
PRIORITY(Long.class),
|
||||
LEVEL_ITEM_COUNT(Long.class),
|
||||
LEVEL_FLUID_VOLUME(Long.class);
|
||||
CRAFT_ITEM_COUNT(Long.class), PRIORITY(Long.class), LEVEL_ITEM_COUNT(Long.class), LEVEL_FLUID_VOLUME(Long.class);
|
||||
|
||||
private final Class<? extends Number> inputType;
|
||||
|
||||
|
||||
@@ -45,7 +45,8 @@ public class CraftAmountScreen extends AEBaseScreen<CraftAmountContainer> {
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.amountToCraft = new NumberEntryWidget(this, 20, 30, 138, 62, NumberEntryType.CRAFT_ITEM_COUNT, value -> {});
|
||||
this.amountToCraft = new NumberEntryWidget(this, 20, 30, 138, 62, NumberEntryType.CRAFT_ITEM_COUNT, value -> {
|
||||
});
|
||||
this.amountToCraft.setValue(1);
|
||||
this.amountToCraft.setTextFieldBounds(62, 57, 50);
|
||||
this.amountToCraft.setMinValue(1);
|
||||
|
||||
@@ -49,7 +49,8 @@ public class LevelEmitterScreen extends UpgradeableScreen<LevelEmitterContainer>
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.level = new NumberEntryWidget(this, 20, 17, 138, 62, NumberEntryType.LEVEL_ITEM_COUNT, this::onLevelChange);
|
||||
this.level = new NumberEntryWidget(this, 20, 17, 138, 62, NumberEntryType.LEVEL_ITEM_COUNT,
|
||||
this::onLevelChange);
|
||||
this.level.setTextFieldBounds(25, 44, 75);
|
||||
this.level.addButtons(children::add, this::addButton);
|
||||
container.setTextField(this.level);
|
||||
|
||||
@@ -13,8 +13,8 @@ import java.util.function.Consumer;
|
||||
import java.util.function.LongConsumer;
|
||||
|
||||
/**
|
||||
* A utility widget that consists of a text-field to enter a number with attached buttons to
|
||||
* increment/decrement the number in fixed intervals.
|
||||
* A utility widget that consists of a text-field to enter a number with
|
||||
* attached buttons to increment/decrement the number in fixed intervals.
|
||||
*/
|
||||
public class NumberEntryWidget implements ITickingWidget {
|
||||
|
||||
@@ -34,9 +34,8 @@ public class NumberEntryWidget implements ITickingWidget {
|
||||
private Button minus100;
|
||||
private Button minus1000;
|
||||
|
||||
public NumberEntryWidget(AEBaseScreen<?> parent, int x, int y, int width, int height,
|
||||
NumberEntryType type,
|
||||
LongConsumer changeListener) {
|
||||
public NumberEntryWidget(AEBaseScreen<?> parent, int x, int y, int width, int height, NumberEntryType type,
|
||||
LongConsumer changeListener) {
|
||||
this.parent = parent;
|
||||
this.x = x;
|
||||
this.y = y;
|
||||
@@ -87,24 +86,17 @@ public class NumberEntryWidget implements ITickingWidget {
|
||||
int top = parent.getGuiTop() + y;
|
||||
|
||||
addButton.accept(this.plus1 = new Button(left, top, 22, 20, "+" + a, btn -> addQty(a)));
|
||||
addButton.accept(
|
||||
this.plus10 = new Button(left + 28, top, 28, 20, "+" + b, btn -> addQty(b)));
|
||||
addButton.accept(
|
||||
this.plus100 = new Button(left + 62, top, 32, 20, "+" + c, btn -> addQty(c)));
|
||||
addButton.accept(
|
||||
this.plus1000 = new Button(left + 100, top, 38, 20, "+" + d, btn -> addQty(d)));
|
||||
addButton.accept(this.plus10 = new Button(left + 28, top, 28, 20, "+" + b, btn -> addQty(b)));
|
||||
addButton.accept(this.plus100 = new Button(left + 62, top, 32, 20, "+" + c, btn -> addQty(c)));
|
||||
addButton.accept(this.plus1000 = new Button(left + 100, top, 38, 20, "+" + d, btn -> addQty(d)));
|
||||
|
||||
// Placing this here will give a sensible tab order
|
||||
addChildren.accept(this.level);
|
||||
|
||||
addButton.accept(
|
||||
this.minus1 = new Button(left, top + 42, 22, 20, "-" + a, btn -> addQty(-a)));
|
||||
addButton.accept(
|
||||
this.minus10 = new Button(left + 28, top + 42, 28, 20, "-" + b, btn -> addQty(-b)));
|
||||
addButton.accept(
|
||||
this.minus100 = new Button(left + 62, top + 42, 32, 20, "-" + c, btn -> addQty(-c)));
|
||||
addButton.accept(
|
||||
this.minus1000 = new Button(left + 100, top + 42, 38, 20, "-" + d, btn -> addQty(-d)));
|
||||
addButton.accept(this.minus1 = new Button(left, top + 42, 22, 20, "-" + a, btn -> addQty(-a)));
|
||||
addButton.accept(this.minus10 = new Button(left + 28, top + 42, 28, 20, "-" + b, btn -> addQty(-b)));
|
||||
addButton.accept(this.minus100 = new Button(left + 62, top + 42, 32, 20, "-" + c, btn -> addQty(-c)));
|
||||
addButton.accept(this.minus1000 = new Button(left + 100, top + 42, 38, 20, "-" + d, btn -> addQty(-d)));
|
||||
}
|
||||
|
||||
private void addQty(final long i) {
|
||||
|
||||
@@ -52,7 +52,8 @@ public class PriorityScreen extends AEBaseScreen<PriorityContainer> {
|
||||
}
|
||||
|
||||
private void onPriorityChange(long priority) {
|
||||
NetworkHandler.instance().sendToServer(new ConfigValuePacket("PriorityHost.Priority", String.valueOf(priority)));
|
||||
NetworkHandler.instance()
|
||||
.sendToServer(new ConfigValuePacket("PriorityHost.Priority", String.valueOf(priority)));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -3,8 +3,8 @@ package appeng.client.gui.widgets;
|
||||
import net.minecraft.client.gui.screen.Screen;
|
||||
|
||||
/**
|
||||
* Indicates that a widget (anything that is in the {@link Screen#children()} list) should receive callbacks every
|
||||
* tick.
|
||||
* Indicates that a widget (anything that is in the {@link Screen#children()}
|
||||
* list) should receive callbacks every tick.
|
||||
*/
|
||||
public interface ITickingWidget {
|
||||
|
||||
|
||||
@@ -34,7 +34,7 @@ public class NumberBox extends TextFieldWidget {
|
||||
private long maxValue;
|
||||
|
||||
public NumberBox(final FontRenderer fontRenderer, final int x, final int y, final int width, final int height,
|
||||
final Class<?> type, LongConsumer changeListener) {
|
||||
final Class<?> type, LongConsumer changeListener) {
|
||||
super(fontRenderer, x, y, width, height, "0");
|
||||
this.setText("0");
|
||||
setResponder(this::onTextChanged);
|
||||
@@ -128,7 +128,8 @@ public class NumberBox extends TextFieldWidget {
|
||||
return true;
|
||||
}
|
||||
|
||||
// Swallow key presses for numbers because they would otherwise trigger the hotbar swapping unintentionally
|
||||
// Swallow key presses for numbers because they would otherwise trigger the
|
||||
// hotbar swapping unintentionally
|
||||
return isFocused() && p_keyPressed_1_ >= '0' && p_keyPressed_1_ <= '9';
|
||||
}
|
||||
|
||||
|
||||
@@ -28,7 +28,8 @@ public class FluidLevelEmitterScreen extends UpgradeableScreen<FluidLevelEmitter
|
||||
public void init() {
|
||||
super.init();
|
||||
|
||||
this.level = new NumberEntryWidget(this, 20, 17, 138, 62, NumberEntryType.LEVEL_FLUID_VOLUME, this::onLevelChange);
|
||||
this.level = new NumberEntryWidget(this, 20, 17, 138, 62, NumberEntryType.LEVEL_FLUID_VOLUME,
|
||||
this::onLevelChange);
|
||||
this.level.setTextFieldBounds(25, 44, 75);
|
||||
container.setTextField(this.level);
|
||||
this.level.addButtons(children::add, this::addButton);
|
||||
|
||||
Reference in New Issue
Block a user