use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber in project pnc-repressurized by TeamPneumatic.
the class GuiAmadronAddTrade method initGui.
@Override
public void initGui() {
super.initGui();
ContainerAmadronAddTrade container = (ContainerAmadronAddTrade) inventorySlots;
addLabel(I18n.format("gui.amadron.addTrade.selling"), guiLeft + 4, guiTop + 5);
addLabel(I18n.format("gui.amadron.addTrade.buying"), guiLeft + 93, guiTop + 5);
buttonList.add(new GuiButton(0, guiLeft + 4, guiTop + 20, 85, 20, "Search item..."));
buttonList.add(new GuiButton(1, guiLeft + 4, guiTop + 42, 85, 20, "Search inv..."));
buttonList.add(new GuiButton(2, guiLeft + 4, guiTop + 64, 85, 20, "Search fluid..."));
buttonList.add(new GuiButton(3, guiLeft + 93, guiTop + 20, 85, 20, "Search item..."));
buttonList.add(new GuiButton(4, guiLeft + 93, guiTop + 42, 85, 20, "Search inv..."));
buttonList.add(new GuiButton(5, guiLeft + 93, guiTop + 64, 85, 20, "Search fluid..."));
buttonList.add(addButton = new GuiButton(8, guiLeft + 50, guiTop + 164, 85, 20, "Add Trade"));
Fluid oldInputFluid = inputFluid != null ? inputFluid.getFluid() : null;
Fluid oldOutputFluid = outputFluid != null ? outputFluid.getFluid() : null;
inputFluid = new WidgetFluidFilter(-1, guiLeft + 10, guiTop + 90);
outputFluid = new WidgetFluidFilter(-1, guiLeft + 99, guiTop + 90);
inputFluid.setFluid(oldInputFluid);
outputFluid.setFluid(oldOutputFluid);
addWidget(inputFluid);
addWidget(outputFluid);
GuiButtonSpecial gpsButton1 = new GuiButtonSpecial(6, guiLeft + 10, guiTop + 115, 20, 20, "");
GuiButtonSpecial gpsButton2 = new GuiButtonSpecial(7, guiLeft + 99, guiTop + 115, 20, 20, "");
gpsButton1.setTooltipText(Arrays.asList(WordUtils.wrap(I18n.format("gui.amadron.button.selectSellingBlock.tooltip"), 40).split(System.getProperty("line.separator"))));
gpsButton2.setTooltipText(Arrays.asList(WordUtils.wrap(I18n.format("gui.amadron.button.selectPaymentBlock.tooltip"), 40).split(System.getProperty("line.separator"))));
gpsButton1.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
gpsButton2.setRenderStacks(new ItemStack(Itemss.GPS_TOOL));
addWidget(gpsButton1);
addWidget(gpsButton2);
inputNumber = new WidgetTextFieldNumber(fontRenderer, guiLeft + 6, guiTop + 145, 40, fontRenderer.FONT_HEIGHT).setValue(inputNumber != null ? inputNumber.getValue() : 0);
outputNumber = new WidgetTextFieldNumber(fontRenderer, guiLeft + 95, guiTop + 145, 40, fontRenderer.FONT_HEIGHT).setValue(outputNumber != null ? outputNumber.getValue() : 0);
inputNumber.setTooltip(I18n.format("gui.amadron.addTrade.itemFluidAmount"));
outputNumber.setTooltip(I18n.format("gui.amadron.addTrade.itemFluidAmount"));
addWidget(inputNumber);
addWidget(outputNumber);
if (searchGui != null) {
if (isSettingInput) {
inputFluid.setFluid(null);
container.setStack(0, searchGui.getSearchStack());
} else {
outputFluid.setFluid(null);
container.setStack(1, searchGui.getSearchStack());
}
}
if (invSearchGui != null) {
if (isSettingInput) {
inputFluid.setFluid(null);
container.setStack(0, invSearchGui.getSearchStack());
} else {
outputFluid.setFluid(null);
container.setStack(1, invSearchGui.getSearchStack());
}
}
if (fluidGui != null) {
if (isSettingInput) {
container.setStack(0, ItemStack.EMPTY);
inputFluid.setFluid(fluidGui.getFilter());
} else {
container.setStack(1, ItemStack.EMPTY);
outputFluid.setFluid(fluidGui.getFilter());
}
}
if (gpsSearchGui != null) {
if (isSettingInput) {
inputPosition = gpsSearchGui.getSearchStack().isEmpty() ? null : ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack());
} else {
outputPosition = gpsSearchGui.getSearchStack().isEmpty() ? null : ItemGPSTool.getGPSLocation(gpsSearchGui.getSearchStack());
}
}
searchGui = null;
fluidGui = null;
invSearchGui = null;
gpsSearchGui = null;
inputNumberLabel = new WidgetLabel(guiLeft + 52, guiTop + 145, container.getStack(0).isEmpty() ? inputFluid.getFluid() != null ? "mB" : "" : "x");
outputNumberLabel = new WidgetLabel(guiLeft + 149, guiTop + 145, container.getStack(1).isEmpty() ? outputFluid.getFluid() != null ? "mB" : "" : "x");
addWidget(inputNumberLabel);
addWidget(outputNumberLabel);
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber in project pnc-repressurized by TeamPneumatic.
the class GuiProgWidgetArea method switchToWidgets.
private void switchToWidgets(AreaType type) {
saveWidgets();
areaTypeValueWidgets.forEach(p -> removeWidget(p.getRight()));
areaTypeStaticWidgets.forEach(w -> removeWidget(w));
areaTypeValueWidgets.clear();
areaTypeStaticWidgets.clear();
int curY = guiTop + 60;
int x = guiLeft + 150;
List<AreaTypeWidget> widgets = new ArrayList<>();
type.addUIWidgets(widgets);
for (AreaTypeWidget widget : widgets) {
WidgetLabel titleWidget = new WidgetLabel(x, curY, I18n.format(widget.title));
addWidget(titleWidget);
areaTypeStaticWidgets.add(titleWidget);
curY += fontRenderer.FONT_HEIGHT + 1;
if (widget instanceof AreaTypeWidgetInteger) {
AreaTypeWidgetInteger intWidget = (AreaTypeWidgetInteger) widget;
WidgetTextFieldNumber intField = new WidgetTextFieldNumber(fontRenderer, x, curY, 40, fontRenderer.FONT_HEIGHT + 1);
intField.setValue(intWidget.readAction.get());
addWidget(intField);
areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, intField));
curY += fontRenderer.FONT_HEIGHT + 20;
} else if (widget instanceof AreaTypeWidgetEnum<?>) {
AreaTypeWidgetEnum<?> enumWidget = (AreaTypeWidgetEnum<?>) widget;
WidgetComboBox enumCbb = new WidgetComboBox(fontRenderer, x, curY, 80, fontRenderer.FONT_HEIGHT + 1).setFixedOptions();
enumCbb.setElements(getEnumNames(enumWidget.enumClass));
enumCbb.setText(enumWidget.readAction.get().toString());
addWidget(enumCbb);
areaTypeValueWidgets.add(new ImmutablePair<AreaType.AreaTypeWidget, IGuiWidget>(widget, enumCbb));
curY += fontRenderer.FONT_HEIGHT + 20;
} else {
throw new IllegalStateException("Invalid widget type: " + widget.getClass());
}
}
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber in project pnc-repressurized by TeamPneumatic.
the class GuiProgWidgetDigAndPlace method initGui.
@Override
public void initGui() {
super.initGui();
List<GuiRadioButton> radioButtons = new ArrayList<>();
ProgWidgetDigAndPlace.EnumOrder[] orders = ProgWidgetDigAndPlace.EnumOrder.values();
for (int i = 0; i < orders.length; i++) {
GuiRadioButton radioButton = new GuiRadioButton(i, guiLeft + 4, guiTop + 30 + i * 12, 0xFF404040, orders[i].getLocalizedName());
radioButton.checked = orders[i] == widget.getOrder();
addWidget(radioButton);
radioButtons.add(radioButton);
radioButton.otherChoices = radioButtons;
}
useMaxActions = new GuiCheckBox(16, guiLeft + (moveActionsToSide() ? 54 : 4), guiTop + 115, 0xFF404040, I18n.format("gui.progWidget.digAndPlace.useMaxActions"));
useMaxActions.setTooltip("gui.progWidget.digAndPlace.useMaxActions.tooltip");
useMaxActions.checked = widget.useMaxActions();
addWidget(useMaxActions);
textField = new WidgetTextFieldNumber(Minecraft.getMinecraft().fontRenderer, guiLeft + (moveActionsToSide() ? 57 : 7), guiTop + 128, 50, 11);
textField.setValue(widget.getMaxActions());
textField.setEnabled(useMaxActions.checked);
addWidget(textField);
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber in project pnc-repressurized by TeamPneumatic.
the class GuiRemoteDropdown method initGui.
@Override
public void initGui() {
super.initGui();
addLabel(I18n.format("gui.remote.button.width"), guiLeft + 10, guiTop + 100);
addLabel(I18n.format("gui.remote.dropdown.dropDownElements"), guiLeft + 10, guiTop + 40);
dropDownElementsField = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 50, 160, 10);
dropDownElementsField.setText(widget.getDropDownElements());
dropDownElementsField.setTooltip(I18n.format("gui.remote.dropdown.dropDownElements.tooltip"));
addWidget(dropDownElementsField);
widthField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 50, guiTop + 99, 30, 10);
widthField.setValue(widget.getWidth());
widthField.minValue = 10;
addWidget(widthField);
}
use of me.desht.pneumaticcraft.client.gui.widget.WidgetTextFieldNumber in project pnc-repressurized by TeamPneumatic.
the class GuiRemoteOptionBase method initGui.
@Override
public void initGui() {
super.initGui();
String title = I18n.format("remote." + widget.getId() + ".name");
addLabel(I18n.format("gui.remote.enable"), guiLeft + 10, guiTop + 150);
addLabel(title, width / 2 - fontRenderer.getStringWidth(title) / 2, guiTop + 5);
addLabel("#", guiLeft + 10, guiTop + 161);
if (widget instanceof IActionWidgetLabeled) {
addLabel(I18n.format("gui.remote.text"), guiLeft + 10, guiTop + 20);
addLabel(I18n.format("gui.remote.tooltip"), guiLeft + 10, guiTop + 46);
}
addLabel(I18n.format("gui.remote.enableValue"), guiLeft + 10, guiTop + 175);
addLabel("X:", guiLeft + 10, guiTop + 186);
addLabel("Y:", guiLeft + 67, guiTop + 186);
addLabel("Z:", guiLeft + 124, guiTop + 186);
enableField = new WidgetComboBox(fontRenderer, guiLeft + 18, guiTop + 160, 152, 10);
enableField.setElements(((ContainerRemote) guiRemote.inventorySlots).variables);
enableField.setText(widget.getEnableVariable());
enableField.setTooltip(I18n.format("gui.remote.enable.tooltip"));
addWidget(enableField);
String valueTooltip = I18n.format("gui.remote.enableValue.tooltip");
xValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 20, guiTop + 185, 38, 10);
xValueField.setValue(widget.getEnablingValue().getX());
xValueField.setTooltip(valueTooltip);
addWidget(xValueField);
yValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 78, guiTop + 185, 38, 10);
yValueField.setValue(widget.getEnablingValue().getY());
yValueField.setTooltip(valueTooltip);
addWidget(yValueField);
zValueField = new WidgetTextFieldNumber(fontRenderer, guiLeft + 136, guiTop + 185, 38, 10);
zValueField.setValue(widget.getEnablingValue().getZ());
zValueField.setTooltip(valueTooltip);
addWidget(zValueField);
if (widget instanceof IActionWidgetLabeled) {
labelField = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 30, 160, 10);
labelField.setText(((IActionWidgetLabeled) widget).getText());
labelField.setTooltip(I18n.format("gui.remote.label.tooltip"));
labelField.setMaxStringLength(1000);
addWidget(labelField);
tooltipField = new WidgetTextField(fontRenderer, guiLeft + 10, guiTop + 56, 160, 10);
tooltipField.setText(((IActionWidgetLabeled) widget).getTooltip());
addWidget(tooltipField);
}
}
Aggregations