Search in sources :

Example 1 with Textures

use of gregtech.client.renderer.texture.Textures in project GregTech by GregTechCEu.

the class MetaTileEntityWorkbench method createWorkbenchTab.

public static AbstractWidgetGroup createWorkbenchTab(CraftingRecipeLogic craftingRecipeLogic, ItemStackHandler craftingGrid, CraftingRecipeMemory recipeMemory, ItemStackHandler toolInventory, ItemStackHandler internalInventory) {
    WidgetGroup widgetGroup = new WidgetGroup();
    widgetGroup.addWidget(new ImageWidget(88 - 13, 44 - 14, 26, 26, GuiTextures.SLOT));
    widgetGroup.addWidget(new CraftingSlotWidget(craftingRecipeLogic, 0, 88 - 9, 44 - 9));
    // crafting grid
    widgetGroup.addWidget(new CraftingStationInputWidgetGroup(4, 7, craftingGrid, craftingRecipeLogic));
    Supplier<String> textSupplier = () -> Integer.toString(craftingRecipeLogic.getItemsCraftedAmount());
    widgetGroup.addWidget(new SimpleTextWidget(88, 44 + 19, "", textSupplier));
    Consumer<ClickData> clearAction = (clickData) -> craftingRecipeLogic.clearCraftingGrid();
    widgetGroup.addWidget(new ClickButtonWidget(8 + 18 * 3 + 3, 16, 8, 8, "", clearAction).setButtonTexture(GuiTextures.BUTTON_CLEAR_GRID));
    widgetGroup.addWidget(new ImageWidget(168 - 18 * 3, 44 - 19 * 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 - 28 + i * 18));
        }
    }
    // tool inventory
    for (int i = 0; i < 9; i++) {
        widgetGroup.addWidget(new SlotWidget(toolInventory, i, 7 + i * 18, 75).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, 7 + j * 18, 98 + i * 18).setBackgroundTexture(GuiTextures.SLOT));
        }
    }
    return widgetGroup;
}
Also used : Matrix4(codechicken.lib.vec.Matrix4) Textures(gregtech.client.renderer.texture.Textures) Blocks(net.minecraft.init.Blocks) IVertexOperation(codechicken.lib.render.pipeline.IVertexOperation) MemorizedRecipeWidget(gregtech.common.gui.widget.craftingstation.MemorizedRecipeWidget) ArrayUtils(org.apache.commons.lang3.ArrayUtils) IItemList(gregtech.common.inventory.IItemList) ToolItemStackHandler(gregtech.common.inventory.handlers.ToolItemStackHandler) Supplier(java.util.function.Supplier) ArrayList(java.util.ArrayList) 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) ClickData(gregtech.api.gui.Widget.ClickData) NonNullList(net.minecraft.util.NonNullList) ItemSources(gregtech.common.inventory.itemsource.ItemSources) MetaTileEntityHolder(gregtech.api.metatileentity.MetaTileEntityHolder) TextureAtlasSprite(net.minecraft.client.renderer.texture.TextureAtlasSprite) TabLocation(gregtech.api.gui.widgets.TabGroup.TabLocation) MetaTileEntity(gregtech.api.metatileentity.MetaTileEntity) ItemListGridWidget(gregtech.common.gui.widget.craftingstation.ItemListGridWidget) NBTTagCompound(net.minecraft.nbt.NBTTagCompound) CCRenderState(codechicken.lib.render.CCRenderState) GuiTextures(gregtech.api.gui.GuiTextures) Consumer(java.util.function.Consumer) Position(gregtech.api.util.Position) TextureArea(gregtech.api.gui.resources.TextureArea) ItemStackHandler(net.minecraftforge.items.ItemStackHandler) SingleItemStackHandler(gregtech.common.inventory.handlers.SingleItemStackHandler) 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) CraftingSlotWidget(gregtech.common.gui.widget.craftingstation.CraftingSlotWidget) ColourMultiplier(codechicken.lib.render.pipeline.ColourMultiplier) ICraftingStorage(gregtech.api.storage.ICraftingStorage) MemorizedRecipeWidget(gregtech.common.gui.widget.craftingstation.MemorizedRecipeWidget) CraftingSlotWidget(gregtech.common.gui.widget.craftingstation.CraftingSlotWidget) CraftingSlotWidget(gregtech.common.gui.widget.craftingstation.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 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 MetaTileEntity (gregtech.api.metatileentity.MetaTileEntity)1 MetaTileEntityHolder (gregtech.api.metatileentity.MetaTileEntityHolder)1 ICraftingStorage (gregtech.api.storage.ICraftingStorage)1 GTUtility (gregtech.api.util.GTUtility)1 Position (gregtech.api.util.Position)1 Textures (gregtech.client.renderer.texture.Textures)1 CraftingSlotWidget (gregtech.common.gui.widget.craftingstation.CraftingSlotWidget)1