use of gregtech.api.gui.widgets.SlotWidget in project GregTech by GregTechCE.
the class SimpleGeneratorMetaTileEntity method createGuiTemplate.
protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
Builder builder = ModularUI.defaultBuilder();
builder.image(7, 16, 81, 55, GuiTextures.DISPLAY);
TankWidget tankWidget = new TankWidget(importFluids.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(containerInventory, 0, 90, 17, true).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(player.inventory);
}
use of gregtech.api.gui.widgets.SlotWidget in project GregTech by GregTechCE.
the class FluidFilterContainer method initUI.
public void initUI(int y, Consumer<Widget> widgetGroup) {
widgetGroup.accept(new LabelWidget(10, y, "cover.pump.fluid_filter.title"));
widgetGroup.accept(new SlotWidget(filterInventory, 0, 10, y + 15).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.FILTER_SLOT_OVERLAY));
this.filterWrapper.initUI(y + 15, widgetGroup);
}
use of gregtech.api.gui.widgets.SlotWidget in project GregTech by GregTechCE.
the class RecipeMapCategory method setRecipe.
@Override
public void setRecipe(IRecipeLayout recipeLayout, GTRecipeWrapper recipeWrapper, IIngredients ingredients) {
IGuiItemStackGroup itemStackGroup = recipeLayout.getItemStacks();
IGuiFluidStackGroup fluidStackGroup = recipeLayout.getFluidStacks();
for (Widget uiWidget : modularUI.guiWidgets.values()) {
if (uiWidget instanceof SlotWidget) {
SlotWidget slotWidget = (SlotWidget) uiWidget;
if (!(slotWidget.getHandle() instanceof SlotItemHandler)) {
continue;
}
SlotItemHandler handle = (SlotItemHandler) slotWidget.getHandle();
if (handle.getItemHandler() == importItems) {
// this is input item stack slot widget, so add it to item group
itemStackGroup.init(handle.getSlotIndex(), true, slotWidget.getPosition().x, slotWidget.getPosition().y);
} else if (handle.getItemHandler() == exportItems) {
// this is output item stack slot widget, so add it to item group
itemStackGroup.init(importItems.getSlots() + handle.getSlotIndex(), false, slotWidget.getPosition().x, slotWidget.getPosition().y);
}
} else if (uiWidget instanceof TankWidget) {
TankWidget tankWidget = (TankWidget) uiWidget;
if (importFluids.getFluidTanks().contains(tankWidget.fluidTank)) {
int importIndex = importFluids.getFluidTanks().indexOf(tankWidget.fluidTank);
List<List<FluidStack>> inputsList = ingredients.getInputs(FluidStack.class);
int fluidAmount = 0;
if (inputsList.size() > importIndex && !inputsList.get(importIndex).isEmpty())
fluidAmount = inputsList.get(importIndex).get(0).amount;
// this is input tank widget, so add it to fluid group
fluidStackGroup.init(importIndex, true, tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), fluidAmount, false, null);
} else if (exportFluids.getFluidTanks().contains(tankWidget.fluidTank)) {
int exportIndex = exportFluids.getFluidTanks().indexOf(tankWidget.fluidTank);
List<List<FluidStack>> inputsList = ingredients.getOutputs(FluidStack.class);
int fluidAmount = 0;
if (inputsList.size() > exportIndex && !inputsList.get(exportIndex).isEmpty())
fluidAmount = inputsList.get(exportIndex).get(0).amount;
// this is output tank widget, so add it to fluid group
fluidStackGroup.init(importFluids.getFluidTanks().size() + exportIndex, false, tankWidget.getPosition().x + tankWidget.fluidRenderOffset, tankWidget.getPosition().y + tankWidget.fluidRenderOffset, tankWidget.getSize().width - (2 * tankWidget.fluidRenderOffset), tankWidget.getSize().height - (2 * tankWidget.fluidRenderOffset), fluidAmount, false, null);
}
}
}
itemStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
fluidStackGroup.addTooltipCallback(recipeWrapper::addTooltip);
itemStackGroup.set(ingredients);
fluidStackGroup.set(ingredients);
}
Aggregations