use of gregtech.api.gui.widgets.ImageCycleButtonWidget in project GregTech by GregTechCEu.
the class MultiblockWithDisplayBase method createUITemplate.
protected ModularUI.Builder createUITemplate(EntityPlayer entityPlayer) {
ModularUI.Builder builder = ModularUI.extendedBuilder();
builder.image(7, 4, 162, 121, GuiTextures.DISPLAY);
builder.label(11, 9, getMetaFullName(), 0xFFFFFF);
builder.widget(new AdvancedTextWidget(11, 19, this::addDisplayText, 0xFFFFFF).setMaxWidthLimit(156).setClickHandler(this::handleDisplayClick));
if (shouldShowVoidingModeButton()) {
builder.widget(new ImageCycleButtonWidget(149, 121 - 17, 18, 18, GuiTextures.BUTTON_VOID_MULTIBLOCK, 4, this::getVoidingMode, this::setVoidingMode).setTooltipHoverString(this::getVoidingModeTooltip));
}
builder.bindPlayerInventory(entityPlayer.inventory, 134);
return builder;
}
use of gregtech.api.gui.widgets.ImageCycleButtonWidget in project GregTech by GregTechCEu.
the class ClipboardBehavior method createMTEUI.
public ModularUI createMTEUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) {
// So that people don't click on any text fields
initNBT(holder.getCurrentItem());
ModularUI.Builder builder = ModularUI.builder(GuiTextures.CLIPBOARD_PAPER_BACKGROUND, 170, 238);
builder.image(18, 8, 130, 14, GuiTextures.CLIPBOARD_TEXT_BOX);
builder.widget(new SimpleTextWidget(20, 10, "", TEXT_COLOR, () -> getTitle(holder), true).setCenter(false));
for (int i = 0; i < 8; i++) {
int finalI = i;
builder.widget(new ImageCycleButtonWidget(6, 37 + 20 * i, 15, 15, GuiTextures.CLIPBOARD_BUTTON, 4, () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x)));
builder.image(22, 38 + 20 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX);
builder.widget(new SimpleTextWidget(24, 40 + 20 * i, "", TEXT_COLOR, () -> getString(holder, finalI), true).setCenter(false));
}
builder.widget(new ClickButtonWidget(30, 200, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? -10 : -1)).setButtonTexture(GuiTextures.BUTTON_LEFT).setShouldClientCallback(true));
builder.widget(new ClickButtonWidget(124, 200, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? 10 : 1)).setButtonTexture(GuiTextures.BUTTON_RIGHT).setShouldClientCallback(true));
builder.widget(new SimpleTextWidget(85, 208, "", TEXT_COLOR, () -> (getPageNum(holder) + 1) + " / " + MAX_PAGES, true));
builder.shouldColor(false);
return builder.build(holder, entityPlayer);
}
use of gregtech.api.gui.widgets.ImageCycleButtonWidget in project GregTech by GregTechCEu.
the class ClipboardBehavior method createUI.
@Override
public ModularUI createUI(PlayerInventoryHolder holder, EntityPlayer entityPlayer) {
ModularUI.Builder builder = ModularUI.builder(GuiTextures.CLIPBOARD_BACKGROUND, 186, 263);
initNBT(holder.getCurrentItem());
List<TextFieldWidget2> textFields = new ArrayList<>();
builder.image(28, 28, 130, 12, GuiTextures.CLIPBOARD_TEXT_BOX);
textFields.add(new TextFieldWidget2(30, 30, 126, 9, () -> getTitle(holder), val -> setTitle(holder, val)).setMaxLength(25).setCentered(true).setTextColor(TEXT_COLOR));
for (int i = 0; i < 8; i++) {
int finalI = i;
builder.widget(new ImageCycleButtonWidget(14, 55 + 22 * i, 15, 15, GuiTextures.CLIPBOARD_BUTTON, 4, () -> getButtonState(holder, finalI), (x) -> setButton(holder, finalI, x)));
builder.image(32, 58 + 22 * i, 140, 12, GuiTextures.CLIPBOARD_TEXT_BOX);
textFields.add(new TextFieldWidget2(34, 60 + 22 * i, 136, 9, () -> getString(holder, finalI), val -> setString(holder, finalI, val)).setMaxLength(23).setTextColor(TEXT_COLOR));
}
for (TextFieldWidget2 textField : textFields) {
builder.widget(textField.setOnFocus(textField2 -> textFields.forEach(textField3 -> {
if (textField3 != textField2) {
textField3.unFocus();
}
})));
}
builder.widget(new ClickButtonWidget(38, 231, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? -10 : -1)).setButtonTexture(GuiTextures.BUTTON_LEFT).setShouldClientCallback(true));
builder.widget(new ClickButtonWidget(132, 231, 16, 16, "", (x) -> incrPageNum(holder, x.isShiftClick ? 10 : 1)).setButtonTexture(GuiTextures.BUTTON_RIGHT).setShouldClientCallback(true));
builder.widget(new SimpleTextWidget(93, 240, "", TEXT_COLOR, () -> (getPageNum(holder) + 1) + " / " + MAX_PAGES, true));
builder.shouldColor(false);
return builder.build(holder, entityPlayer);
}
Aggregations