Search in sources :

Example 6 with ISprite

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

the class CompiledLaserRow method texV.

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

Example 7 with ISprite

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

the class PipeWireRenderer method compileQuads.

private static int compileQuads(MutableQuad[] quads, EnumDyeColor colour, boolean isOn) {
    int index = GlStateManager.glGenLists(1);
    GlStateManager.glNewList(index, GL11.GL_COMPILE);
    ISprite sprite = wireSprites.get(colour);
    /*
         * Currently pipe wire only supports two states - on or off. However all the textures supply 16 different
         * states, which could (possibly) be used for making pipe wire use all 16 states that normal redstone does. This
         * just opens up the possibility in the future.
         */
    renderQuads(quads, sprite, isOn ? 15 : 0);
    GL11.glEndList();
    return index;
}
Also used : ISprite(buildcraft.api.core.render.ISprite)

Example 8 with ISprite

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

the class LedgerHelp method drawIcon.

@Override
protected void drawIcon(double x, double y) {
    if (!init) {
        init = true;
        List<HelpPosition> elements = new ArrayList<>();
        for (IGuiElement element : gui.shownElements) {
            element.addHelpElements(elements);
        }
        foundAny = elements.size() > 0;
    }
    ISprite sprite = foundAny ? BCLibSprites.HELP : BCLibSprites.WARNING_MINOR;
    GuiIcon.draw(sprite, x, y, x + 16, y + 16);
}
Also used : HelpPosition(buildcraft.lib.gui.help.ElementHelpInfo.HelpPosition) ISprite(buildcraft.api.core.render.ISprite) ArrayList(java.util.ArrayList) IGuiElement(buildcraft.lib.gui.IGuiElement)

Example 9 with ISprite

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

the class GuiEmzuliPipe_BC8 method drawBackgroundLayer.

@Override
protected void drawBackgroundLayer(float partialTicks) {
    ICON_GUI.drawAt(mainGui.rootElement);
    SlotIndex currentSlot = container.behaviour.getCurrentSlot();
    for (SlotIndex index : container.behaviour.getActiveSlots()) {
        boolean current = index == currentSlot;
        int x = (index.ordinal() < 2 ? 4 : 155);
        int y = (index.ordinal() % 2 == 0 ? 21 : 49);
        ISprite sprite = current ? BCCoreSprites.TRIGGER_TRUE : BCLibSprites.LOCK;
        GuiIcon.drawAt(sprite, mainGui.rootElement.getX() + x, mainGui.rootElement.getY() + y, 16);
    }
}
Also used : ISprite(buildcraft.api.core.render.ISprite) SlotIndex(buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli.SlotIndex)

Example 10 with ISprite

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

the class GuiEmzuliPipe_BC8 method addButton.

private void addButton(SlotIndex index, int x, int y) {
    Supplier<EnumDyeColor> getter = () -> container.behaviour.slotColours.get(index);
    Consumer<EnumDyeColor> setter = c -> container.paintWidgets.get(index).setColour(c);
    IGuiPosition elem = mainGui.rootElement.offset(x, y);
    GuiButtonDrawable button = new GuiButtonDrawable(mainGui, index.name(), elem, PAINT_BUTTON_BUILDER);
    button.registerListener((b, key) -> {
        final EnumDyeColor old = getter.get();
        EnumDyeColor nColour;
        switch(key) {
            case 0:
                {
                    nColour = ColourUtil.getNextOrNull(old);
                    break;
                }
            case 1:
                {
                    nColour = ColourUtil.getPrevOrNull(old);
                    break;
                }
            case 2:
                {
                    nColour = null;
                    break;
                }
            default:
                {
                    return;
                }
        }
        setter.accept(nColour);
    });
    mainGui.shownElements.add(button);
    // Button paintbrush
    IGuiArea area = new GuiRectangle(20, 20).offset(elem);
    ISimpleDrawable paintIcon = (px, py) -> {
        EnumDyeColor colour = getter.get();
        if (colour == null) {
            ICON_NO_PAINT.drawAt(px + 2, py + 2);
        } else {
            ISprite sprite = BCTransportSprites.ACTION_PIPE_COLOUR[colour.ordinal()];
            GuiIcon.drawAt(sprite, px + 2, py + 2, 16);
        }
    };
    mainGui.shownElements.add(new GuiElementDrawable(mainGui, area, paintIcon, false));
    ITooltipElement tooltips = list -> {
        EnumDyeColor colour = getter.get();
        String line;
        if (colour == null) {
            line = LocaleUtil.localize("gui.pipes.emzuli.nopaint");
        } else {
            line = LocaleUtil.localize("gui.pipes.emzuli.paint", ColourUtil.getTextFullTooltip(colour));
        }
        list.add(new ToolTip(line));
    };
    mainGui.shownElements.add(new GuiElementToolTip(mainGui, area, tooltips));
}
Also used : ITooltipElement(buildcraft.lib.gui.ITooltipElement) Supplier(java.util.function.Supplier) ISprite(buildcraft.api.core.render.ISprite) GuiIcon(buildcraft.lib.gui.GuiIcon) SlotIndex(buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli.SlotIndex) GuiBC8(buildcraft.lib.gui.GuiBC8) GuiElementDrawable(buildcraft.lib.gui.elem.GuiElementDrawable) GuiRectangle(buildcraft.lib.gui.pos.GuiRectangle) BCLibSprites(buildcraft.lib.BCLibSprites) ISimpleDrawable(buildcraft.lib.gui.ISimpleDrawable) GuiElementToolTip(buildcraft.lib.gui.GuiElementToolTip) BCTransportSprites(buildcraft.transport.BCTransportSprites) LocaleUtil(buildcraft.lib.misc.LocaleUtil) PipeBehaviourEmzuli(buildcraft.transport.pipe.behaviour.PipeBehaviourEmzuli) Consumer(java.util.function.Consumer) ToolTip(buildcraft.lib.gui.elem.ToolTip) EnumDyeColor(net.minecraft.item.EnumDyeColor) EntityPlayer(net.minecraft.entity.player.EntityPlayer) ResourceLocation(net.minecraft.util.ResourceLocation) ColourUtil(buildcraft.lib.misc.ColourUtil) ContainerEmzuliPipe_BC8(buildcraft.transport.container.ContainerEmzuliPipe_BC8) BCCoreSprites(buildcraft.core.BCCoreSprites) GuiButtonDrawable(buildcraft.lib.gui.button.GuiButtonDrawable) IGuiArea(buildcraft.lib.gui.pos.IGuiArea) IGuiPosition(buildcraft.lib.gui.pos.IGuiPosition) GuiElementToolTip(buildcraft.lib.gui.GuiElementToolTip) ToolTip(buildcraft.lib.gui.elem.ToolTip) IGuiArea(buildcraft.lib.gui.pos.IGuiArea) ISimpleDrawable(buildcraft.lib.gui.ISimpleDrawable) ITooltipElement(buildcraft.lib.gui.ITooltipElement) GuiRectangle(buildcraft.lib.gui.pos.GuiRectangle) ISprite(buildcraft.api.core.render.ISprite) GuiButtonDrawable(buildcraft.lib.gui.button.GuiButtonDrawable) GuiElementDrawable(buildcraft.lib.gui.elem.GuiElementDrawable) EnumDyeColor(net.minecraft.item.EnumDyeColor) GuiElementToolTip(buildcraft.lib.gui.GuiElementToolTip) IGuiPosition(buildcraft.lib.gui.pos.IGuiPosition)

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