Search in sources :

Example 21 with GuiInnerScreen

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

the class GuiThermoelectricBoiler method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 60, 23, 96, 40, () -> {
        BoilerMultiblockData multiblock = tile.getMultiblock();
        return Arrays.asList(MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(multiblock.getTotalTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.BOIL_RATE.translate(TextUtils.format(multiblock.lastBoilRate)), MekanismLang.MAX_BOIL_RATE.translate(TextUtils.format(multiblock.lastMaxBoil)));
    }).jeiCategories(MekanismBlocks.BOILER_CASING.getRegistryName()));
    addButton(new GuiBoilerTab(this, tile, BoilerTab.STAT));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.BOIL_RATE.translate(TextUtils.format(tile.getMultiblock().lastBoilRate));
        }

        @Override
        public double getLevel() {
            BoilerMultiblockData multiblock = tile.getMultiblock();
            return Math.min(1, multiblock.lastBoilRate / (double) multiblock.lastMaxBoil);
        }
    }, 44, 13));
    addButton(new GuiVerticalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.MAX_BOIL_RATE.translate(TextUtils.format(tile.getMultiblock().lastMaxBoil));
        }

        @Override
        public double getLevel() {
            BoilerMultiblockData multiblock = tile.getMultiblock();
            return Math.min(1, multiblock.lastMaxBoil * HeatUtils.getWaterThermalEnthalpy() / (multiblock.superheatingElements * MekanismConfig.general.superheatingHeatTransfer.get()));
        }
    }, 164, 13));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().superheatedCoolantTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 6, 13).setLabel(MekanismLang.BOILER_HEATED_COOLANT_TANK.translateColored(EnumColor.ORANGE)));
    addButton(new GuiFluidGauge(() -> tile.getMultiblock().waterTank, () -> tile.getMultiblock().getFluidTanks(null), GaugeType.STANDARD, this, 26, 13).setLabel(MekanismLang.BOILER_WATER_TANK.translateColored(EnumColor.INDIGO)));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().steamTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 172, 13).setLabel(MekanismLang.BOILER_STEAM_TANK.translateColored(EnumColor.GRAY)));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().cooledCoolantTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 192, 13).setLabel(MekanismLang.BOILER_COOLANT_TANK.translateColored(EnumColor.AQUA)));
    addButton(new GuiHeatTab(this, () -> {
        ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getMultiblock().lastEnvironmentLoss, TemperatureUnit.KELVIN, false);
        return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
    }));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiFluidGauge(mekanism.client.gui.element.gauge.GuiFluidGauge) GuiBoilerTab(mekanism.client.gui.element.tab.GuiBoilerTab) IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiVerticalRateBar(mekanism.client.gui.element.bar.GuiVerticalRateBar) BoilerMultiblockData(mekanism.common.content.boiler.BoilerMultiblockData) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) ITextComponent(net.minecraft.util.text.ITextComponent) GuiHeatTab(mekanism.client.gui.element.tab.GuiHeatTab)

Example 22 with GuiInnerScreen

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

the class GuiFluidicPlenisher 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());
        list.add(MekanismLang.FINISHED.translate(YesNo.of(tile.finishedCalc)));
        FluidStack fluid = tile.fluidTank.getFluid();
        if (fluid.isEmpty()) {
            list.add(MekanismLang.NO_FLUID.translate());
        } else {
            list.add(MekanismLang.GENERIC_STORED_MB.translate(fluid, TextUtils.format(fluid.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 23 with GuiInnerScreen

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

the class GuiSeismicReader method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 7, 11, 63, 49));
    addButton(new GuiInnerScreen(this, 74, 11, 51, 159));
    scrollBar = addButton(new GuiScrollBar(this, 126, 25, 131, blockList::size, () -> 1));
    addButton(new GuiArrowSelection(this, 76, 81, () -> {
        int currentLayer = scrollBar.getCurrentSelection();
        if (currentLayer >= 0) {
            return blockList.get(blockList.size() - 1 - currentLayer).getBlock().getName();
        }
        return null;
    }));
    upButton = addButton(new MekanismImageButton(this, 126, 11, 14, MekanismUtils.getResource(ResourceType.GUI_BUTTON, "up.png"), () -> scrollBar.adjustScroll(1)));
    downButton = addButton(new MekanismImageButton(this, 126, 156, 14, MekanismUtils.getResource(ResourceType.GUI_BUTTON, "down.png"), () -> scrollBar.adjustScroll(-1)));
    updateEnabledButtons();
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) GuiScrollBar(mekanism.client.gui.element.scroll.GuiScrollBar) MekanismImageButton(mekanism.client.gui.element.button.MekanismImageButton) GuiArrowSelection(mekanism.client.gui.element.GuiArrowSelection)

Example 24 with GuiInnerScreen

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

the class GuiAntiprotonicNucleosynthesizer method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 45, 18, 104, 68).jeiCategory(tile));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer(), tile::getEnergyUsed));
    addButton(new GuiGasGauge(() -> tile.gasTank, () -> tile.getGasTanks(null), GaugeType.SMALL_MED, this, 5, 18));
    addButton(new GuiEnergyGauge(tile.getEnergyContainer(), GaugeType.SMALL_MED, this, 172, 18));
    addButton(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return MekanismLang.PROGRESS.translate(TextUtils.getPercent(tile.getScaledProgress()));
        }

        @Override
        public double getLevel() {
            return Math.min(1, tile.getScaledProgress());
        }
    }, 5, 88, 183, ColorFunction.scale(Color.rgbi(60, 45, 74), Color.rgbi(100, 30, 170))));
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) GuiDynamicHorizontalRateBar(mekanism.client.gui.element.bar.GuiDynamicHorizontalRateBar) GuiEnergyGauge(mekanism.client.gui.element.gauge.GuiEnergyGauge) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab)

Example 25 with GuiInnerScreen

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

the class GuiQIORedstoneAdapter method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiQIOFrequencyTab(this, tile));
    addButton(new GuiSlot(SlotType.NORMAL, this, 7, 30).setRenderHover(true)).setGhostHandler((IGhostItemConsumer) ingredient -> {
        Mekanism.packetHandler.sendToServer(new PacketGuiInteract(GuiInteractionItem.QIO_REDSTONE_ADAPTER_STACK, tile, StackUtils.size((ItemStack) ingredient, 1)));
        minecraft.getSoundManager().play(SimpleSound.forUI(MekanismSounds.BEEP.get(), 1.0F));
    });
    addButton(new GuiInnerScreen(this, 7, 16, imageWidth - 15, 12, () -> {
        List<ITextComponent> list = new ArrayList<>();
        QIOFrequency freq = tile.getQIOFrequency();
        if (freq == null) {
            list.add(MekanismLang.NO_FREQUENCY.translate());
        } else {
            list.add(MekanismLang.FREQUENCY.translate(freq.getKey()));
        }
        return list;
    }).tooltip(() -> {
        List<ITextComponent> list = new ArrayList<>();
        QIOFrequency freq = tile.getQIOFrequency();
        if (freq != null) {
            list.add(MekanismLang.QIO_ITEMS_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(freq.getTotalItemCount()), TextUtils.format(freq.getTotalItemCountCapacity())));
            list.add(MekanismLang.QIO_TYPES_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(freq.getTotalItemTypes(true)), TextUtils.format(freq.getTotalItemTypeCapacity())));
        }
        return list;
    }));
    addButton(new GuiInnerScreen(this, 27, 30, imageWidth - 27 - 8, 54, () -> {
        List<ITextComponent> list = new ArrayList<>();
        list.add(!tile.getItemType().isEmpty() ? tile.getItemType().getStack().getHoverName() : MekanismLang.QIO_ITEM_TYPE_UNDEFINED.translate());
        list.add(MekanismLang.QIO_TRIGGER_COUNT.translate(TextUtils.format(tile.getCount())));
        if (!tile.getItemType().isEmpty() && tile.getQIOFrequency() != null) {
            list.add(MekanismLang.QIO_STORED_COUNT.translate(TextUtils.format(tile.getStoredCount())));
        }
        return list;
    }).clearFormat());
    text = addButton(new GuiTextField(this, 29, 70, imageWidth - 39, 12));
    text.setMaxStringLength(10);
    text.setInputValidator(InputValidator.DIGIT);
    text.setFocused(true);
    text.configureDigitalInput(this::setCount);
}
Also used : GuiTextField(mekanism.client.gui.element.text.GuiTextField) EnumColor(mekanism.api.text.EnumColor) TextUtils(mekanism.common.util.text.TextUtils) SimpleSound(net.minecraft.client.audio.SimpleSound) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) MekanismSounds(mekanism.common.registries.MekanismSounds) ArrayList(java.util.ArrayList) ITextComponent(net.minecraft.util.text.ITextComponent) InputValidator(mekanism.common.util.text.InputValidator) ItemStack(net.minecraft.item.ItemStack) IGhostItemConsumer(mekanism.client.jei.interfaces.IJEIGhostTarget.IGhostItemConsumer) GuiQIOFrequencyTab(mekanism.client.gui.element.tab.GuiQIOFrequencyTab) QIOFrequency(mekanism.common.content.qio.QIOFrequency) GuiInteractionItem(mekanism.common.network.to_server.PacketGuiInteract.GuiInteractionItem) TileEntityQIORedstoneAdapter(mekanism.common.tile.qio.TileEntityQIORedstoneAdapter) Nonnull(javax.annotation.Nonnull) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) Mekanism(mekanism.common.Mekanism) PlayerInventory(net.minecraft.entity.player.PlayerInventory) StackUtils(mekanism.common.util.StackUtils) SlotType(mekanism.client.gui.element.slot.SlotType) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) List(java.util.List) MekanismTileContainer(mekanism.common.inventory.container.tile.MekanismTileContainer) GuiInteraction(mekanism.common.network.to_server.PacketGuiInteract.GuiInteraction) MekanismLang(mekanism.common.MekanismLang) GuiMekanismTile(mekanism.client.gui.GuiMekanismTile) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) GuiSlot(mekanism.client.gui.element.slot.GuiSlot) GuiQIOFrequencyTab(mekanism.client.gui.element.tab.GuiQIOFrequencyTab) PacketGuiInteract(mekanism.common.network.to_server.PacketGuiInteract) GuiTextField(mekanism.client.gui.element.text.GuiTextField) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) ArrayList(java.util.ArrayList) List(java.util.List) ItemStack(net.minecraft.item.ItemStack) QIOFrequency(mekanism.common.content.qio.QIOFrequency)

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