Search in sources :

Example 6 with ModularUI

use of gregtech.api.gui.ModularUI 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 7 with ModularUI

use of gregtech.api.gui.ModularUI 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

ModularUI (gregtech.api.gui.ModularUI)7 CCRenderState (codechicken.lib.render.CCRenderState)4 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)4 Matrix4 (codechicken.lib.vec.Matrix4)4 GuiTextures (gregtech.api.gui.GuiTextures)4 Cuboid6 (codechicken.lib.vec.Cuboid6)3 LabelWidget (gregtech.api.gui.widgets.LabelWidget)3 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)3 SimpleOverlayRenderer (gregtech.api.render.SimpleOverlayRenderer)3 GTUtility (gregtech.api.util.GTUtility)3 EntityPlayer (net.minecraft.entity.player.EntityPlayer)3 NBTTagCompound (net.minecraft.nbt.NBTTagCompound)3 EnumFacing (net.minecraft.util.EnumFacing)3 Capability (net.minecraftforge.common.capabilities.Capability)3 CuboidRayTraceResult (codechicken.lib.raytracer.CuboidRayTraceResult)2 GTValues (gregtech.api.GTValues)2 CoverBehavior (gregtech.api.cover.CoverBehavior)2 CoverWithUI (gregtech.api.cover.CoverWithUI)2 ICoverable (gregtech.api.cover.ICoverable)2 Builder (gregtech.api.gui.ModularUI.Builder)2