Search in sources :

Example 11 with IconButton

use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.

the class SchematicannonScreen method handleTooltips.

protected void handleTooltips() {
    if (placementSettingsHidden())
        return;
    for (AbstractWidget w : placementSettingWidgets) if (w instanceof IconButton) {
        IconButton button = (IconButton) w;
        if (!button.getToolTip().isEmpty()) {
            button.setToolTip(button.getToolTip().get(0));
            button.getToolTip().add(TooltipHelper.holdShift(Palette.Blue, hasShiftDown()));
        }
    }
    if (hasShiftDown()) {
        fillToolTip(skipMissingButton, skipMissingIndicator, "skipMissing");
        fillToolTip(skipTilesButton, skipTilesIndicator, "skipTileEntities");
        fillToolTip(replaceLevelButtons.get(0), replaceLevelIndicators.get(0), "dontReplaceSolid");
        fillToolTip(replaceLevelButtons.get(1), replaceLevelIndicators.get(1), "replaceWithSolid");
        fillToolTip(replaceLevelButtons.get(2), replaceLevelIndicators.get(2), "replaceWithAny");
        fillToolTip(replaceLevelButtons.get(3), replaceLevelIndicators.get(3), "replaceWithEmpty");
    }
}
Also used : IconButton(com.simibubi.create.foundation.gui.widget.IconButton) AbstractWidget(net.minecraft.client.gui.components.AbstractWidget)

Example 12 with IconButton

use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.

the class AbstractFilterScreen method handleTooltips.

protected void handleTooltips() {
    List<IconButton> tooltipButtons = getTooltipButtons();
    for (IconButton button : tooltipButtons) {
        if (!button.getToolTip().isEmpty()) {
            button.setToolTip(button.getToolTip().get(0));
            button.getToolTip().add(TooltipHelper.holdShift(Palette.Yellow, hasShiftDown()));
        }
    }
    if (hasShiftDown()) {
        List<MutableComponent> tooltipDescriptions = getTooltipDescriptions();
        for (int i = 0; i < tooltipButtons.size(); i++) fillToolTip(tooltipButtons.get(i), tooltipDescriptions.get(i));
    }
}
Also used : IconButton(com.simibubi.create.foundation.gui.widget.IconButton) MutableComponent(net.minecraft.network.chat.MutableComponent)

Example 13 with IconButton

use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.

the class FilterScreen method init.

@Override
protected void init() {
    setWindowOffset(-11, 5);
    super.init();
    int x = leftPos;
    int y = topPos;
    blacklist = new IconButton(x + 18, y + 73, AllIcons.I_BLACKLIST);
    blacklist.withCallback(() -> {
        menu.blacklist = true;
        sendOptionUpdate(Option.BLACKLIST);
    });
    blacklist.setToolTip(denyN);
    whitelist = new IconButton(x + 36, y + 73, AllIcons.I_WHITELIST);
    whitelist.withCallback(() -> {
        menu.blacklist = false;
        sendOptionUpdate(Option.WHITELIST);
    });
    whitelist.setToolTip(allowN);
    blacklistIndicator = new Indicator(x + 18, y + 67, TextComponent.EMPTY);
    whitelistIndicator = new Indicator(x + 36, y + 67, TextComponent.EMPTY);
    addRenderableWidgets(blacklist, whitelist, blacklistIndicator, whitelistIndicator);
    respectNBT = new IconButton(x + 60, y + 73, AllIcons.I_RESPECT_NBT);
    respectNBT.withCallback(() -> {
        menu.respectNBT = true;
        sendOptionUpdate(Option.RESPECT_DATA);
    });
    respectNBT.setToolTip(respectDataN);
    ignoreNBT = new IconButton(x + 78, y + 73, AllIcons.I_IGNORE_NBT);
    ignoreNBT.withCallback(() -> {
        menu.respectNBT = false;
        sendOptionUpdate(Option.IGNORE_DATA);
    });
    ignoreNBT.setToolTip(ignoreDataN);
    respectNBTIndicator = new Indicator(x + 60, y + 67, TextComponent.EMPTY);
    ignoreNBTIndicator = new Indicator(x + 78, y + 67, TextComponent.EMPTY);
    addRenderableWidgets(respectNBT, ignoreNBT, respectNBTIndicator, ignoreNBTIndicator);
    handleIndicators();
}
Also used : IconButton(com.simibubi.create.foundation.gui.widget.IconButton) Indicator(com.simibubi.create.foundation.gui.widget.Indicator)

Example 14 with IconButton

use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.

the class SequencedGearshiftScreen method init.

@Override
protected void init() {
    setWindowSize(background.width, background.height);
    setWindowOffset(-20, 0);
    super.init();
    int x = guiLeft;
    int y = guiTop;
    inputs = new Vector<>(5);
    for (int row = 0; row < inputs.capacity(); row++) inputs.add(new Vector<>(3));
    for (int row = 0; row < instructions.size(); row++) initInputsOfRow(row, x, y);
    confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        onClose();
    });
    addRenderableWidget(confirmButton);
}
Also used : IconButton(com.simibubi.create.foundation.gui.widget.IconButton) Vector(java.util.Vector)

Example 15 with IconButton

use of com.simibubi.create.foundation.gui.widget.IconButton in project Create by Creators-of-Create.

the class ZapperScreen method init.

@Override
protected void init() {
    setWindowSize(background.width, background.height);
    setWindowOffset(-10, 0);
    super.init();
    animationProgress = 0;
    int x = guiLeft;
    int y = guiTop;
    confirmButton = new IconButton(x + background.width - 33, y + background.height - 24, AllIcons.I_CONFIRM);
    confirmButton.withCallback(() -> {
        onClose();
    });
    addRenderableWidget(confirmButton);
    patternButtons.clear();
    for (int row = 0; row <= 1; row++) {
        for (int col = 0; col <= 2; col++) {
            int id = patternButtons.size();
            PlacementPatterns pattern = PlacementPatterns.values()[id];
            IconButton patternButton = new IconButton(x + background.width - 76 + col * 18, y + 21 + row * 18, pattern.icon);
            patternButton.withCallback(() -> {
                patternButtons.forEach(b -> b.active = true);
                patternButton.active = false;
                currentPattern = pattern;
            });
            patternButton.setToolTip(Lang.translate("gui.terrainzapper.pattern." + pattern.translationKey));
            patternButtons.add(patternButton);
        }
    }
    patternButtons.get(currentPattern.ordinal()).active = false;
    addRenderableWidgets(patternButtons);
}
Also used : IconButton(com.simibubi.create.foundation.gui.widget.IconButton)

Aggregations

IconButton (com.simibubi.create.foundation.gui.widget.IconButton)18 Rect2i (net.minecraft.client.renderer.Rect2i)6 Indicator (com.simibubi.create.foundation.gui.widget.Indicator)5 Label (com.simibubi.create.foundation.gui.widget.Label)5 SelectionScrollInput (com.simibubi.create.foundation.gui.widget.SelectionScrollInput)5 TextComponent (net.minecraft.network.chat.TextComponent)3 ScrollInput (com.simibubi.create.foundation.gui.widget.ScrollInput)2 EditBox (net.minecraft.client.gui.components.EditBox)2 Component (net.minecraft.network.chat.Component)2 CrossPlaneMirror (com.simibubi.create.content.curiosities.symmetry.mirror.CrossPlaneMirror)1 PlaneMirror (com.simibubi.create.content.curiosities.symmetry.mirror.PlaneMirror)1 TriplePlaneMirror (com.simibubi.create.content.curiosities.symmetry.mirror.TriplePlaneMirror)1 ClientSchematicLoader (com.simibubi.create.content.schematics.ClientSchematicLoader)1 AllIcons (com.simibubi.create.foundation.gui.AllIcons)1 Vector (java.util.Vector)1 AbstractWidget (net.minecraft.client.gui.components.AbstractWidget)1 BlockPos (net.minecraft.core.BlockPos)1 MutableComponent (net.minecraft.network.chat.MutableComponent)1 TranslatableComponent (net.minecraft.network.chat.TranslatableComponent)1 StructurePlaceSettings (net.minecraft.world.level.levelgen.structure.templatesystem.StructurePlaceSettings)1