Search in sources :

Example 1 with CustomTabListRenderer

use of gregtech.api.terminal.gui.CustomTabListRenderer in project GregTech by GregTechCEu.

the class SettingsApp method initApp.

@Override
public AbstractApplication initApp() {
    if (isClient) {
        this.addWidget(new ImageWidget(5, 15, 323, 212, new ColorRectTexture(TerminalTheme.COLOR_B_2.getColor())));
        this.tabGroup = new TabGroup<>(5, 15, new CustomTabListRenderer(TerminalTheme.COLOR_B_2, TerminalTheme.COLOR_F_2, 323 / 3, 10));
        this.addWidget(this.tabGroup);
        this.tabGroup.setOnTabChanged(this::onPagesChanged);
        addTab("terminal.settings.theme", new ThemeSettings(getOs()));
        addTab("terminal.settings.home", new HomeButtonSettings(getOs()));
        addTab("terminal.settings.os", new OsSettings(getOs()));
    }
    return this;
}
Also used : OsSettings(gregtech.common.terminal.app.settings.widgets.OsSettings) CustomTabListRenderer(gregtech.api.terminal.gui.CustomTabListRenderer) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) ThemeSettings(gregtech.common.terminal.app.settings.widgets.ThemeSettings) ImageWidget(gregtech.api.gui.widgets.ImageWidget) HomeButtonSettings(gregtech.common.terminal.app.settings.widgets.HomeButtonSettings)

Example 2 with CustomTabListRenderer

use of gregtech.api.terminal.gui.CustomTabListRenderer in project GregTech by GregTechCEu.

the class RecipeChartApp method initApp.

@Override
public AbstractApplication initApp() {
    if (isClient) {
        this.tabGroup = new TabGroup<>(0, 10, new CustomTabListRenderer(TerminalTheme.COLOR_F_2, TerminalTheme.COLOR_B_3, 333 / getMaxPages(), 10));
        this.tabGroup.setOnTabChanged(this::onPagesChanged);
        this.addWidget(this.tabGroup);
        loadLocalConfig(nbt -> {
            if (nbt == null || nbt.isEmpty()) {
                this.addTab("default");
            } else {
                for (NBTBase l : nbt.getTagList("list", Constants.NBT.TAG_COMPOUND)) {
                    NBTTagCompound container = (NBTTagCompound) l;
                    this.addTab(container.getString("name")).loadFromNBT((NBTTagCompound) container.getTag("data"));
                }
                tabGroup.setSelectedTab(nbt.getInteger("focus"));
            }
        });
    }
    return this;
}
Also used : NBTBase(net.minecraft.nbt.NBTBase) CustomTabListRenderer(gregtech.api.terminal.gui.CustomTabListRenderer) NBTTagCompound(net.minecraft.nbt.NBTTagCompound)

Aggregations

CustomTabListRenderer (gregtech.api.terminal.gui.CustomTabListRenderer)2 ColorRectTexture (gregtech.api.gui.resources.ColorRectTexture)1 ImageWidget (gregtech.api.gui.widgets.ImageWidget)1 HomeButtonSettings (gregtech.common.terminal.app.settings.widgets.HomeButtonSettings)1 OsSettings (gregtech.common.terminal.app.settings.widgets.OsSettings)1 ThemeSettings (gregtech.common.terminal.app.settings.widgets.ThemeSettings)1 NBTBase (net.minecraft.nbt.NBTBase)1 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)1