Search in sources :

Example 1 with Widget

use of gregtech.api.gui.Widget in project GregTech by GregTechCE.

the class ModularUIGuiHandler method getTargets.

@Override
public <I> List<Target<I>> getTargets(ModularUIGui gui, I ingredient, boolean doStart) {
    Collection<Widget> widgets = gui.getModularUI().guiWidgets.values();
    List<Target<I>> targets = new ArrayList<>();
    for (Widget widget : widgets) {
        if (widget instanceof IGhostIngredientTarget) {
            IGhostIngredientTarget ghostTarget = (IGhostIngredientTarget) widget;
            List<Target<?>> widgetTargets = ghostTarget.getPhantomTargets(ingredient);
            // noinspection unchecked
            targets.addAll((List<Target<I>>) (Object) widgetTargets);
        }
    }
    return targets;
}
Also used : IGhostIngredientTarget(gregtech.api.gui.igredient.IGhostIngredientTarget) Widget(gregtech.api.gui.Widget) IRecipeTransferHandlerWidget(gregtech.api.gui.igredient.IRecipeTransferHandlerWidget) IGhostIngredientTarget(gregtech.api.gui.igredient.IGhostIngredientTarget)

Example 2 with Widget

use of gregtech.api.gui.Widget in project GregTech by GregTechCE.

the class ModularUIGui method handleWidgetUpdate.

public void handleWidgetUpdate(PacketUIWidgetUpdate packet) {
    if (packet.windowId == inventorySlots.windowId) {
        Widget widget = modularUI.guiWidgets.get(packet.widgetId);
        int updateId = packet.updateData.readVarInt();
        if (widget != null) {
            widget.readUpdateInfo(updateId, packet.updateData);
        }
    }
}
Also used : Widget(gregtech.api.gui.Widget)

Example 3 with Widget

use of gregtech.api.gui.Widget in project GregTech by GregTechCE.

the class OreDictionaryItemFilter method initUI.

@Override
public void initUI(Consumer<Widget> widgetGroup) {
    widgetGroup.accept(new LabelWidget(10, 0, "cover.ore_dictionary_filter.title1"));
    widgetGroup.accept(new LabelWidget(10, 10, "cover.ore_dictionary_filter.title2"));
    widgetGroup.accept(new TextFieldWidget(10, 25, 100, 12, true, () -> oreDictionaryFilter, this::setOreDictionaryFilter).setMaxStringLength(64).setValidator(str -> ORE_DICTIONARY_FILTER.matcher(str).matches()));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Consumer(java.util.function.Consumer) ItemStack(net.minecraft.item.ItemStack) OreDictUnifier(gregtech.api.unification.OreDictUnifier) Widget(gregtech.api.gui.Widget) Set(java.util.Set) Pattern(java.util.regex.Pattern) LabelWidget(gregtech.api.gui.widgets.LabelWidget) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget) ItemStackKey(gregtech.api.util.ItemStackKey) LabelWidget(gregtech.api.gui.widgets.LabelWidget) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget)

Example 4 with Widget

use of gregtech.api.gui.Widget in project GregTech by GregTechCE.

the class ItemListGridWidget method addSlotRows.

private void addSlotRows(int amount) {
    for (int i = 0; i < amount; i++) {
        int widgetAmount = widgets.size();
        WidgetGroup widgetGroup = new WidgetGroup();
        for (int j = 0; j < slotAmountX; j++) {
            Widget widget = new ItemListSlotWidget(j * 18, 0, this, widgetAmount * 9 + j);
            widgetGroup.addWidget(widget);
        }
        addWidget(widgetGroup);
    }
}
Also used : INativeWidget(gregtech.api.gui.INativeWidget) Widget(gregtech.api.gui.Widget) ScrollableListWidget(gregtech.api.gui.widgets.ScrollableListWidget) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup)

Example 5 with Widget

use of gregtech.api.gui.Widget in project GregTech by GregTechCE.

the class ItemListGridWidget method removeSlotRows.

private void removeSlotRows(int amount) {
    for (int i = 0; i < amount; i++) {
        Widget slotWidget = widgets.remove(widgets.size() - 1);
        removeWidget(slotWidget);
    }
}
Also used : INativeWidget(gregtech.api.gui.INativeWidget) Widget(gregtech.api.gui.Widget) ScrollableListWidget(gregtech.api.gui.widgets.ScrollableListWidget)

Aggregations

Widget (gregtech.api.gui.Widget)20 INativeWidget (gregtech.api.gui.INativeWidget)9 Position (gregtech.api.util.Position)4 Consumer (java.util.function.Consumer)3 ScrollableListWidget (gregtech.api.gui.widgets.ScrollableListWidget)2 SlotWidget (gregtech.api.gui.widgets.SlotWidget)2 TankWidget (gregtech.api.gui.widgets.TankWidget)2 PacketUIWidgetUpdate (gregtech.api.net.PacketUIWidgetUpdate)2 Size (gregtech.api.util.Size)2 ItemStack (net.minecraft.item.ItemStack)2 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)2 FluidStack (net.minecraftforge.fluids.FluidStack)2 FluidTankList (gregtech.api.capability.impl.FluidTankList)1 GuiTextures (gregtech.api.gui.GuiTextures)1 IRenderContext (gregtech.api.gui.IRenderContext)1 ModularUI (gregtech.api.gui.ModularUI)1 IGhostIngredientTarget (gregtech.api.gui.igredient.IGhostIngredientTarget)1 IIngredientSlot (gregtech.api.gui.igredient.IIngredientSlot)1 IRecipeTransferHandlerWidget (gregtech.api.gui.igredient.IRecipeTransferHandlerWidget)1 LabelWidget (gregtech.api.gui.widgets.LabelWidget)1