Search in sources :

Example 1 with LabelWidget

use of gregtech.api.gui.widgets.LabelWidget in project GregTech by GregTechCE.

the class SimpleMachineMetaTileEntity method createGuiTemplate.

protected ModularUI.Builder createGuiTemplate(EntityPlayer player) {
    ModularUI.Builder builder = workable.recipeMap.createUITemplate(workable::getProgressPercent, importItems, exportItems, importFluids, exportFluids).widget(new LabelWidget(7, 5, getMetaFullName())).widget(new DischargerSlotWidget(chargerInventory, 0, 79, 62).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.CHARGER_OVERLAY)).widget(new ImageWidget(79, 42, 18, 18, GuiTextures.INDICATOR_NO_ENERGY).setPredicate(workable::isHasNotEnoughEnergy)).bindPlayerInventory(player.inventory);
    int leftButtonStartX = 7;
    int rightButtonStartX = 176 - 7 - 45;
    if (workable.recipeMap instanceof RecipeMapWithConfigButton) {
        leftButtonStartX += ((RecipeMapWithConfigButton) workable.recipeMap).getLeftButtonOffset();
        rightButtonStartX -= ((RecipeMapWithConfigButton) workable.recipeMap).getRightButtonOffset();
    }
    if (exportItems.getSlots() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_ITEM_OUTPUT, this::isAutoOutputItems, this::setAutoOutputItems).setTooltipText("gregtech.gui.item_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    if (exportFluids.getTanks() > 0) {
        builder.widget(new ToggleButtonWidget(leftButtonStartX, 62, 18, 18, GuiTextures.BUTTON_FLUID_OUTPUT, this::isAutoOutputFluids, this::setAutoOutputFluids).setTooltipText("gregtech.gui.fluid_auto_output.tooltip"));
        leftButtonStartX += 18;
    }
    builder.widget(new CycleButtonWidget(leftButtonStartX, 62, 18, 18, workable.getAvailableOverclockingTiers(), workable::getOverclockTier, workable::setOverclockTier).setTooltipHoverString("gregtech.gui.overclock.description").setButtonTexture(GuiTextures.BUTTON_OVERCLOCK));
    return builder;
}
Also used : ToggleButtonWidget(gregtech.api.gui.widgets.ToggleButtonWidget) ModularUI(gregtech.api.gui.ModularUI) DischargerSlotWidget(gregtech.api.gui.widgets.DischargerSlotWidget) LabelWidget(gregtech.api.gui.widgets.LabelWidget) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget)

Example 2 with LabelWidget

use of gregtech.api.gui.widgets.LabelWidget in project GregTech by GregTechCE.

the class OreDictionaryItemFilter method initUI.

@Override
public void initUI(Consumer<Widget> widgetGroup) {
    widgetGroup.accept(new LabelWidget(10, 0, "cover.ore_dictionary_filter.title1"));
    widgetGroup.accept(new LabelWidget(10, 10, "cover.ore_dictionary_filter.title2"));
    widgetGroup.accept(new TextFieldWidget(10, 25, 100, 12, true, () -> oreDictionaryFilter, this::setOreDictionaryFilter).setMaxStringLength(64).setValidator(str -> ORE_DICTIONARY_FILTER.matcher(str).matches()));
}
Also used : NBTTagCompound(net.minecraft.nbt.NBTTagCompound) Consumer(java.util.function.Consumer) ItemStack(net.minecraft.item.ItemStack) OreDictUnifier(gregtech.api.unification.OreDictUnifier) Widget(gregtech.api.gui.Widget) Set(java.util.Set) Pattern(java.util.regex.Pattern) LabelWidget(gregtech.api.gui.widgets.LabelWidget) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget) ItemStackKey(gregtech.api.util.ItemStackKey) LabelWidget(gregtech.api.gui.widgets.LabelWidget) TextFieldWidget(gregtech.api.gui.widgets.TextFieldWidget)

Example 3 with LabelWidget

use of gregtech.api.gui.widgets.LabelWidget in project GregTech by GregTechCE.

the class MetaTileEntityLockedSafe method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    DoubleSupplier supplier = () -> 0.2 + (unlockProgress / (MAX_UNLOCK_PROGRESS * 1.0)) * 0.8;
    ModularUI.Builder builder = ModularUI.defaultBuilder().widget(new ProgressWidget(supplier, 5, 5, 166, 74, GuiTextures.PROGRESS_BAR_UNLOCK, MoveType.VERTICAL_INVERTED)).bindPlayerInventory(entityPlayer.inventory);
    ServerWidgetGroup lockedGroup = new ServerWidgetGroup(() -> !isSafeUnlocked && unlockProgress < 0);
    lockedGroup.addWidget(new LabelWidget(5, 20, "gregtech.machine.locked_safe.malfunctioning"));
    lockedGroup.addWidget(new LabelWidget(5, 30, "gregtech.machine.locked_safe.requirements"));
    lockedGroup.addWidget(new SlotWidget(unlockInventory, 0, 70, 40, false, true).setBackgroundTexture(GuiTextures.SLOT));
    lockedGroup.addWidget(new SlotWidget(unlockInventory, 1, 70 + 18, 40, false, true).setBackgroundTexture(GuiTextures.SLOT));
    lockedGroup.addWidget(new SlotWidget(unlockComponents, 0, 70, 58, false, false));
    lockedGroup.addWidget(new SlotWidget(unlockComponents, 1, 70 + 18, 58, false, false));
    ServerWidgetGroup unlockedGroup = new ServerWidgetGroup(() -> isSafeUnlocked);
    for (int row = 0; row < 3; row++) {
        for (int col = 0; col < 9; col++) {
            unlockedGroup.addWidget(new SlotWidget(safeLootInventory, col + row * 9, 8 + col * 18, 15 + row * 18, true, false));
        }
    }
    return builder.widget(unlockedGroup).widget(lockedGroup).build(getHolder(), entityPlayer);
}
Also used : SlotWidget(gregtech.api.gui.widgets.SlotWidget) ModularUI(gregtech.api.gui.ModularUI) DoubleSupplier(java.util.function.DoubleSupplier) ProgressWidget(gregtech.api.gui.widgets.ProgressWidget) ServerWidgetGroup(gregtech.api.gui.widgets.ServerWidgetGroup) LabelWidget(gregtech.api.gui.widgets.LabelWidget)

Example 4 with LabelWidget

use of gregtech.api.gui.widgets.LabelWidget in project GregTech by GregTechCE.

the class CoverFluidFilter method createUI.

public ModularUI createUI(EntityPlayer player) {
    WidgetGroup fluidFilterGroup = new WidgetGroup();
    fluidFilterGroup.addWidget(new LabelWidget(10, 5, "cover.fluid_filter.title"));
    fluidFilterGroup.addWidget(new CycleButtonWidget(10, 20, 110, 20, GTUtility.mapToString(FluidFilterMode.values(), (it) -> it.localeName), () -> this.filterMode.ordinal(), (newMode) -> this.setFilterMode(FluidFilterMode.values()[newMode])));
    this.fluidFilter.initUI(45, fluidFilterGroup::addWidget);
    return ModularUI.builder(GuiTextures.BACKGROUND, 176, 105 + 82).widget(fluidFilterGroup).bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 105).build(this, player);
}
Also used : Matrix4(codechicken.lib.vec.Matrix4) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) EnumHand(net.minecraft.util.EnumHand) CoverBehavior(gregtech.api.cover.CoverBehavior) CoverWithUI(gregtech.api.cover.CoverWithUI) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) IFluidTankProperties(net.minecraftforge.fluids.capability.IFluidTankProperties) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) CuboidRayTraceResult(codechicken.lib.raytracer.CuboidRayTraceResult) Nullable(javax.annotation.Nullable) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) IFluidHandler(net.minecraftforge.fluids.capability.IFluidHandler) CapabilityFluidHandler(net.minecraftforge.fluids.capability.CapabilityFluidHandler) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) EnumFacing(net.minecraft.util.EnumFacing) FluidHandlerDelegate(gregtech.api.capability.impl.FluidHandlerDelegate) LabelWidget(gregtech.api.gui.widgets.LabelWidget) ICoverable(gregtech.api.cover.ICoverable) GuiTextures(gregtech.api.gui.GuiTextures) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) Capability(net.minecraftforge.common.capabilities.Capability) SimpleOverlayRenderer(gregtech.api.render.SimpleOverlayRenderer) FluidFilter(gregtech.common.covers.filter.FluidFilter) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EnumActionResult(net.minecraft.util.EnumActionResult) ModularUI(gregtech.api.gui.ModularUI) FluidFilterWrapper(gregtech.common.covers.filter.FluidFilterWrapper) FluidStack(net.minecraftforge.fluids.FluidStack) GTUtility(gregtech.api.util.GTUtility) Cuboid6(codechicken.lib.vec.Cuboid6) LabelWidget(gregtech.api.gui.widgets.LabelWidget) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup)

Example 5 with LabelWidget

use of gregtech.api.gui.widgets.LabelWidget in project GregTech by GregTechCE.

the class CoverItemFilter method createUI.

@Override
public ModularUI createUI(EntityPlayer player) {
    WidgetGroup filterGroup = new WidgetGroup();
    filterGroup.addWidget(new LabelWidget(10, 5, titleLocale));
    filterGroup.addWidget(new CycleButtonWidget(10, 20, 110, 20, GTUtility.mapToString(ItemFilterMode.values(), it -> it.localeName), () -> filterMode.ordinal(), (newMode) -> setFilterMode(ItemFilterMode.values()[newMode])));
    this.itemFilter.initUI(45, filterGroup::addWidget);
    return ModularUI.builder(GuiTextures.BACKGROUND, 176, 105 + 82).widget(filterGroup).bindPlayerInventory(player.inventory, GuiTextures.SLOT, 7, 105).build(this, player);
}
Also used : IItemHandler(net.minecraftforge.items.IItemHandler) Matrix4(codechicken.lib.vec.Matrix4) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) EnumHand(net.minecraft.util.EnumHand) CoverBehavior(gregtech.api.cover.CoverBehavior) CoverWithUI(gregtech.api.cover.CoverWithUI) EntityPlayerMP(net.minecraft.entity.player.EntityPlayerMP) ItemStack(net.minecraft.item.ItemStack) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) CuboidRayTraceResult(codechicken.lib.raytracer.CuboidRayTraceResult) Nonnull(javax.annotation.Nonnull) ItemFilter(gregtech.common.covers.filter.ItemFilter) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) ItemHandlerDelegate(gregtech.api.capability.impl.ItemHandlerDelegate) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup) EnumFacing(net.minecraft.util.EnumFacing) LabelWidget(gregtech.api.gui.widgets.LabelWidget) ICoverable(gregtech.api.cover.ICoverable) GuiTextures(gregtech.api.gui.GuiTextures) BlockRenderLayer(net.minecraft.util.BlockRenderLayer) Capability(net.minecraftforge.common.capabilities.Capability) SimpleOverlayRenderer(gregtech.api.render.SimpleOverlayRenderer) ItemFilterWrapper(gregtech.common.covers.filter.ItemFilterWrapper) EntityPlayer(net.minecraft.entity.player.EntityPlayer) EnumActionResult(net.minecraft.util.EnumActionResult) CapabilityItemHandler(net.minecraftforge.items.CapabilityItemHandler) ModularUI(gregtech.api.gui.ModularUI) GTUtility(gregtech.api.util.GTUtility) Cuboid6(codechicken.lib.vec.Cuboid6) LabelWidget(gregtech.api.gui.widgets.LabelWidget) CycleButtonWidget(gregtech.api.gui.widgets.CycleButtonWidget) WidgetGroup(gregtech.api.gui.widgets.WidgetGroup)

Aggregations

LabelWidget (gregtech.api.gui.widgets.LabelWidget)6 ModularUI (gregtech.api.gui.ModularUI)4 CycleButtonWidget (gregtech.api.gui.widgets.CycleButtonWidget)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 CuboidRayTraceResult (codechicken.lib.raytracer.CuboidRayTraceResult)2 CCRenderState (codechicken.lib.render.CCRenderState)2 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)2 Cuboid6 (codechicken.lib.vec.Cuboid6)2 Matrix4 (codechicken.lib.vec.Matrix4)2 CoverBehavior (gregtech.api.cover.CoverBehavior)2 CoverWithUI (gregtech.api.cover.CoverWithUI)2 ICoverable (gregtech.api.cover.ICoverable)2 GuiTextures (gregtech.api.gui.GuiTextures)2 SlotWidget (gregtech.api.gui.widgets.SlotWidget)2 WidgetGroup (gregtech.api.gui.widgets.WidgetGroup)2 SimpleOverlayRenderer (gregtech.api.render.SimpleOverlayRenderer)2 GTUtility (gregtech.api.util.GTUtility)2 EntityPlayer (net.minecraft.entity.player.EntityPlayer)2 EntityPlayerMP (net.minecraft.entity.player.EntityPlayerMP)2 ItemStack (net.minecraft.item.ItemStack)2