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;
}
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);
}
}
}
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()));
}
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);
}
}
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);
}
}
Aggregations