Search in sources :

Example 1 with SortingButtonWidget

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

the class MetaTileEntityChest method createUI.

@Override
protected ModularUI createUI(EntityPlayer entityPlayer) {
    Builder builder = ModularUI.builder(GuiTextures.BACKGROUND, Math.max(176, 14 + rowSize * 18), 18 + 18 * amountOfRows + 94).label(5, 5, getMetaFullName());
    builder.widget(new SortingButtonWidget(111, 4, 60, 10, "gregtech.gui.sort", (info) -> sortInventorySlotContents(inventory)));
    for (int y = 0; y < amountOfRows; y++) {
        for (int x = 0; x < rowSize; x++) {
            int index = y * rowSize + x;
            builder.slot(inventory, index, 7 + x * 18, 18 + y * 18, GuiTextures.SLOT);
        }
    }
    int startX = (Math.max(176, 14 + rowSize * 18) - 162) / 2;
    builder.bindPlayerInventory(entityPlayer.inventory, GuiTextures.SLOT, startX, 18 + 18 * amountOfRows + 12);
    if (!getWorld().isRemote) {
        builder.bindOpenListener(() -> onContainerOpen(entityPlayer));
        builder.bindCloseListener(() -> onContainerClose(entityPlayer));
    }
    return builder.build(getHolder(), entityPlayer);
}
Also used : Matrix4(codechicken.lib.vec.Matrix4) ModHandler(gregtech.api.recipes.ModHandler) Textures(gregtech.api.render.Textures) IFastRenderMetaTileEntity(gregtech.api.metatileentity.IFastRenderMetaTileEntity) SolidMaterial(gregtech.api.unification.material.type.SolidMaterial) AxisAlignedBB(net.minecraft.util.math.AxisAlignedBB) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) SortingButtonWidget(gregtech.api.gui.widgets.SortingButtonWidget) ArrayList(java.util.ArrayList) I18n(net.minecraft.client.resources.I18n) ItemStack(net.minecraft.item.ItemStack) ItemHandlerHelper(net.minecraftforge.items.ItemHandlerHelper) Pair(org.apache.commons.lang3.tuple.Pair) Side(net.minecraftforge.fml.relauncher.Side) IItemHandlerModifiable(net.minecraftforge.items.IItemHandlerModifiable) NonNullList(net.minecraft.util.NonNullList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) SoundCategory(net.minecraft.util.SoundCategory) Nullable(javax.annotation.Nullable) ColourRGBA(codechicken.lib.colour.ColourRGBA) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) SoundEvents(net.minecraft.init.SoundEvents) World(net.minecraft.world.World) GTUtility.convertOpaqueRGBA_CLtoRGB(gregtech.api.util.GTUtility.convertOpaqueRGBA_CLtoRGB) BlockPos(net.minecraft.util.math.BlockPos) GuiTextures(gregtech.api.gui.GuiTextures) List(java.util.List) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) ModularUI(gregtech.api.gui.ModularUI) Builder(gregtech.api.gui.ModularUI.Builder) GTUtility(gregtech.api.util.GTUtility) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) PacketBuffer(net.minecraft.network.PacketBuffer) IndexedCuboid6(codechicken.lib.raytracer.IndexedCuboid6) Cuboid6(codechicken.lib.vec.Cuboid6) Builder(gregtech.api.gui.ModularUI.Builder) SortingButtonWidget(gregtech.api.gui.widgets.SortingButtonWidget)

Aggregations

ColourRGBA (codechicken.lib.colour.ColourRGBA)1 IndexedCuboid6 (codechicken.lib.raytracer.IndexedCuboid6)1 CCRenderState (codechicken.lib.render.CCRenderState)1 ColourMultiplier (codechicken.lib.render.pipeline.ColourMultiplier)1 IVertexOperation (codechicken.lib.render.pipeline.IVertexOperation)1 Cuboid6 (codechicken.lib.vec.Cuboid6)1 Matrix4 (codechicken.lib.vec.Matrix4)1 GuiTextures (gregtech.api.gui.GuiTextures)1 ModularUI (gregtech.api.gui.ModularUI)1 Builder (gregtech.api.gui.ModularUI.Builder)1 SortingButtonWidget (gregtech.api.gui.widgets.SortingButtonWidget)1 IFastRenderMetaTileEntity (gregtech.api.metatileentity.IFastRenderMetaTileEntity)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 ModHandler (gregtech.api.recipes.ModHandler)1 Textures (gregtech.api.render.Textures)1 SolidMaterial (gregtech.api.unification.material.type.SolidMaterial)1 GTUtility (gregtech.api.util.GTUtility)1 GTUtility.convertOpaqueRGBA_CLtoRGB (gregtech.api.util.GTUtility.convertOpaqueRGBA_CLtoRGB)1 ArrayList (java.util.ArrayList)1