Search in sources :

Example 1 with WidgetGroup

use of com.lowdragmc.lowdraglib.gui.widget.WidgetGroup in project Multiblocked by Low-Drag-MC.

the class ComponentWidget method createBoolSwitch.

protected WidgetGroup createBoolSwitch(int x, int y, String text, String tips, boolean init, Consumer<Boolean> onPressed) {
    WidgetGroup widgetGroup = new WidgetGroup(x, y, 100, 15);
    widgetGroup.addWidget(new SwitchWidget(0, 0, 15, 15, (cd, r) -> onPressed.accept(r)).setBaseTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0, 0, 1, 0.5)).setPressedTexture(new ResourceTexture("multiblocked:textures/gui/boolean.png").getSubTexture(0, 0.5, 1, 0.5)).setHoverTexture(new ColorBorderTexture(1, 0xff545757)).setPressed(init).setHoverTooltips(tips));
    widgetGroup.addWidget(new LabelWidget(20, 3, text));
    return widgetGroup;
}
Also used : ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) ColorBorderTexture(com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) SwitchWidget(com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)

Example 2 with WidgetGroup

use of com.lowdragmc.lowdraglib.gui.widget.WidgetGroup in project Multiblocked by Low-Drag-MC.

the class ChemicalStackWidget method openConfigurator.

@Override
public void openConfigurator(WidgetGroup dialog) {
    super.openConfigurator(dialog);
    int x = 5;
    int y = 25;
    dialog.addWidget(new LabelWidget(5, y + 3, "multiblocked.gui.label.amount"));
    dialog.addWidget(new TextFieldWidget(125 - 60, y, 60, 15, null, number -> {
        content = CAP.copyInner(content);
        content.setAmount(Long.parseLong(number));
        onContentUpdate();
    }).setNumbersOnly(1L, Long.MAX_VALUE).setCurrentString(content.getAmount() + ""));
}
Also used : ContentWidget(com.lowdragmc.multiblocked.api.gui.recipe.ContentWidget) Position(com.lowdragmc.lowdraglib.utils.Position) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) LocalizationUtils(com.lowdragmc.lowdraglib.utils.LocalizationUtils) ChemicalStack(mekanism.api.chemical.ChemicalStack) Size(com.lowdragmc.lowdraglib.utils.Size) TextFormatting(net.minecraft.util.text.TextFormatting) ChemicalMekanismCapability(com.lowdragmc.multiblocked.common.capability.ChemicalMekanismCapability) IChemicalHandler(mekanism.api.chemical.IChemicalHandler) GuiUtils(mekanism.client.gui.GuiUtils) MathUtils(mekanism.api.math.MathUtils) I18n(net.minecraft.client.resources.I18n) FontRenderer(net.minecraft.client.gui.FontRenderer) MekanismRenderer(mekanism.client.render.MekanismRenderer) Minecraft(net.minecraft.client.Minecraft) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) Chemical(mekanism.api.chemical.Chemical) TextFormattingUtil(com.lowdragmc.lowdraglib.gui.util.TextFormattingUtil) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) IO(com.lowdragmc.multiblocked.api.capability.IO) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) Nonnull(javax.annotation.Nonnull) MatrixStack(com.mojang.blaze3d.matrix.MatrixStack) PacketBuffer(net.minecraft.network.PacketBuffer) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)

Example 3 with WidgetGroup

use of com.lowdragmc.lowdraglib.gui.widget.WidgetGroup in project Multiblocked by Low-Drag-MC.

the class PredicateAnyCapability method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 100, 20);
    groups.add(group);
    MultiblockCapability<?> current = MbdCapabilities.get(capability);
    group.addWidget(new SelectorWidget(0, 0, 120, 20, MbdCapabilities.CAPABILITY_REGISTRY.values().stream().map(MultiblockCapability::getUnlocalizedName).collect(Collectors.toList()), -1).setValue(current == null ? "" : current.getUnlocalizedName()).setOnChanged(capability -> {
        this.capability = capability.replace("multiblocked.capability.", "");
        buildPredicate();
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xffaaaaaa)).setHoverTooltips("multiblocked.gui.predicate.capability"));
    return groups;
}
Also used : MultiblockCapability(com.lowdragmc.multiblocked.api.capability.MultiblockCapability) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)

Example 4 with WidgetGroup

use of com.lowdragmc.lowdraglib.gui.widget.WidgetGroup in project Multiblocked by Low-Drag-MC.

the class PredicateBlocks method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 182, 100);
    groups.add(group);
    DraggableScrollableWidgetGroup container = new DraggableScrollableWidgetGroup(0, 25, 182, 80).setBackground(new ColorRectTexture(0xffaaaaaa));
    group.addWidget(container);
    List<BlockState> blockList = Arrays.stream(blocks).map(Block::defaultBlockState).collect(Collectors.toList());
    for (BlockState blockState : blockList) {
        addBlockSelectorWidget(blockList, container, blockState);
    }
    group.addWidget(new LabelWidget(0, 6, "multiblocked.gui.label.block_settings"));
    group.addWidget(new ButtonWidget(162, 0, 20, 20, cd -> {
        blockList.add(null);
        addBlockSelectorWidget(blockList, container, null);
    }).setButtonTexture(new ResourceTexture("multiblocked:textures/gui/add.png")).setHoverBorderTexture(1, -1).setHoverTooltips("multiblocked.gui.predicate.blocks.add"));
    return groups;
}
Also used : BlockState(net.minecraft.block.BlockState) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) ResourceTexture(com.lowdragmc.lowdraglib.gui.texture.ResourceTexture) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) DraggableScrollableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture) ButtonWidget(com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)

Example 5 with WidgetGroup

use of com.lowdragmc.lowdraglib.gui.widget.WidgetGroup in project Multiblocked by Low-Drag-MC.

the class PredicateComponent method getConfigWidget.

@Override
public List<WidgetGroup> getConfigWidget(List<WidgetGroup> groups) {
    super.getConfigWidget(groups);
    WidgetGroup group = new WidgetGroup(0, 0, 100, 20);
    groups.add(group);
    group.addWidget(new LabelWidget(0, 0, "multiblocked.gui.label.component_registry_name"));
    group.addWidget(new SelectorWidget(0, 10, 120, 20, getAvailableComponents(), -1).setValue(this.location.toString()).setOnChanged(name -> {
        if (name != null && !name.isEmpty()) {
            this.location = new ResourceLocation(name);
            buildPredicate();
        }
    }).setButtonBackground(ResourceBorderTexture.BUTTON_COMMON).setBackground(new ColorRectTexture(0xff333333)).setHoverTooltips("multiblocked.gui.tips.component"));
    return groups;
}
Also used : LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) SelectorWidget(com.lowdragmc.lowdraglib.gui.widget.SelectorWidget) ResourceLocation(net.minecraft.util.ResourceLocation) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) ColorRectTexture(com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)

Aggregations

WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)17 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)13 LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)11 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)9 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)8 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)8 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)8 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)6 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)6 Collections (java.util.Collections)6 Minecraft (net.minecraft.client.Minecraft)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 JsonObject (com.google.gson.JsonObject)5 ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)5 List (java.util.List)5 Dist (net.minecraftforge.api.distmarker.Dist)5 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)5 Gson (com.google.gson.Gson)4 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)4 ImageWidget (com.lowdragmc.lowdraglib.gui.widget.ImageWidget)4