Search in sources :

Example 1 with WidgetOreList

use of gregtech.common.terminal.app.prospector.widget.WidgetOreList in project GregTech by GregTechCEu.

the class ProspectorApp method initApp.

@Override
public AbstractApplication initApp() {
    int chunkRadius = getAppTier() + 3;
    int offset = (232 - 32 * 7 + 16) / 2;
    background = new ColorRectTexture(0xA0000000);
    this.addWidget(new ImageWidget(0, 0, 333, 232, background));
    if (isClient) {
        this.addWidget(new ImageWidget(0, 0, 333, offset, GuiTextures.UI_FRAME_SIDE_UP));
        this.addWidget(new ImageWidget(0, 232 - offset, 333, offset, GuiTextures.UI_FRAME_SIDE_DOWN));
        this.widgetOreList = new WidgetOreList(32 * chunkRadius - 16, offset, 333 - 32 * chunkRadius + 16, 232 - 2 * offset);
        this.addWidget(this.widgetOreList);
    }
    this.widgetProspectingMap = new WidgetProspectingMap(0, offset + (7 - chunkRadius) * 16, chunkRadius, this.widgetOreList, mode, 1);
    if (isClient) {
        persist = Tables.newCustomTable(Maps.newHashMap(), Maps::newHashMap);
        widgetProspectingMap.setOnPacketReceived(packet -> persist.put(packet.chunkX, packet.chunkZ, packet));
    }
    this.addWidget(1, this.widgetProspectingMap);
    loadLocalConfig(nbt -> {
        this.widgetProspectingMap.setDarkMode(nbt.getBoolean("dark"));
        background.setColor(this.widgetProspectingMap.getDarkMode() ? 0xA0000000 : 0xA0ffffff);
    });
    if (isClient) {
        loadPacketLocalConfig();
    }
    return this;
}
Also used : WidgetProspectingMap(gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap) ColorRectTexture(gregtech.api.gui.resources.ColorRectTexture) WidgetOreList(gregtech.common.terminal.app.prospector.widget.WidgetOreList) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Example 2 with WidgetOreList

use of gregtech.common.terminal.app.prospector.widget.WidgetOreList in project GregTech by GregTechCEu.

the class ProspectorScannerBehavior method createUI.

@Override
public ModularUI createUI(PlayerInventoryHolder holder, @Nonnull EntityPlayer entityPlayer) {
    int mode = getMode(entityPlayer.getHeldItem(EnumHand.MAIN_HAND));
    ModularUI.Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 332, 200);
    this.widgetOreList = new WidgetOreList(32 * radius - 6, 18, 332 - 32 * radius, 176);
    builder.widget(this.widgetOreList);
    builder.widget(new WidgetProspectingMap(6, 18, radius, this.widgetOreList, mode, 1));
    return builder.label(6, 6, getTranslationKey()).build(holder, entityPlayer);
}
Also used : ModularUI(gregtech.api.gui.ModularUI) WidgetProspectingMap(gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap) WidgetOreList(gregtech.common.terminal.app.prospector.widget.WidgetOreList)

Aggregations

WidgetOreList (gregtech.common.terminal.app.prospector.widget.WidgetOreList)2 WidgetProspectingMap (gregtech.common.terminal.app.prospector.widget.WidgetProspectingMap)2 ModularUI (gregtech.api.gui.ModularUI)1 ColorRectTexture (gregtech.api.gui.resources.ColorRectTexture)1 ImageWidget (gregtech.api.gui.widgets.ImageWidget)1