Java Code Examples for net.minecraft.client.renderer.Tessellator#setColorRGBA()

The following examples show how to use net.minecraft.client.renderer.Tessellator#setColorRGBA() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RenderParticle.java    From Translocators with MIT License 6 votes vote down vote up
public static void render(double x, double y, double z, Colour colour, double s, double u1, double v1, double u2, double v2)
{
    x-=EntityFX.interpPosX;
    y-=EntityFX.interpPosY;
    z-=EntityFX.interpPosZ;
    //TODO: check
    
    float par3 = ActiveRenderInfo.rotationX;
    float par4 = ActiveRenderInfo.rotationXZ;
    float par5 = ActiveRenderInfo.rotationZ;
    float par6 = ActiveRenderInfo.rotationYZ;
    float par7 = ActiveRenderInfo.rotationXY;
    
    Tessellator t = Tessellator.instance;
    t.setColorRGBA(colour.r&0xFF, colour.g&0xFF, colour.b&0xFF, colour.a&0xFF);
    t.addVertexWithUV((x - par3 * s - par6 * s), (y - par4 * s), (z - par5 * s - par7 * s), u2, v2);
    t.addVertexWithUV((x - par3 * s + par6 * s), (y + par4 * s), (z - par5 * s + par7 * s), u2, v1);
    t.addVertexWithUV((x + par3 * s + par6 * s), (y + par4 * s), (z + par5 * s + par7 * s), u1, v1);
    t.addVertexWithUV((x + par3 * s - par6 * s), (y - par4 * s), (z + par5 * s - par7 * s), u1, v2);
}
 
Example 2
Source File: PotionCustomTexture.java    From Gadomancy with GNU Lesser General Public License v3.0 5 votes vote down vote up
@Override
public void renderInventoryEffect(int x, int y, PotionEffect effect, Minecraft mc) {
    Tessellator tes = Tessellator.instance;
    mc.renderEngine.bindTexture(texture);
    tes.startDrawingQuads();
    Color c = new Color(getLiquidColor());
    tes.setColorRGBA(c.getRed(), c.getGreen(), c.getBlue(), c.getAlpha());
    tes.addVertexWithUV(x + 6, y + 7, 0, 0, 0);
    tes.addVertexWithUV(x + 6,      y + 7 + 18, 0, 0, 1);
    tes.addVertexWithUV(x + 6 + 18, y + 7 + 18, 0, 1, 1);
    tes.addVertexWithUV(x + 6 + 18, y + 7, 0, 1, 0);
    tes.draw();
}
 
Example 3
Source File: RenderCarvableBeacon.java    From Chisel-2 with GNU General Public License v2.0 4 votes vote down vote up
public void renderTileEntityAt(TileEntityCarvableBeacon beacon, double x, double y, double z, float partialTicks) {
    float f1 = beacon.func_146002_i();
    GL11.glAlphaFunc(GL11.GL_GREATER, 0.1F);
    if(f1 > 0.1F){
        Color color = new Color(ItemDye.field_150922_c[beacon.getWorldObj().getBlockMetadata(beacon.xCoord, beacon.yCoord, beacon.zCoord)]);
        Tessellator tessellator = Tessellator.instance;
        this.bindTexture(texture);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_S, 10497.0F);
        GL11.glTexParameterf(GL11.GL_TEXTURE_2D, GL11.GL_TEXTURE_WRAP_T, 10497.0F);
        GL11.glDisable(GL11.GL_LIGHTING);
        GL11.glDisable(GL11.GL_CULL_FACE);
        GL11.glDisable(GL11.GL_BLEND);
        GL11.glDepthMask(true);
        OpenGlHelper.glBlendFunc(770, 1, 1, 0);
        float f2 = (float) beacon.getWorldObj().getTotalWorldTime() + partialTicks;
        float f3 = -f2 * 0.2F - (float) MathHelper.floor_float(-f2 * 0.1F);
        byte b0 = 1;
        double d3 = (double) f2 * 0.025D * (1.0D - (double) (b0 & 1) * 2.5D);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
        double d5 = (double) b0 * 0.2D;
        double d7 = 0.5D + Math.cos(d3 + 2.356194490192345D) * d5;
        double d9 = 0.5D + Math.sin(d3 + 2.356194490192345D) * d5;
        double d11 = 0.5D + Math.cos(d3 + (Math.PI / 4D)) * d5;
        double d13 = 0.5D + Math.sin(d3 + (Math.PI / 4D)) * d5;
        double d15 = 0.5D + Math.cos(d3 + 3.9269908169872414D) * d5;
        double d17 = 0.5D + Math.sin(d3 + 3.9269908169872414D) * d5;
        double d19 = 0.5D + Math.cos(d3 + 5.497787143782138D) * d5;
        double d21 = 0.5D + Math.sin(d3 + 5.497787143782138D) * d5;
        double d23 = (double) (256.0F * f1);
        double d25 = 0.0D;
        double d27 = 1.0D;
        double d28 = (double) (-1.0F + f3);
        double d29 = (double) (256.0F * f1) * (0.5D / d5) + d28;
        tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d27, d29);
        tessellator.addVertexWithUV(x + d7, y, z + d9, d27, d28);
        tessellator.addVertexWithUV(x + d11, y, z + d13, d25, d28);
        tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d25, d29);
        tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d27, d29);
        tessellator.addVertexWithUV(x + d19, y, z + d21, d27, d28);
        tessellator.addVertexWithUV(x + d15, y, z + d17, d25, d28);
        tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d25, d29);
        tessellator.addVertexWithUV(x + d11, y + d23, z + d13, d27, d29);
        tessellator.addVertexWithUV(x + d11, y, z + d13, d27, d28);
        tessellator.addVertexWithUV(x + d19, y, z + d21, d25, d28);
        tessellator.addVertexWithUV(x + d19, y + d23, z + d21, d25, d29);
        tessellator.addVertexWithUV(x + d15, y + d23, z + d17, d27, d29);
        tessellator.addVertexWithUV(x + d15, y, z + d17, d27, d28);
        tessellator.addVertexWithUV(x + d7, y, z + d9, d25, d28);
        tessellator.addVertexWithUV(x + d7, y + d23, z + d9, d25, d29);
        tessellator.draw();
        GL11.glEnable(GL11.GL_BLEND);
        OpenGlHelper.glBlendFunc(770, 771, 1, 0);
        GL11.glDepthMask(false);
        tessellator.startDrawingQuads();
        tessellator.setColorRGBA(color.getRed(), color.getGreen(), color.getBlue(), 32);
        double d30 = 0.2D;
        double d4 = 0.2D;
        double d6 = 0.8D;
        double d8 = 0.2D;
        double d10 = 0.2D;
        double d12 = 0.8D;
        double d14 = 0.8D;
        double d16 = 0.8D;
        double d18 = (double) (256.0F * f1);
        double d20 = 0.0D;
        double d22 = 1.0D;
        double d24 = (double) (-1.0F + f3);
        double d26 = (double) (256.0F * f1) + d24;
        tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d22, d26);
        tessellator.addVertexWithUV(x + d30, y, z + d4, d22, d24);
        tessellator.addVertexWithUV(x + d6, y, z + d8, d20, d24);
        tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d20, d26);
        tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d22, d26);
        tessellator.addVertexWithUV(x + d14, y, z + d16, d22, d24);
        tessellator.addVertexWithUV(x + d10, y, z + d12, d20, d24);
        tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d20, d26);
        tessellator.addVertexWithUV(x + d6, y + d18, z + d8, d22, d26);
        tessellator.addVertexWithUV(x + d6, y, z + d8, d22, d24);
        tessellator.addVertexWithUV(x + d14, y, z + d16, d20, d24);
        tessellator.addVertexWithUV(x + d14, y + d18, z + d16, d20, d26);
        tessellator.addVertexWithUV(x + d10, y + d18, z + d12, d22, d26);
        tessellator.addVertexWithUV(x + d10, y, z + d12, d22, d24);
        tessellator.addVertexWithUV(x + d30, y, z + d4, d20, d24);
        tessellator.addVertexWithUV(x + d30, y + d18, z + d4, d20, d26);
        tessellator.draw();
        GL11.glEnable(GL11.GL_LIGHTING);
        GL11.glEnable(GL11.GL_TEXTURE_2D);
        GL11.glDepthMask(true);
    }
}