Search in sources :

Example 1 with Textures

use of gregtech.api.render.Textures in project GregTech by GregTechCE.

the class MetaTileEntityWorkbench method createWorkbenchTab.

private AbstractWidgetGroup createWorkbenchTab() {
    WidgetGroup widgetGroup = new WidgetGroup();
    CraftingRecipeResolver recipeResolver = getRecipeResolver();
    widgetGroup.addWidget(new ImageWidget(88 - 13, 44 - 13, 26, 26, GuiTextures.SLOT));
    widgetGroup.addWidget(new CraftingSlotWidget(recipeResolver, 0, 88 - 9, 44 - 9));
    // crafting grid
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            widgetGroup.addWidget(new PhantomSlotWidget(craftingGrid, j + i * 3, 8 + j * 18, 17 + i * 18).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    Supplier<String> textSupplier = () -> Integer.toString(recipeResolver.getItemsCrafted());
    widgetGroup.addWidget(new SimpleTextWidget(88, 44 + 20, "", textSupplier));
    Consumer<ClickData> clearAction = (clickData) -> recipeResolver.clearCraftingGrid();
    widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 1, 17, 8, 8, "", clearAction).setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID));
    widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 18 * 3 / 2, 18 * 3, 18 * 3, TextureArea.fullImage("textures/gui/base/darkened_slot.png")));
    for (int i = 0; i < 3; ++i) {
        for (int j = 0; j < 3; ++j) {
            widgetGroup.addWidget(new MemorizedRecipeWidget(recipeMemory, j + i * 3, craftingGrid, 168 - 18 * 3 / 2 - 27 + j * 18, 44 - 27 + i * 18));
        }
    }
    // tool inventory
    for (int i = 0; i < 9; i++) {
        widgetGroup.addWidget(new SlotWidget(toolInventory, i, 8 + i * 18, 76).setBackgroundTexture(GuiTextures.SLOT, GuiTextures.TOOL_SLOT_OVERLAY));
    }
    // internal inventory
    for (int i = 0; i < 2; ++i) {
        for (int j = 0; j < 9; ++j) {
            widgetGroup.addWidget(new SlotWidget(internalInventory, j + i * 9, 8 + j * 18, 99 + i * 18).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    return widgetGroup;
}
Also used : Matrix4(codechicken.lib.vec.Matrix4) Textures(gregtech.api.render.Textures) Blocks(net.minecraft.init.Blocks) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) ItemSourceList(gregtech.common.inventory.itemsource.ItemSourceList) ArrayUtils(org.apache.commons.lang3.ArrayUtils) Materials(gregtech.api.unification.material.Materials) IItemList(gregtech.common.inventory.IItemList) Supplier(java.util.function.Supplier) ItemStack(net.minecraft.item.ItemStack) gregtech.api.gui.widgets(gregtech.api.gui.widgets) ItemTabInfo(gregtech.api.gui.widgets.tab.ItemTabInfo) Pair(org.apache.commons.lang3.tuple.Pair) Side(net.minecraftforge.fml.relauncher.Side) ClickData(gregtech.api.gui.Widget.ClickData) NonNullList(net.minecraft.util.NonNullList) SideOnly(net.minecraftforge.fml.relauncher.SideOnly) Nonnull(javax.annotation.Nonnull) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) TabLocation(gregtech.api.gui.widgets.TabGroup.TabLocation) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) MemorizedRecipeWidget(gregtech.common.gui.widget.MemorizedRecipeWidget) ItemTool(net.minecraft.item.ItemTool) ToolMetaItem(gregtech.api.items.toolitem.ToolMetaItem) GuiTextures(gregtech.api.gui.GuiTextures) Consumer(java.util.function.Consumer) Position(gregtech.api.util.Position) ItemListGridWidget(gregtech.common.gui.widget.ItemListGridWidget) TextureArea(gregtech.api.gui.resources.TextureArea) CraftingSlotWidget(gregtech.common.gui.widget.CraftingSlotWidget) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) Preconditions(com.google.common.base.Preconditions) ModularUI(gregtech.api.gui.ModularUI) InventoryItemSource(gregtech.common.inventory.itemsource.sources.InventoryItemSource) Builder(gregtech.api.gui.ModularUI.Builder) GTUtility(gregtech.api.util.GTUtility) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) Cuboid6(codechicken.lib.vec.Cuboid6) MemorizedRecipeWidget(gregtech.common.gui.widget.MemorizedRecipeWidget) CraftingSlotWidget(gregtech.common.gui.widget.CraftingSlotWidget) CraftingSlotWidget(gregtech.common.gui.widget.CraftingSlotWidget) ClickData(gregtech.api.gui.Widget.ClickData)

Aggregations

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 Preconditions (com.google.common.base.Preconditions)1 GuiTextures (gregtech.api.gui.GuiTextures)1 ModularUI (gregtech.api.gui.ModularUI)1 Builder (gregtech.api.gui.ModularUI.Builder)1 ClickData (gregtech.api.gui.Widget.ClickData)1 TextureArea (gregtech.api.gui.resources.TextureArea)1 gregtech.api.gui.widgets (gregtech.api.gui.widgets)1 TabLocation (gregtech.api.gui.widgets.TabGroup.TabLocation)1 ItemTabInfo (gregtech.api.gui.widgets.tab.ItemTabInfo)1 ToolMetaItem (gregtech.api.items.toolitem.ToolMetaItem)1 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 Textures (gregtech.api.render.Textures)1 Materials (gregtech.api.unification.material.Materials)1 GTUtility (gregtech.api.util.GTUtility)1