Search in sources :

Example 1 with LabelWidget

use of com.lowdragmc.lowdraglib.gui.widget.LabelWidget 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 LabelWidget

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

the class FluidCapabilityTrait method initSettingDialog.

@Override
protected void initSettingDialog(DialogWidget dialog, DraggableWidgetGroup slot, int index) {
    super.initSettingDialog(dialog, slot, index);
    dialog.addWidget(new LabelWidget(5, 60, "multiblocked.gui.label.tank_capability"));
    dialog.addWidget(new TextFieldWidget(5, 70, 100, 15, null, s -> tankCapability[index] = Integer.parseInt(s)).setNumbersOnly(1, Integer.MAX_VALUE).setCurrentString(tankCapability[index] + ""));
}
Also used : JSONUtils(net.minecraft.util.JSONUtils) JsonObject(com.google.gson.JsonObject) Arrays(java.util.Arrays) ComponentTileEntity(com.lowdragmc.multiblocked.api.tile.ComponentTileEntity) Constants(net.minecraftforge.common.util.Constants) CompoundNBT(net.minecraft.nbt.CompoundNBT) AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) ArrayUtils(org.apache.commons.lang3.ArrayUtils) Direction(net.minecraft.util.Direction) FluidTank(net.minecraftforge.fluids.capability.templates.FluidTank) LazyOptional(net.minecraftforge.common.util.LazyOptional) JsonElement(com.google.gson.JsonElement) MultiCapabilityTrait(com.lowdragmc.multiblocked.api.capability.trait.MultiCapabilityTrait) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) TankWidget(com.lowdragmc.lowdraglib.gui.widget.TankWidget) IO(com.lowdragmc.multiblocked.api.capability.IO) WidgetGroup(com.lowdragmc.lowdraglib.gui.widget.WidgetGroup) Nonnull(javax.annotation.Nonnull) INBT(net.minecraft.nbt.INBT) Nullable(javax.annotation.Nullable) ListNBT(net.minecraft.nbt.ListNBT) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget) PlayerEntity(net.minecraft.entity.player.PlayerEntity) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) Capability(net.minecraftforge.common.capabilities.Capability) DialogWidget(com.lowdragmc.lowdraglib.gui.widget.DialogWidget) DraggableWidgetGroup(com.lowdragmc.lowdraglib.gui.widget.DraggableWidgetGroup) JsonArray(com.google.gson.JsonArray) List(java.util.List) TileEntity(net.minecraft.tileentity.TileEntity) FluidStack(net.minecraftforge.fluids.FluidStack) IFluidTank(net.minecraftforge.fluids.IFluidTank) FluidMultiblockCapability(com.lowdragmc.multiblocked.common.capability.FluidMultiblockCapability) INBTSerializable(net.minecraftforge.common.util.INBTSerializable) LabelWidget(com.lowdragmc.lowdraglib.gui.widget.LabelWidget) TextFieldWidget(com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)

Example 3 with LabelWidget

use of com.lowdragmc.lowdraglib.gui.widget.LabelWidget 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 4 with LabelWidget

use of com.lowdragmc.lowdraglib.gui.widget.LabelWidget 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 LabelWidget

use of com.lowdragmc.lowdraglib.gui.widget.LabelWidget 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

LabelWidget (com.lowdragmc.lowdraglib.gui.widget.LabelWidget)13 WidgetGroup (com.lowdragmc.lowdraglib.gui.widget.WidgetGroup)13 ResourceTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceTexture)8 TextFieldWidget (com.lowdragmc.lowdraglib.gui.widget.TextFieldWidget)8 ColorRectTexture (com.lowdragmc.lowdraglib.gui.texture.ColorRectTexture)6 DraggableScrollableWidgetGroup (com.lowdragmc.lowdraglib.gui.widget.DraggableScrollableWidgetGroup)6 SwitchWidget (com.lowdragmc.lowdraglib.gui.widget.SwitchWidget)6 ButtonWidget (com.lowdragmc.lowdraglib.gui.widget.ButtonWidget)5 IO (com.lowdragmc.multiblocked.api.capability.IO)5 List (java.util.List)5 JsonObject (com.google.gson.JsonObject)4 ColorBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ColorBorderTexture)4 ResourceBorderTexture (com.lowdragmc.lowdraglib.gui.texture.ResourceBorderTexture)4 TextTexture (com.lowdragmc.lowdraglib.gui.texture.TextTexture)4 LocalizationUtils (com.lowdragmc.lowdraglib.utils.LocalizationUtils)4 Collections (java.util.Collections)4 Nullable (javax.annotation.Nullable)4 JSONUtils (net.minecraft.util.JSONUtils)4 ArrayUtils (org.apache.commons.lang3.ArrayUtils)4 Nonnull (javax.annotation.Nonnull)3