Search in sources :

Example 1 with ISprite

use of buildcraft.api.core.render.ISprite in project BuildCraft by BuildCraft.

the class LedgerOwnership method drawIcon.

@Override
protected void drawIcon(double x, double y) {
    ISprite sprite = SpriteUtil.getFaceSprite(tile.getOwner());
    GuiIcon.draw(sprite, x, y, x + 16, y + 16);
}
Also used : ISprite(buildcraft.api.core.render.ISprite)

Example 2 with ISprite

use of buildcraft.api.core.render.ISprite in project BuildCraft by BuildCraft.

the class GuiElementStatementDrag method drawForeground.

@Override
public void drawForeground(float partialTicks) {
    if (isDragging) {
        boolean canPlace = false;
        for (IGuiElement element : gui.getElementsAt(gui.mouse.getX(), gui.mouse.getY())) {
            if (element instanceof IReference<?>) {
                if (checkCanSet((IReference<?>) element, dragging)) {
                    canPlace = true;
                    break;
                }
            }
        }
        GlStateManager.clear(GL11.GL_DEPTH_BUFFER_BIT);
        if (!canPlace) {
            GlStateManager.color(1.0f, 0.7f, 0.7f);
        }
        double x = gui.mouse.getX() - 9;
        double y = gui.mouse.getY() - 9;
        if (dragging instanceof IStatementParameter) {
            ParameterRenderer.draw((IStatementParameter) dragging, x, y);
        } else {
            GuiIcon background = GuiElementStatement.SLOT_COLOUR;
            if (dragging instanceof StatementWrapper) {
                EnumPipePart part = ((StatementWrapper) dragging).sourcePart;
                if (part != EnumPipePart.CENTER) {
                    background = background.offset(0, (1 + part.getIndex()) * 18);
                }
            }
            background.drawAt(x, y);
            if (dragging != null) {
                ISprite sprite = dragging.getSprite();
                if (sprite != null) {
                    GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
                }
            }
        }
        GlStateManager.color(1, 1, 1);
    }
}
Also used : StatementWrapper(buildcraft.lib.statement.StatementWrapper) ISprite(buildcraft.api.core.render.ISprite) EnumPipePart(buildcraft.api.core.EnumPipePart) IGuiElement(buildcraft.lib.gui.IGuiElement) IStatementParameter(buildcraft.api.statements.IStatementParameter) IReference(buildcraft.lib.misc.data.IReference) GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 3 with ISprite

use of buildcraft.api.core.render.ISprite in project BuildCraft by BuildCraft.

the class GuiElementStatementSource method drawGuiSlot.

public static void drawGuiSlot(@Nullable IGuiSlot guiSlot, double x, double y) {
    if (guiSlot instanceof IStatementParameter) {
        ParameterRenderer.draw((IStatementParameter) guiSlot, x, y);
        return;
    }
    GuiIcon background = GuiElementStatement.SLOT_COLOUR;
    if (guiSlot instanceof StatementWrapper) {
        EnumPipePart part = ((StatementWrapper) guiSlot).sourcePart;
        if (part != EnumPipePart.CENTER) {
            background = background.offset(0, (1 + part.getIndex()) * 18);
        }
    }
    background.drawAt(x, y);
    if (guiSlot != null) {
        ISprite sprite = guiSlot.getSprite();
        if (sprite != null) {
            GuiIcon.drawAt(sprite, x + 1, y + 1, 16);
        }
    }
}
Also used : StatementWrapper(buildcraft.lib.statement.StatementWrapper) ISprite(buildcraft.api.core.render.ISprite) EnumPipePart(buildcraft.api.core.EnumPipePart) IStatementParameter(buildcraft.api.statements.IStatementParameter) GuiIcon(buildcraft.lib.gui.GuiIcon)

Example 4 with ISprite

use of buildcraft.api.core.render.ISprite in project BuildCraft by BuildCraft.

the class CompiledLaserRow method texU.

private double texU(double between) {
    ISprite sprite = sprites[currentRowIndex];
    LaserRow row = rows[currentRowIndex];
    if (between == 0)
        return sprite.getInterpU(row.uMin);
    if (between == 1)
        return sprite.getInterpU(row.uMax);
    double interp = row.uMin * (1 - between) + row.uMax * between;
    return sprite.getInterpU(interp);
}
Also used : ISprite(buildcraft.api.core.render.ISprite) LaserRow(buildcraft.lib.client.render.laser.LaserData_BC8.LaserRow)

Example 5 with ISprite

use of buildcraft.api.core.render.ISprite in project BuildCraft by BuildCraft.

the class GuiBC8 method drawProgress.

public void drawProgress(GuiRectangle rect, GuiIcon icon, double widthPercent, double heightPercent) {
    double nWidth = rect.width * Math.abs(widthPercent);
    double nHeight = rect.height * Math.abs(heightPercent);
    ISprite sprite = GuiUtil.subRelative(icon.sprite, 0, 0, widthPercent, heightPercent);
    double x = rect.x + mainGui.rootElement.getX();
    double y = rect.y + mainGui.rootElement.getY();
    GuiIcon.draw(sprite, x, y, x + nWidth, y + nHeight);
}
Also used : ISprite(buildcraft.api.core.render.ISprite)

Aggregations

ISprite (buildcraft.api.core.render.ISprite)14 GuiIcon (buildcraft.lib.gui.GuiIcon)3 ResourceLocation (net.minecraft.util.ResourceLocation)3 EnumPipePart (buildcraft.api.core.EnumPipePart)2 IStatementParameter (buildcraft.api.statements.IStatementParameter)2 LaserRow (buildcraft.lib.client.render.laser.LaserData_BC8.LaserRow)2 SpriteRaw (buildcraft.lib.client.sprite.SpriteRaw)2 GuiSpriteScaled (buildcraft.lib.gui.GuiSpriteScaled)2 IGuiElement (buildcraft.lib.gui.IGuiElement)2 ISimpleDrawable (buildcraft.lib.gui.ISimpleDrawable)2 GuiElementDrawable (buildcraft.lib.gui.elem.GuiElementDrawable)2 GuiRectangle (buildcraft.lib.gui.pos.GuiRectangle)2 IGuiArea (buildcraft.lib.gui.pos.IGuiArea)2 StatementWrapper (buildcraft.lib.statement.StatementWrapper)2 SlotIndex (buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli.SlotIndex)2 BCCoreSprites (buildcraft.core.BCCoreSprites)1 BCLibSprites (buildcraft.lib.BCLibSprites)1 SubSpriteChanging (buildcraft.lib.client.sprite.SubSpriteChanging)1 FunctionContext (buildcraft.lib.expression.FunctionContext)1 INodeBoolean (buildcraft.lib.expression.api.IExpressionNode.INodeBoolean)1