use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class RecipeMapGroupOutput method createUITemplate.
@Override
public Builder createUITemplate(DoubleSupplier progressSupplier, IItemHandlerModifiable importItems, IItemHandlerModifiable exportItems, FluidTankList importFluids, FluidTankList exportFluids) {
ModularUI.Builder builder = ModularUI.defaultBuilder();
builder.widget(new ProgressWidget(progressSupplier, 77, 22, 21, 20, progressBarTexture, moveType));
addInventorySlotGroup(builder, importItems, importFluids, false);
BooleanWrapper booleanWrapper = new BooleanWrapper();
ServerWidgetGroup itemOutputGroup = createItemOutputWidgetGroup(exportItems, new ServerWidgetGroup(() -> !booleanWrapper.getCurrentMode()));
ServerWidgetGroup fluidOutputGroup = createFluidOutputWidgetGroup(exportFluids, new ServerWidgetGroup(booleanWrapper::getCurrentMode));
builder.widget(itemOutputGroup).widget(fluidOutputGroup);
ToggleButtonWidget buttonWidget = new ToggleButtonWidget(176 - 7 - 54, 62, 18, 18, GuiTextures.BUTTON_SWITCH_VIEW, booleanWrapper::getCurrentMode, booleanWrapper::setCurrentMode).setTooltipText("gregtech.gui.toggle_view");
builder.widget(buttonWidget);
return builder;
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityChest method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, Math.max(176, 14 + rowSize * 18), 18 + 18 * amountOfRows + 94).label(5, 5, getMetaFullName());
builder.widget(new SortingButtonWidget(111, 4, 60, 10, "gregtech.gui.sort", (info) -> sortInventorySlotContents(inventory)));
for (int y = 0; y < amountOfRows; y++) {
for (int x = 0; x < rowSize; x++) {
int index = y * rowSize + x;
builder.slot(inventory, index, 7 + x * 18, 18 + y * 18, GuiTextures.SLOT);
}
}
int startX = (Math.max(176, 14 + rowSize * 18) - 162) / 2;
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, startX, 18 + 18 * amountOfRows + 12);
if (!getWorld().isRemote) {
builder.bindOpenListener(() -> onContainerOpen(entityPlayer));
builder.bindCloseListener(() -> onContainerClose(entityPlayer));
}
return builder.build(getHolder(), entityPlayer);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityQuantumChest method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
Builder builder = ModularUI.defaultBuilder();
builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
builder.widget(new AdvancedTextWidget(11, 20, this::addDisplayInformation, 0xFFFFFF));
return builder.label(6, 6, getMetaFullName()).widget(new SlotWidget(importItems, 0, 90, 17, true, true).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new SlotWidget(exportItems, 0, 90, 54, true, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)).bindPlayerInventory(entityPlayer.inventory).build(getHolder(), entityPlayer);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityQuantumTank method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
Builder builder = ModularUI.defaultBuilder();
builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
TankWidget tankWidget = new TankWidget(fluidTank, 69, 52, 18, 18).setHideTooltip(true).setAlwaysShowFull(true);
builder.widget(tankWidget);
builder.label(11, 20, "gregtech.gui.fluid_amount", 0xFFFFFF);
builder.dynamicLabel(11, 30, tankWidget::getFormattedFluidAmount, 0xFFFFFF);
builder.dynamicLabel(11, 40, tankWidget::getFluidLocalizedName, 0xFFFFFF);
return builder.label(6, 6, getMetaFullName()).widget(new FluidContainerSlotWidget(containerInventory, 0, 90, 17, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)).widget(new SlotWidget(containerInventory, 1, 90, 54, true, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.OUT_SLOT_OVERLAY)).bindPlayerInventory(entityPlayer.inventory).build(getHolder(), entityPlayer);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityBatteryBuffer method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
int rowSize = (int) Math.sqrt(inventorySize);
Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 18 + 18 * rowSize + 94).label(10, 5, getMetaFullName());
for (int y = 0; y < rowSize; y++) {
for (int x = 0; x < rowSize; x++) {
int index = y * rowSize + x;
builder.widget(new SlotWidget(importItems, index, 89 - rowSize * 9 + x * 18, 18 + y * 18, true, true).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.BATTERY_OVERLAY));
}
}
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12);
return builder.build(getHolder(), entityPlayer);
}
Aggregations