Search in sources :

Example 1 with GuiTextField

use of mekanism.client.gui.element.text.GuiTextField in project Mekanism by mekanism.

the class GuiQIOItemViewer method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    int slotsY = MekanismConfig.client.qioItemViewerSlotsY.get();
    getMinecraft().keyboardHandler.setSendRepeatsToGui(true);
    addButton(new GuiInnerScreen(this, 7, 15, imageWidth - 16, 12, () -> {
        List<ITextComponent> list = new ArrayList<>();
        FrequencyIdentity freq = getFrequency();
        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<>();
        if (getFrequency() != null) {
            list.add(MekanismLang.QIO_ITEMS_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalItems()), TextUtils.format(menu.getCountCapacity())));
            list.add(MekanismLang.QIO_TYPES_DETAIL.translateColored(EnumColor.GRAY, EnumColor.INDIGO, TextUtils.format(menu.getTotalTypes()), TextUtils.format(menu.getTypeCapacity())));
        }
        return list;
    }));
    searchField = addButton(new GuiTextField(this, 50, 15 + 12 + 3, imageWidth - 50 - 10, 10));
    searchField.setOffset(0, -1);
    searchField.setInputValidator(this::isValidSearchChar);
    searchField.setResponder(menu::updateSearch);
    searchField.setMaxStringLength(50);
    searchField.setBackground(BackgroundType.ELEMENT_HOLDER);
    searchField.setVisible(true);
    searchField.setTextColor(0xFFFFFF);
    searchField.setFocused(true);
    addButton(new GuiSlotScroll(this, 7, QIOItemViewerContainer.SLOTS_START_Y, MekanismConfig.client.qioItemViewerSlotsX.get(), slotsY, menu::getQIOItemList, menu));
    addButton(new GuiDropdown<>(this, imageWidth - 9 - 54, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 41, ListSortType.class, menu::getSortType, menu::setSortType));
    addButton(new GuiDigitalIconToggle<>(this, imageWidth - 9 - 12, QIOItemViewerContainer.SLOTS_START_Y + slotsY * 18 + 1, 12, 12, SortDirection.class, menu::getSortDirection, menu::setSortDirection));
    addButton(new GuiResizeControls(this, (getMinecraft().getWindow().getGuiScaledHeight() / 2) - 20 - topPos, this::resize));
    craftingWindowTab = addButton(new GuiCraftingWindowTab(this, () -> craftingWindowTab, menu));
}
Also used : ListSortType(mekanism.common.inventory.container.QIOItemViewerContainer.ListSortType) GuiSlotScroll(mekanism.client.gui.element.scroll.GuiSlotScroll) FrequencyIdentity(mekanism.common.lib.frequency.Frequency.FrequencyIdentity) ITextComponent(net.minecraft.util.text.ITextComponent) ArrayList(java.util.ArrayList) GuiTextField(mekanism.client.gui.element.text.GuiTextField) GuiResizeControls(mekanism.client.gui.element.custom.GuiResizeControls) GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) SortDirection(mekanism.common.inventory.container.QIOItemViewerContainer.SortDirection) ArrayList(java.util.ArrayList) List(java.util.List) GuiCraftingWindowTab(mekanism.client.gui.element.tab.window.GuiCraftingWindowTab)

Example 2 with GuiTextField

use of mekanism.client.gui.element.text.GuiTextField in project Mekanism by mekanism.

the class GuiResistiveHeater method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiInnerScreen(this, 48, 23, 80, 42, () -> Arrays.asList(MekanismLang.TEMPERATURE.translate(MekanismUtils.getTemperatureDisplay(tile.getTotalTemperature(), TemperatureUnit.KELVIN, true)), MekanismLang.RESISTIVE_HEATER_USAGE.translate(EnergyDisplay.of(tile.getEnergyContainer().getEnergyPerTick())))).clearFormat());
    addButton(new GuiVerticalPowerBar(this, tile.getEnergyContainer(), 164, 15));
    addButton(new GuiEnergyTab(this, tile.getEnergyContainer()));
    addButton(new GuiHeatTab(this, () -> {
        ITextComponent environment = MekanismUtils.getTemperatureDisplay(tile.getLastEnvironmentLoss(), TemperatureUnit.KELVIN, false);
        return Collections.singletonList(MekanismLang.DISSIPATED_RATE.translate(environment));
    }));
    energyUsageField = addButton(new GuiTextField(this, 50, 51, 76, 12));
    energyUsageField.setText(energyUsageField.getText());
    energyUsageField.setMaxStringLength(7);
    energyUsageField.setInputValidator(InputValidator.DIGIT);
    energyUsageField.configureDigitalInput(this::setEnergyUsage);
    energyUsageField.setFocused(true);
}
Also used : GuiInnerScreen(mekanism.client.gui.element.GuiInnerScreen) ITextComponent(net.minecraft.util.text.ITextComponent) GuiVerticalPowerBar(mekanism.client.gui.element.bar.GuiVerticalPowerBar) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) GuiTextField(mekanism.client.gui.element.text.GuiTextField) GuiHeatTab(mekanism.client.gui.element.tab.GuiHeatTab)

Example 3 with GuiTextField

use of mekanism.client.gui.element.text.GuiTextField in project Mekanism by mekanism.

the class GuiFusionReactorFuel method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiEnergyTab(this, () -> {
        FusionReactorMultiblockData multiblock = tile.getMultiblock();
        return Arrays.asList(MekanismLang.STORING.translate(EnergyDisplay.of(multiblock.energyContainer)), GeneratorsLang.PRODUCING_AMOUNT.translate(EnergyDisplay.of(multiblock.getPassiveGeneration(false, true))));
    }));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().deuteriumTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.SMALL, this, 25, 64));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().fuelTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.STANDARD, this, 79, 50));
    addButton(new GuiGasGauge(() -> tile.getMultiblock().tritiumTank, () -> tile.getMultiblock().getGasTanks(null), GaugeType.SMALL, this, 133, 64));
    addButton(new GuiProgress(() -> tile.getMultiblock().isBurning(), ProgressType.SMALL_RIGHT, this, 47, 76));
    addButton(new GuiProgress(() -> tile.getMultiblock().isBurning(), ProgressType.SMALL_LEFT, this, 101, 76));
    addButton(new GuiFusionReactorTab(this, tile, FusionReactorTab.HEAT));
    addButton(new GuiFusionReactorTab(this, tile, FusionReactorTab.STAT));
    injectionRateField = addButton(new GuiTextField(this, 98, 115, 26, 11));
    injectionRateField.changeFocus(true);
    injectionRateField.setInputValidator(InputValidator.DIGIT);
    injectionRateField.setEnterHandler(this::setInjection);
    injectionRateField.setMaxStringLength(2);
}
Also used : GuiFusionReactorTab(mekanism.generators.client.gui.element.GuiFusionReactorTab) FusionReactorMultiblockData(mekanism.generators.common.content.fusion.FusionReactorMultiblockData) GuiProgress(mekanism.client.gui.element.progress.GuiProgress) GuiGasGauge(mekanism.client.gui.element.gauge.GuiGasGauge) GuiEnergyTab(mekanism.client.gui.element.tab.GuiEnergyTab) GuiTextField(mekanism.client.gui.element.text.GuiTextField)

Example 4 with GuiTextField

use of mekanism.client.gui.element.text.GuiTextField in project Mekanism by mekanism.

the class GuiFissionReactorStats method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiFissionReactorTab(this, tile, FissionReactorTab.MAIN));
    addButton(new GuiDynamicHorizontalRateBar(this, new IBarInfoHandler() {

        @Override
        public ITextComponent getTooltip() {
            return GeneratorsLang.GAS_BURN_RATE.translate(tile.getMultiblock().lastBurnRate);
        }

        @Override
        public double getLevel() {
            FissionReactorMultiblockData multiblock = tile.getMultiblock();
            return Math.min(1, multiblock.lastBurnRate / multiblock.getMaxBurnRate());
        }
    }, 5, 114, imageWidth - 12));
    rateLimitField = addButton(new GuiTextField(this, 77, 128, 49, 12));
    rateLimitField.setEnterHandler(this::setRateLimit);
    rateLimitField.setInputValidator(InputValidator.DECIMAL);
    rateLimitField.setMaxStringLength(4);
    rateLimitField.addCheckmarkButton(this::setRateLimit);
}
Also used : GuiFissionReactorTab(mekanism.generators.client.gui.element.GuiFissionReactorTab) IBarInfoHandler(mekanism.client.gui.element.bar.GuiBar.IBarInfoHandler) GuiDynamicHorizontalRateBar(mekanism.client.gui.element.bar.GuiDynamicHorizontalRateBar) FissionReactorMultiblockData(mekanism.generators.common.content.fission.FissionReactorMultiblockData) GuiTextField(mekanism.client.gui.element.text.GuiTextField)

Example 5 with GuiTextField

use of mekanism.client.gui.element.text.GuiTextField in project Mekanism by mekanism.

the class GuiLaserAmplifier method addGuiElements.

@Override
protected void addGuiElements() {
    super.addGuiElements();
    addButton(new GuiEnergyGauge(tile.getEnergyContainer(), GaugeType.STANDARD, this, 6, 10));
    addButton(new GuiAmplifierTab(this, tile));
    timerField = addButton(new GuiTextField(this, 96, 28, 36, 11));
    timerField.setMaxStringLength(4);
    timerField.setEnterHandler(this::setTime);
    timerField.setInputValidator(InputValidator.DIGIT);
    minField = addButton(new GuiTextField(this, 96, 43, 72, 11));
    minField.setMaxStringLength(10);
    minField.setEnterHandler(this::setMinThreshold);
    minField.setInputValidator(InputValidator.SCI_NOTATION);
    maxField = addButton(new GuiTextField(this, 96, 58, 72, 11));
    maxField.setMaxStringLength(10);
    maxField.setEnterHandler(this::setMaxThreshold);
    maxField.setInputValidator(InputValidator.SCI_NOTATION);
}
Also used : GuiAmplifierTab(mekanism.client.gui.element.tab.GuiAmplifierTab) GuiEnergyGauge(mekanism.client.gui.element.gauge.GuiEnergyGauge) GuiTextField(mekanism.client.gui.element.text.GuiTextField)

Aggregations

GuiTextField (mekanism.client.gui.element.text.GuiTextField)9 GuiSlot (mekanism.client.gui.element.slot.GuiSlot)4 ITextComponent (net.minecraft.util.text.ITextComponent)4 MatrixStack (com.mojang.blaze3d.matrix.MatrixStack)3 List (java.util.List)3 GuiInnerScreen (mekanism.client.gui.element.GuiInnerScreen)3 MekanismImageButton (mekanism.client.gui.element.button.MekanismImageButton)3 SlotType (mekanism.client.gui.element.slot.SlotType)3 MekanismLang (mekanism.common.MekanismLang)3 PacketGuiInteract (mekanism.common.network.to_server.PacketGuiInteract)3 InputValidator (mekanism.common.util.text.InputValidator)3 ArrayList (java.util.ArrayList)2 Nonnull (javax.annotation.Nonnull)2 EnumColor (mekanism.api.text.EnumColor)2 TranslationButton (mekanism.client.gui.element.button.TranslationButton)2 Mekanism (mekanism.common.Mekanism)2 MekanismTileContainer (mekanism.common.inventory.container.tile.MekanismTileContainer)2 GuiInteraction (mekanism.common.network.to_server.PacketGuiInteract.GuiInteraction)2 GuiInteractionItem (mekanism.common.network.to_server.PacketGuiInteract.GuiInteractionItem)2 MekanismUtils (mekanism.common.util.MekanismUtils)2