use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityItemBus method createUITemplate.
private ModularUI.Builder createUITemplate(EntityPlayer player, int rowSize, int xOffset) {
Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176 + xOffset * 2, 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(isExportHatch ? exportItems : importItems, index, (88 - rowSize * 9 + x * 18) + xOffset, 18 + y * 18, true, !isExportHatch).setBackgroundTexture(GuiTextures.SLOT));
}
}
return builder.bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7 + xOffset, 18 + 18 * rowSize + 12);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityPump method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
Builder builder = ModularUI.defaultBuilder();
builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
TankWidget tankWidget = new TankWidget(exportFluids.getTankAt(0), 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(importItems, 0, 90, 17, false).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.IN_SLOT_OVERLAY)).widget(new ImageWidget(91, 36, 14, 15, GuiTextures.TANK_ICON)).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 MetaTileEntityFluidHatch method createTankUI.
public ModularUI.Builder createTankUI(IFluidTank fluidTank, IItemHandlerModifiable containerInventory, String title, 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, title).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);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityBlockBreaker method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
int rowSize = (int) Math.sqrt(getInventorySize());
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(exportItems, index, 89 - rowSize * 9 + x * 18, 18 + y * 18, true, false).setBackgroundTexture(GuiTextures.SLOT));
}
}
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 18 + 18 * rowSize + 12);
return builder.build(getHolder(), entityPlayer);
}
use of gregtech.api.gui.ModularUI.Builder in project GregTech by GregTechCE.
the class MetaTileEntityItemCollector method createUI.
@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
int rowSize = (int) Math.sqrt(exportItems.getSlots());
Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 45 + rowSize * 18 + 105 + 82).label(10, 5, getMetaFullName());
builder.widget(new ClickButtonWidget(10, 20, 20, 20, "-1", data -> adjustSuckingRange(-1)));
builder.widget(new ClickButtonWidget(146, 20, 20, 20, "+1", data -> adjustSuckingRange(+1)));
builder.widget(new ImageWidget(30, 20, 116, 20, GuiTextures.DISPLAY));
builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, () -> Integer.toString(itemSuckingRange)));
for (int y = 0; y < rowSize; y++) {
for (int x = 0; x < rowSize; x++) {
int index = y * rowSize + x;
builder.widget(new SlotWidget(exportItems, index, 89 - rowSize * 9 + x * 18, 45 + y * 18, true, false).setBackgroundTexture(GuiTextures.SLOT));
}
}
this.itemFilter.initUI(45 + rowSize * 18 + 5, builder::widget);
builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 45 + rowSize * 18 + 105);
return builder.build(getHolder(), entityPlayer);
}
Aggregations