Search in sources :

Example 11 with GuiInnerScreen

use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.

the class GuiDigitalMiner method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 7, 19, 77, 69, () -> {
        List<ITextComponent> list = new ArrayList<>();
        ILangEntry runningType;
        if (tile.getEnergyContainer().getEnergyPerTick().greaterThan(tile.getEnergyContainer().getMaxEnergy())) {
            runningType = MekanismLang.MINER_LOW_POWER;
        } else if (tile.isRunning()) {
            runningType = MekanismLang.MINER_RUNNING;
        } else {
            runningType = MekanismLang.IDLE;
        }
        list.add(runningType.translate());
        list.add(tile.searcher.state.getTextComponent());
        list.add(MekanismLang.MINER_TO_MINE.translate(TextUtils.format(tile.getToMine())));
        return list;
    }).spacing(1).clearFormat());
    addButton(new GuiDigitalSwitch(this, 19, 56, EJECT, tile::getDoEject, MekanismLang.AUTO_EJECT.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_EJECT_BUTTON, tile)), SwitchType.LOWER_ICON));
    addButton(new GuiDigitalSwitch(this, 38, 56, INPUT, tile::getDoPull, MekanismLang.AUTO_PULL.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.AUTO_PULL_BUTTON, tile)), SwitchType.LOWER_ICON));
    addButton(new GuiDigitalSwitch(this, 57, 56, SILK, tile::getSilkTouch, MekanismLang.MINER_SILK.translate(), () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.SILK_TOUCH_BUTTON, tile)), SwitchType.LOWER_ICON));
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 157, 39, 47));
    addButton(new GuiVisualsTab(this, tile));
    addButton(new GuiSlot(SlotType.DIGITAL, this, 64, 21).setRenderAboveSlots().validity(() -> tile.missingStack).with(() -> tile.missingStack.isEmpty() ? SlotOverlay.CHECK : null).hover(getOnHover(() -> tile.missingStack.isEmpty() ? MekanismLang.MINER_WELL.translate() : MekanismLang.MINER_MISSING_BLOCK.translate())));
    addButton(new GuiEnergyTab(this, () -> {
        MinerEnergyContainer energyContainer = tile.getEnergyContainer();
        FloatingLong perTick = energyContainer.getEnergyPerTick();
        ArrayList<ITextComponent> ret = new ArrayList<>(4);
        ret.add(MekanismLang.MINER_ENERGY_CAPACITY.translate(EnergyDisplay.of(energyContainer.getMaxEnergy())));
        ret.add(MekanismLang.NEEDED_PER_TICK.translate(EnergyDisplay.of(perTick)));
        if (perTick.greaterThan(energyContainer.getMaxEnergy())) {
            ret.add(MekanismLang.MINER_INSUFFICIENT_BUFFER.translateColored(EnumColor.RED));
        }
        ret.add(MekanismLang.MINER_BUFFER_FREE.translate(EnergyDisplay.of(energyContainer.getNeeded())));
        return ret;
    }));
    int buttonStart = 19;
    startButton = addButton(new TranslationButton(this, 87, buttonStart, 61, 18, MekanismLang.BUTTON_START, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.START_BUTTON, tile))));
    stopButton = addButton(new TranslationButton(this, 87, buttonStart + 17, 61, 18, MekanismLang.BUTTON_STOP, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.STOP_BUTTON, tile))));
    configButton = addButton(new TranslationButton(this, 87, buttonStart + 34, 61, 18, MekanismLang.BUTTON_CONFIG, () -> Mekanism.packetHandler.sendToServer(new PacketGuiButtonPress(ClickedTileButton.DIGITAL_MINER_CONFIG, tile))));
    addButton(new TranslationButton(this, 87, buttonStart + 51, 61, 18, MekanismLang.MINER_RESET, () -> Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteraction.RESET_BUTTON, tile))));
    updateEnabledButtons();
    trackWarning(WarningType.FILTER_HAS_BLACKLISTED_ELEMENT, () -> tile.getFilters().stream().anyMatch(MinerFilter::hasBlacklistedElement));
}
Also used : PacketGuiButtonPress(mekanism.common.network.to_server.PacketGuiButtonPress) TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiDigitalSwitch(mekanism.client.gui.element.GuiDigitalSwitch) ArrayList(java.util.ArrayList) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) FloatingLong(mekanism.api.math.FloatingLong) MinerEnergyContainer(mekanism.common.capabilities.energy.MinerEnergyContainer) ArrayList(java.util.ArrayList) List(java.util.List) GuiVisualsTab(mekanism.client.gui.element.tab.GuiVisualsTab) ILangEntry(mekanism.api.text.ILangEntry)

Example 12 with GuiInnerScreen

use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.

the class GuiElectricPump method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 54, 23, 80, 41, () -> {
        List<ITextComponent> list = new ArrayList<>();
        list.add(EnergyDisplay.of(tile.getEnergyContainer()).getTextComponent());
        FluidStack fluidStack = tile.fluidTank.getFluid();
        if (fluidStack.isEmpty()) {
            list.add(MekanismLang.NO_FLUID.translate());
        } else {
            list.add(MekanismLang.GENERIC_STORED_MB.translate(fluidStack, TextUtils.format(fluidStack.getAmount())));
        }
        return list;
    }));
    addButton(new GuiDownArrow(this, 32, 39));
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiFluidGauge(() -> tile.fluidTank, () -> tile.getFluidTanks(null), GaugeType.STANDARD, this, 6, 13));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiFluidGauge(mekanism.client.gui.element.gauge.GuiFluidGauge) GuiDownArrow(mekanism.client.gui.element.GuiDownArrow) FluidStack(net.minecraftforge.fluids.FluidStack) ArrayList(java.util.ArrayList) List(java.util.List) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 13 with GuiInnerScreen

use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.

the class GuiChemicalCrystallizer method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 157, 23));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getActive));
    addButton(new GuiMergedChemicalTankGauge<>(() -> tile.inputTank, () -> tile, GaugeType.STANDARD, this, 7, 4));
    addButton(new GuiProgress(tile::getScaledProgress, ProgressType.LARGE_RIGHT, this, 53, 61).jeiCategory(tile));
    // Init slot display before gui screen, so it can reference it, but add it after, so it renders above it
    slotDisplay = new GuiSequencedSlotDisplay(this, 129, 14, () -> iterStacks);
    updateSlotContents();
    addButton(new GuiInnerScreen(this, 31, 13, 115, 42, () -> getScreenRenderStrings(this.oreInfo)));
    addButton(new GuiSlot(SlotType.ORE, this, 128, 13).setRenderAboveSlots());
    addButton(slotDisplay);
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiSequencedSlotDisplay(mekanism.client.gui.element.slot.GuiSequencedSlotDisplay) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 14 with GuiInnerScreen

use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.

the class GuiFuelwoodHeater method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 48, 23, 80, 28, () -> Arrays.asList(MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(tile.getTotalTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.FUEL.translate(tile.burnTime))));
    addButton(new GuiFlame(new IProgressInfoHandler() {

        @Override
        public double getProgress() {
            return tile.burnTime / (double) tile.maxBurnTime;
        }

        @Override
        public boolean isActive() {
            return tile.burnTime > 0;
        }
    }, this, 144, 31));
    addButton(new GuiHeatTab(this, () -> {
        ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getLastEnvironmentLoss(), TemperatureUnit.KELVIN, false);
        return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
    }));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) IProgressInfoHandler(mekanism.client.gui.element.progress.IProgressInfoHandler) ITextComponent(net.minecraft.util.text.ITextComponent) GuiHeatTab(mekanism.client.gui.element.tab.GuiHeatTab) GuiFlame(mekanism.client.gui.element.progress.GuiFlame)

Example 15 with GuiInnerScreen

use of mekanism.client.gui.element.GuiInnerScreen in project Mekanism by mekanism.

the class GuiFilter method init.

protected void init() {
    int screenTop = relativeY + 18;
    int screenBottom = screenTop + getScreenHeight();
    addChild(new GuiInnerScreen(gui(), relativeX + 29, screenTop, getScreenWidth(), getScreenHeight(), this::getScreenText).clearFormat());
    addChild(new TranslationButton(gui(), getLeftButtonX(), screenBottom + 2, 60, 20, isNew ? MekanismLang.BUTTON_CANCEL : MekanismLang.BUTTON_DELETE, () -> {
        if (origFilter != null) {
            Mekanism.packetHandler.sendToServer(new PacketEditFilter(tile.getBlockPos(), true, origFilter, null));
        }
        close();
    }));
    addChild(new TranslationButton(gui(), getLeftButtonX() + 62, screenBottom + 2, 60, 20, MekanismLang.BUTTON_SAVE, this::validateAndSave));
    addChild(new GuiSlot(SlotType.NORMAL, gui(), relativeX + 7, relativeY + getSlotOffset()).setRenderHover(true).setGhostHandler(getGhostHandler()));
    slotDisplay = addChild(new GuiSequencedSlotDisplay(gui(), relativeX + 8, relativeY + getSlotOffset() + 1, this::getRenderStacks));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) PacketEditFilter(mekanism.common.network.to_server.PacketEditFilter) TranslationButton(mekanism.client.gui.element.button.TranslationButton) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) GuiSequencedSlotDisplay(mekanism.client.gui.element.slot.GuiSequencedSlotDisplay)

Aggregations

GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)26 ArrayList (java.util.ArrayList)12 GuiEnergyTab (mekanism.client.gui.element.tab.GuiEnergyTab)12 ITextComponent (net.minecraft.util.text.ITextComponent)11 List (java.util.List)10 GuiVerticalPowerBar (mekanism.client.gui.element.bar.GuiVerticalPowerBar)10 IBarInfoHandler (mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler)6 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)6 GuiGasGauge (mekanism.client.gui.element.gauge.GuiGasGauge)5 GuiHeatTab (mekanism.client.gui.element.tab.GuiHeatTab)5 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)4 GuiDownArrow (mekanism.client.gui.element.GuiDownArrow)4 GuiElementHolder (mekanism.client.gui.element.GuiElementHolder)4 TranslationButton (mekanism.client.gui.element.button.TranslationButton)4 GuiFluidGauge (mekanism.client.gui.element.gauge.GuiFluidGauge)4 Nonnull (javax.annotation.Nonnull)3 GuiDynamicHorizontalRateBar (mekanism.client.gui.element.bar.GuiDynamicHorizontalRateBar)3 GuiScrollBar (mekanism.client.gui.element.scroll.GuiScrollBar)3 GuiTextField (mekanism.client.gui.element.text.GuiTextField)3 Mekanism (mekanism.common.Mekanism)3