Search in sources :

Example 1 with SimpleTextWidget

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

the class MetaTileEntityItemCollector method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    int rowSize = (int) Math.sqrt(exportItems.getSlots());
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, 176, 45 + rowSize * 18 + 105 + 82).label(10, 5, getMetaFullName());
    builder.widget(new ClickButtonWidget(10, 20, 20, 20, "-1", data -> adjustSuckingRange(-1)));
    builder.widget(new ClickButtonWidget(146, 20, 20, 20, "+1", data -> adjustSuckingRange(+1)));
    builder.widget(new ImageWidget(30, 20, 116, 20, GuiTextures.DISPLAY));
    builder.widget(new SimpleTextWidget(88, 30, "gregtech.machine.item_collector.gui.collect_range", 0xFFFFFF, () -> Integer.toString(itemSuckingRange)));
    for (int y = 0; y < rowSize; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.widget(new SlotWidget(exportItems, index, 89 - rowSize * 9 + x * 18, 45 + y * 18, true, false).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    this.itemFilter.initUI(45 + rowSize * 18 + 5, builder::widget);
    builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, 7, 45 + rowSize * 18 + 105);
    return builder.build(getHolder(), entityPlayer);
}
Also used : ClickButtonWidget(gregtech.api.gui.widgets.ClickButtonWidget) Matrix4(codechicken.lib.vec.Matrix4) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget) Textures(gregtech.api.render.Textures) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ClickButtonWidget(gregtech.api.gui.widgets.ClickButtonWidget) ImageWidget(gregtech.api.gui.widgets.ImageWidget) I18n(net.minecraft.client.resources.I18n) ItemStack(net.minecraft.item.ItemStack) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) Side(net.minecraftforge.fml.relauncher.Side) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nullable(javax.annotation.Nullable) SlotWidget(gregtech.api.gui.widgets.SlotWidget) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) EntityItem(net.minecraft.entity.item.EntityItem) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) World(net.minecraft.world.World) ItemFilterContainer(gregtech.common.covers.filter.ItemFilterContainer) EnumFacing(net.minecraft.util.EnumFacing) BlockPos(net.minecraft.util.math.BlockPos) GuiTextures(gregtech.api.gui.GuiTextures) Capability(net.minecraftforge.common.capabilities.Capability) SimpleOverlayRenderer(gregtech.api.render.SimpleOverlayRenderer) List(java.util.List) GTValues(gregtech.api.GTValues) TieredMetaTileEntity(gregtech.api.metatileentity.TieredMetaTileEntity) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) MathHelper(net.minecraft.util.math.MathHelper) ResourceLocation(net.minecraft.util.ResourceLocation) ModularUI(gregtech.api.gui.ModularUI) Builder(gregtech.api.gui.ModularUI.Builder) PacketBuffer(net.minecraft.network.PacketBuffer) SlotWidget(gregtech.api.gui.widgets.SlotWidget) Builder(gregtech.api.gui.ModularUI.Builder) ImageWidget(gregtech.api.gui.widgets.ImageWidget) SimpleTextWidget(gregtech.api.gui.widgets.SimpleTextWidget)

Aggregations

CCRenderState (codechicken.lib.render.CCRenderState)1 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)1 Matrix4 (codechicken.lib.vec.Matrix4)1 GTValues (gregtech.api.GTValues)1 GuiTextures (gregtech.api.gui.GuiTextures)1 ModularUI (gregtech.api.gui.ModularUI)1 Builder (gregtech.api.gui.ModularUI.Builder)1 ClickButtonWidget (gregtech.api.gui.widgets.ClickButtonWidget)1 ImageWidget (gregtech.api.gui.widgets.ImageWidget)1 SimpleTextWidget (gregtech.api.gui.widgets.SimpleTextWidget)1 SlotWidget (gregtech.api.gui.widgets.SlotWidget)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 TieredMetaTileEntity (gregtech.api.metatileentity.TieredMetaTileEntity)1 SimpleOverlayRenderer (gregtech.api.render.SimpleOverlayRenderer)1 Textures (gregtech.api.render.Textures)1 ItemFilterContainer (gregtech.common.covers.filter.ItemFilterContainer)1 List (java.util.List)1 Nullable (javax.annotation.Nullable)1 I18n (net.minecraft.client.resources.I18n)1