Search in sources :

Example 1 with TextureArea

use of gregtech.api.gui.resources.TextureArea in project GregTech by GregTechCE.

the class HorizontalTabListRenderer method renderTabs.

@Override
public void renderTabs(Position offset, List<ITabInfo> tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
    boolean startLeft = startCorner == HorizontalStartCorner.LEFT;
    boolean isTopLine = verticalLocation == VerticalLocation.TOP;
    int tabYPosition = isTopLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiHeight - TAB_Y_OFFSET);
    int currentXOffset = 0;
    for (int tabIndex = 0; tabIndex < tabInfos.size(); tabIndex++) {
        boolean isTabSelected = tabIndex == selectedTabIndex;
        boolean isTabFirst = tabIndex == 0;
        TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isTopLine, startLeft);
        int finalPosX = startLeft ? currentXOffset : (guiWidth - TAB_WIDTH - currentXOffset);
        tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + finalPosX, offset.y + tabYPosition, TAB_WIDTH, TAB_HEIGHT, isTabSelected);
        currentXOffset += (TAB_WIDTH + SPACE_BETWEEN_TABS);
    }
}
Also used : TextureArea(gregtech.api.gui.resources.TextureArea)

Example 2 with TextureArea

use of gregtech.api.gui.resources.TextureArea in project GregTech by GregTechCE.

the class TankWidget method drawInBackground.

@Override
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    Position pos = getPosition();
    Size size = getSize();
    if (backgroundTexture != null) {
        for (TextureArea textureArea : backgroundTexture) {
            textureArea.draw(pos.x, pos.y, size.width, size.height);
        }
    }
    // do not draw fluids if they are handled by JEI - it draws them itself
    if (lastFluidInTank != null && lastFluidInTank.amount > 0 && !gui.isJEIHandled) {
        GlStateManager.disableBlend();
        RenderUtil.drawFluidForGui(lastFluidInTank, alwaysShowFull ? lastFluidInTank.amount : lastTankCapacity, pos.x + fluidRenderOffset, pos.y + fluidRenderOffset, size.width - fluidRenderOffset, size.height - fluidRenderOffset);
        int bucketsAmount = lastFluidInTank.amount / 1000;
        if (alwaysShowFull && !hideTooltip && bucketsAmount > 0) {
            String s = String.valueOf(bucketsAmount);
            FontRenderer fontRenderer = Minecraft.getMinecraft().fontRenderer;
            fontRenderer.drawStringWithShadow(s, pos.x + 1 + size.width - 2 - fontRenderer.getStringWidth(s), pos.y + (size.height / 3) + 3, 0xFFFFFF);
        }
        GlStateManager.enableBlend();
        GlStateManager.color(1.0f, 1.0f, 1.0f);
    }
    if (overlayTexture != null) {
        overlayTexture.draw(pos.x, pos.y, size.width, size.height);
    }
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) TextureArea(gregtech.api.gui.resources.TextureArea) FontRenderer(net.minecraft.client.gui.FontRenderer)

Example 3 with TextureArea

use of gregtech.api.gui.resources.TextureArea in project GregTech by GregTechCE.

the class VerticalTabListRenderer method renderTabs.

@Override
public void renderTabs(Position offset, List<ITabInfo> tabInfos, int guiWidth, int guiHeight, int selectedTabIndex) {
    boolean startTop = startCorner == VerticalStartCorner.TOP;
    boolean isLeftLine = verticalLocation == HorizontalLocation.LEFT;
    int tabXPosition = isLeftLine ? (0 - TAB_HEIGHT + TAB_Y_OFFSET) : (guiWidth - TAB_Y_OFFSET);
    int currentYPosition = 0;
    for (int tabIndex = 0; tabIndex < tabInfos.size(); tabIndex++) {
        boolean isTabSelected = tabIndex == selectedTabIndex;
        boolean isTabFirst = tabIndex == 0;
        TextureArea tabTexture = getTabTexture(isTabSelected, isTabFirst, isLeftLine, startTop);
        int finalPosY = startTop ? currentYPosition : (guiHeight - TAB_WIDTH - currentYPosition);
        // noinspection SuspiciousNameCombination
        tabInfos.get(tabIndex).renderTab(tabTexture, offset.x + tabXPosition, offset.y + finalPosY, TAB_HEIGHT, TAB_WIDTH, isTabSelected);
        currentYPosition += (TAB_WIDTH + SPACE_BETWEEN_TABS);
    }
}
Also used : TextureArea(gregtech.api.gui.resources.TextureArea)

Example 4 with TextureArea

use of gregtech.api.gui.resources.TextureArea in project GregTech by GregTechCE.

the class SlotWidget method drawInBackground.

@Override
@SideOnly(Side.CLIENT)
public void drawInBackground(int mouseX, int mouseY, IRenderContext context) {
    if (isEnabled() && backgroundTexture != null) {
        Position pos = getPosition();
        Size size = getSize();
        for (TextureArea backgroundTexture : this.backgroundTexture) {
            backgroundTexture.draw(pos.x, pos.y, size.width, size.height);
        }
    }
}
Also used : Position(gregtech.api.util.Position) Size(gregtech.api.util.Size) TextureArea(gregtech.api.gui.resources.TextureArea) SideOnly(net.minecraftforge.fml.relauncher.SideOnly)

Example 5 with TextureArea

use of gregtech.api.gui.resources.TextureArea in project GregTech by GregTechCE.

the class RecipeMap method getOverlaysForSlot.

protected TextureArea[] getOverlaysForSlot(boolean isOutput, boolean isFluid, boolean isLast) {
    TextureArea base = isFluid ? GuiTextures.FLUID_SLOT : GuiTextures.SLOT;
    if (!isOutput && !isFluid && isLast && recipeBuilderSample instanceof IntCircuitRecipeBuilder) {
        // automatically add int circuit overlay to last item input slot
        return new TextureArea[] { base, GuiTextures.INT_CIRCUIT_OVERLAY };
    }
    byte overlayKey = (byte) ((isOutput ? 2 : 0) + (isFluid ? 1 : 0) + (isLast ? 4 : 0));
    if (slotOverlays.containsKey(overlayKey)) {
        return new TextureArea[] { base, slotOverlays.get(overlayKey) };
    }
    return new TextureArea[] { base };
}
Also used : TextureArea(gregtech.api.gui.resources.TextureArea) IntCircuitRecipeBuilder(gregtech.api.recipes.builders.IntCircuitRecipeBuilder)

Aggregations

TextureArea (gregtech.api.gui.resources.TextureArea)5 Position (gregtech.api.util.Position)2 Size (gregtech.api.util.Size)2 IntCircuitRecipeBuilder (gregtech.api.recipes.builders.IntCircuitRecipeBuilder)1 FontRenderer (net.minecraft.client.gui.FontRenderer)1 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)1