Search in sources :

Example 6 with TextTexture

use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.

the class SettingsApp method onPagesChanged.

private void onPagesChanged(int oldPage, int newPage) {
    ITabInfo tabInfo = tabGroup.getTabInfo(newPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.ROLL);
    }
    tabInfo = tabGroup.getTabInfo(oldPage);
    if (tabInfo instanceof IGuiTextureTabInfo && ((IGuiTextureTabInfo) tabInfo).texture instanceof TextTexture) {
        ((TextTexture) ((IGuiTextureTabInfo) tabInfo).texture).setType(TextTexture.TextType.HIDE);
    }
}
Also used : ITabInfo(gregtech.api.gui.widgets.tab.ITabInfo) TextTexture(gregtech.api.gui.resources.TextTexture) IGuiTextureTabInfo(gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)

Example 7 with TextTexture

use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.

the class FluidStackConfigurator method init.

protected void init() {
    container = new DraggableScrollableWidgetGroup(0, 27, 116, 100);
    this.addWidget(container);
    this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1).setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)).setClickListener(cd -> {
        addSlot(container, new TankListWidget.FluidStackInfo(null, 0));
        updateValue();
    }).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()));
    tanks = new ArrayList<>();
    if (!config.get(name).isJsonNull()) {
        Gson gson = new Gson();
        for (JsonElement o : config.get(name).getAsJsonArray()) {
            addSlot(container, gson.fromJson(o, TankListWidget.FluidStackInfo.class));
        }
    }
}
Also used : TankListWidget(gregtech.common.terminal.app.guide.widget.TankListWidget) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) JsonElement(com.google.gson.JsonElement) TextTexture(gregtech.api.gui.resources.TextTexture) Gson(com.google.gson.Gson) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Example 8 with TextTexture

use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.

the class ItemStackConfigurator method addSlot.

private void addSlot(DraggableScrollableWidgetGroup container, SlotListWidget.ItemStackInfo itemStackInfo) {
    WidgetGroup group = new WidgetGroup(0, slots.size() * 20, 116, 20);
    slots.add(itemStackInfo);
    IItemHandlerModifiable handler = new SingleItemStackHandler(1);
    handler.setStackInSlot(0, itemStackInfo.getInstance());
    group.addWidget(new PhantomSlotWidget(handler, 0, 1, 1).setBackgroundTexture(TerminalTheme.COLOR_B_2).setChangeListener(() -> {
        itemStackInfo.update(handler.getStackInSlot(0));
        updateValue();
    }));
    group.addWidget(new RectButtonWidget(20, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
        itemStackInfo.count = Math.max(0, itemStackInfo.count - (data.isShiftClick ? 10 : 1));
        updateValue();
    }).setIcon(new TextTexture("-1", -1)));
    group.addWidget(new RectButtonWidget(76, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
        itemStackInfo.count = Math.max(0, itemStackInfo.count + (data.isShiftClick ? 10 : 1));
        updateValue();
    }).setIcon(new TextTexture("+1", -1)));
    group.addWidget(new ImageWidget(40, 0, 36, 20, TerminalTheme.COLOR_B_2));
    group.addWidget(new SimpleTextWidget(58, 10, "", 0xFFFFFF, () -> Integer.toString(itemStackInfo.count), true));
    group.addWidget(new RectButtonWidget(96, 0, 20, 20).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()).setClickListener(data -> {
        container.waitToRemoved(group);
        slots.remove(itemStackInfo);
        int index = container.widgets.indexOf(group);
        for (int i = container.widgets.size() - 1; i > index; i--) {
            container.widgets.get(i).addSelfPosition(0, -20);
        }
        updateValue();
    }).setIcon(GuiTextures.ICON_REMOVE));
    container.addWidget(group);
}
Also used : IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) PhantomSlotWidget(gregtech.api.gui.widgets.PhantomSlotWidget) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) SingleItemStackHandler(gregtech.common.inventory.handlers.SingleItemStackHandler) TextTexture(gregtech.api.gui.resources.TextTexture) ImageWidget(gregtech.api.gui.widgets.ImageWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget)

Example 9 with TextTexture

use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.

the class ItemStackConfigurator method init.

protected void init() {
    container = new DraggableScrollableWidgetGroup(0, 27, 116, 100);
    this.addWidget(container);
    this.addWidget(new RectButtonWidget(0, 15, 116, 10, 1).setIcon(new TextTexture("terminal.guide_editor.add_slot", -1)).setClickListener(cd -> {
        addSlot(container, new SlotListWidget.ItemStackInfo("minecraft:air", 0, 0));
        updateValue();
    }).setColors(TerminalTheme.COLOR_B_1.getColor(), TerminalTheme.COLOR_1.getColor(), TerminalTheme.COLOR_B_1.getColor()));
    slots = new ArrayList<>();
    if (!config.get(name).isJsonNull()) {
        Gson gson = new Gson();
        for (JsonElement o : config.get(name).getAsJsonArray()) {
            addSlot(container, gson.fromJson(o, SlotListWidget.ItemStackInfo.class));
        }
    }
}
Also used : DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) JsonElement(com.google.gson.JsonElement) TextTexture(gregtech.api.gui.resources.TextTexture) Gson(com.google.gson.Gson) SlotListWidget(gregtech.common.terminal.app.guide.widget.SlotListWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Example 10 with TextTexture

use of gregtech.api.gui.resources.TextTexture in project GregTech by GregTechCEu.

the class VirtualTankApp method initApp.

@Override
public AbstractApplication initApp() {
    this.addWidget(new ImageWidget(5, 5, 333 - 10, 232 - 10, TerminalTheme.COLOR_B_2));
    this.addWidget(new LabelWidget(10, 10, "terminal.vtank_viewer.title", -1));
    this.addWidget(new RectButtonWidget(216, 7, 110, 18).setClickListener(cd -> {
        if (cd.isClient) {
            reloadWidgets(cacheClient);
        }
    }).setIcon(new TextTexture("terminal.vtank_viewer.refresh", -1)).setFill(TerminalTheme.COLOR_B_2.getColor()));
    widgetGroup = new DraggableScrollableWidgetGroup(10, 30, 313, 195).setDraggable(true).setYScrollBarWidth(3).setYBarStyle(null, TerminalTheme.COLOR_F_1);
    if (isClient) {
        cacheClient = new HashMap<>();
    } else {
        cacheServer = new HashMap<>();
    }
    this.addWidget(widgetGroup);
    if (!isRemote()) {
        refresh();
    }
    return this;
}
Also used : VirtualTankRegistry(gregtech.api.util.VirtualTankRegistry) java.util(java.util) TerminalTheme(gregtech.api.terminal.os.TerminalTheme) TextTexture(gregtech.api.gui.resources.TextTexture) ImageWidget(gregtech.api.gui.widgets.ImageWidget) TankWidget(gregtech.api.gui.widgets.TankWidget) SearchComponent(gregtech.common.terminal.component.SearchComponent) Pair(org.apache.commons.lang3.tuple.Pair) Side(net.minecraftforge.fml.relauncher.Side) AtomicInteger(java.util.concurrent.atomic.AtomicInteger) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) GTLog(gregtech.api.util.GTLog) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) LabelWidget(gregtech.api.gui.widgets.LabelWidget) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) Collectors(java.util.stream.Collectors) GuiTextures(gregtech.api.gui.GuiTextures) ImmutablePair(org.apache.commons.lang3.tuple.ImmutablePair) AbstractApplication(gregtech.api.terminal.app.AbstractApplication) Consumer(java.util.function.Consumer) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget) IMenuComponent(gregtech.api.terminal.os.menu.IMenuComponent) FluidStack(net.minecraftforge.fluids.FluidStack) FluidTank(net.minecraftforge.fluids.FluidTank) IFluidTank(net.minecraftforge.fluids.IFluidTank) PacketBuffer(net.minecraft.network.PacketBuffer) DraggableScrollableWidgetGroup(gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup) LabelWidget(gregtech.api.gui.widgets.LabelWidget) TextTexture(gregtech.api.gui.resources.TextTexture) ImageWidget(gregtech.api.gui.widgets.ImageWidget) RectButtonWidget(gregtech.api.terminal.gui.widgets.RectButtonWidget)

Aggregations

TextTexture (gregtech.api.gui.resources.TextTexture)12 RectButtonWidget (gregtech.api.terminal.gui.widgets.RectButtonWidget)8 DraggableScrollableWidgetGroup (gregtech.api.terminal.gui.widgets.DraggableScrollableWidgetGroup)7 JsonElement (com.google.gson.JsonElement)4 ImageWidget (gregtech.api.gui.widgets.ImageWidget)4 TerminalTheme (gregtech.api.terminal.os.TerminalTheme)4 Gson (com.google.gson.Gson)3 GuiTextures (gregtech.api.gui.GuiTextures)3 IGuiTextureTabInfo (gregtech.api.gui.widgets.tab.IGuiTextureTabInfo)3 JsonObject (com.google.gson.JsonObject)2 gregtech.api.gui.widgets (gregtech.api.gui.widgets)2 LabelWidget (gregtech.api.gui.widgets.LabelWidget)2 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)2 WidgetGroup (gregtech.api.gui.widgets.WidgetGroup)2 ITabInfo (gregtech.api.gui.widgets.tab.ITabInfo)2 AbstractApplication (gregtech.api.terminal.app.AbstractApplication)2 java.awt (java.awt)2 PacketBuffer (net.minecraft.network.PacketBuffer)2 GregtechTileCapabilities (gregtech.api.capability.GregtechTileCapabilities)1 IControllable (gregtech.api.capability.IControllable)1