Search in sources :

Example 86 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project minecolonies by Minecolonies.

the class Structure method renderQuads.

private void renderQuads(final World world, final IBlockState actualState, final BlockPos pos, final List<BakedQuad> quads, final int alpha) {
    final Tessellator tessellator = Tessellator.getInstance();
    final VertexBuffer buffer = tessellator.getBuffer();
    for (final BakedQuad quad : quads) {
        buffer.begin(GL11.GL_QUADS, quad.getFormat());
        final int color = quad.hasTintIndex() ? this.getTint(world, actualState, pos, alpha, quad.getTintIndex()) : (alpha | 0xffffff);
        LightUtil.renderQuadColor(buffer, quad, color);
        tessellator.draw();
    }
}
Also used : BakedQuad(net.minecraft.client.renderer.block.model.BakedQuad) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Example 87 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class GuiKeystone method drawGuiContainerForegroundLayer.

@Override
protected void drawGuiContainerForegroundLayer(int par1, int par2) {
    int l = (width - xSize) / 2;
    int i1 = (height - ySize) / 2;
    mc.renderEngine.bindTexture(new ResourceLocation("textures/atlas/items.png"));
    int numCombos = Math.min(ItemsCommonProxy.keystone.numCombinations(((ContainerKeystone) this.inventorySlots).getKeystoneStack()), comboScrollOffset + 9);
    int cx = xSize;
    int cy = 13;
    Tessellator t = Tessellator.instance;
    KeystoneCombination matchedCombo = ((ContainerKeystone) this.inventorySlots).getCurrentMatchedCombination();
    for (int i = comboScrollOffset; i < numCombos; ++i) {
        KeystoneCombination combo = ItemsCommonProxy.keystone.getCombinationAt(((ContainerKeystone) this.inventorySlots).getKeystoneStack(), i);
        if (matchedCombo != null && combo.equals(matchedCombo)) {
            currentCombination = i;
            for (int n = 0; n < combo.metas.length; ++n) {
                if (combo.metas[n] > -1) {
                    IIcon icon = AMGuiIcons.selectedRunes;
                    AMGuiHelper.DrawIconAtXY(icon, cx, cy, this.zLevel, 16, 16, true);
                }
                cx += 18;
            }
            mc.renderEngine.bindTexture(new ResourceLocation("textures/atlas/items.png"));
            cx = xSize;
        }
        for (int n = 0; n < combo.metas.length; ++n) {
            if (combo.metas[n] > -1) {
                IIcon icon = ItemsCommonProxy.rune.getIconFromDamage(combo.metas[n]);
                AMGuiHelper.DrawIconAtXY(icon, cx, cy, this.zLevel, 16, 16, true);
            }
            cx += 18;
        }
        cy += 18;
        cx = xSize;
    }
    mc.renderEngine.bindTexture(extras);
    GL11.glColor4f(1.0F, 1.0F, 1.0F, 0.5F);
    //special slot(s)
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glBlendFunc(GL11.GL_ONE, GL11.GL_ONE_MINUS_SRC_ALPHA);
    int index = ((ContainerKeystone) this.inventorySlots).specialSlotIndex - 32;
    int x = 8 + 18 * index;
    int y = (((ContainerKeystone) this.inventorySlots).runebagSlot > -1) ? 216 : 179;
    drawTexturedModalRect(x, y, 0, 20, 16, 16);
    if (((ContainerKeystone) this.inventorySlots).runebagSlot > -1) {
        index = ((ContainerKeystone) this.inventorySlots).runebagSlot;
        x = 8 + 18 * (index % 9);
        y = index < 9 ? 216 : 140 + 18 * (int) Math.floor(index / 9f);
        drawTexturedModalRect(x, y, 0, 20, 16, 16);
    }
    GL11.glDisable(GL11.GL_BLEND);
    combinationName.drawTextBox();
    if (AMGuiHelper.instance.getSlowTicker() < displayTime) {
        fontRendererObj.drawSplitString(displayMessage, -90, 0, 90, displayColor);
    } else {
        displayTime = 0;
    }
    if (matchedCombo != null) {
        combinationName.setText(matchedCombo.name);
    }
    if (hoveredCombo > -1) {
        KeystoneCombination combo = ItemsCommonProxy.keystone.getCombinationAt(((ContainerKeystone) this.inventorySlots).getKeystoneStack(), hoveredCombo);
        ArrayList<String> lines = new ArrayList<String>();
        lines.add(combo.name);
        lines.add("\2477\247o" + StatCollector.translateToLocal("am2.gui.keystoneComboClick"));
        lines.add("\2477\247o" + StatCollector.translateToLocal("am2.gui.keystoneComboClick2") + "\247r");
        AMGuiHelper.drawHoveringText(lines, par1 - 25, par2 + 18, Minecraft.getMinecraft().fontRenderer, this.xSize, this.ySize);
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) KeystoneCombination(am2.items.ItemKeystone.KeystoneCombination) IIcon(net.minecraft.util.IIcon) ResourceLocation(net.minecraft.util.ResourceLocation) ArrayList(java.util.ArrayList) ContainerKeystone(am2.items.ContainerKeystone)

Example 88 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class AMGuiHelper method DrawIconAtXY.

public static void DrawIconAtXY(IIcon IIcon, float x, float y, float zLevel, int w, int h, boolean semitransparent) {
    if (IIcon == null)
        return;
    GL11.glMatrixMode(GL11.GL_TEXTURE);
    GL11.glPushMatrix();
    if (semitransparent) {
        GL11.glEnable(GL11.GL_BLEND);
        GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    }
    Minecraft.getMinecraft().renderEngine.bindTexture(rl_items);
    Tessellator tessellator = Tessellator.instance;
    boolean drawing = ReflectionHelper.getPrivateValue(Tessellator.class, tessellator, "field_78415_z", "isDrawing");
    if (drawing)
        tessellator.draw();
    tessellator.startDrawingQuads();
    tessellator.addVertexWithUV(x, y + h, zLevel, IIcon.getMinU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y + h, zLevel, IIcon.getMaxU(), IIcon.getMaxV());
    tessellator.addVertexWithUV(x + w, y, zLevel, IIcon.getMaxU(), IIcon.getMinV());
    tessellator.addVertexWithUV(x, y, zLevel, IIcon.getMinU(), IIcon.getMinV());
    tessellator.draw();
    if (semitransparent) {
        GL11.glDisable(GL11.GL_BLEND);
    }
    GL11.glPopMatrix();
    GL11.glMatrixMode(GL11.GL_MODELVIEW);
    if (drawing)
        tessellator.startDrawingQuads();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 89 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class AMGuiHelper method drawGradientRect.

protected static void drawGradientRect(int par1, int par2, int par3, int par4, int par5, int par6) {
    float f = (par5 >> 24 & 255) / 255.0F;
    float f1 = (par5 >> 16 & 255) / 255.0F;
    float f2 = (par5 >> 8 & 255) / 255.0F;
    float f3 = (par5 & 255) / 255.0F;
    float f4 = (par6 >> 24 & 255) / 255.0F;
    float f5 = (par6 >> 16 & 255) / 255.0F;
    float f6 = (par6 >> 8 & 255) / 255.0F;
    float f7 = (par6 & 255) / 255.0F;
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_ALPHA_TEST);
    GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    GL11.glShadeModel(GL11.GL_SMOOTH);
    Tessellator tessellator = Tessellator.instance;
    tessellator.startDrawingQuads();
    tessellator.setColorRGBA_F(f1, f2, f3, f);
    tessellator.addVertex(par3, par2, zLevel);
    tessellator.addVertex(par1, par2, zLevel);
    tessellator.setColorRGBA_F(f5, f6, f7, f4);
    tessellator.addVertex(par1, par4, zLevel);
    tessellator.addVertex(par3, par4, zLevel);
    tessellator.draw();
    GL11.glShadeModel(GL11.GL_FLAT);
    GL11.glDisable(GL11.GL_BLEND);
    GL11.glEnable(GL11.GL_ALPHA_TEST);
    GL11.glEnable(GL11.GL_TEXTURE_2D);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 90 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project ArsMagica2 by Mithion.

the class GuiArcaneCompendium method drawTexturedModalRect_Classic.

public void drawTexturedModalRect_Classic(int dst_x, int dst_y, int src_x, int src_y, int dst_width, int dst_height, int src_width, int src_height) {
    float var7 = 0.00390625F;
    float var8 = 0.00390625F;
    Tessellator var9 = Tessellator.instance;
    var9.startDrawingQuads();
    var9.addVertexWithUV(dst_x + 0, dst_y + dst_height, this.zLevel, (src_x + 0) * var7, (src_y + src_height) * var8);
    var9.addVertexWithUV(dst_x + dst_width, dst_y + dst_height, this.zLevel, (src_x + src_width) * var7, (src_y + src_height) * var8);
    var9.addVertexWithUV(dst_x + dst_width, dst_y + 0, this.zLevel, (src_x + src_width) * var7, (src_y + 0) * var8);
    var9.addVertexWithUV(dst_x + 0, dst_y + 0, this.zLevel, (src_x + 0) * var7, (src_y + 0) * var8);
    var9.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Aggregations

Tessellator (net.minecraft.client.renderer.Tessellator)247 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)53 Block (net.minecraft.block.Block)13 IIcon (net.minecraft.util.IIcon)13 EnumFacing (net.minecraft.util.EnumFacing)8 Icon (net.minecraft.util.Icon)8 BlockPos (net.minecraft.util.math.BlockPos)8 FontRenderer (net.minecraft.client.gui.FontRenderer)7 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)6 ResourceLocation (net.minecraft.util.ResourceLocation)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 Minecraft (net.minecraft.client.Minecraft)5 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)5 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)5 IIconTransformation (logisticspipes.proxy.object3d.interfaces.IIconTransformation)4 RenderManager (net.minecraft.client.renderer.entity.RenderManager)4 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)4 ItemStack (net.minecraft.item.ItemStack)4 TileEntity (net.minecraft.tileentity.TileEntity)4 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)3