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