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

The following examples show how to use net.minecraft.client.renderer.Tessellator#setColorOpaque_I() . 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: RenderRing.java    From PneumaticCraft with GNU General Public License v3.0 6 votes vote down vote up
@SideOnly(Side.CLIENT)
public void renderInterpolated(RenderProgressingLine lastTickLine, float partialTick, float rotationYaw, float rotationPitch){
    GL11.glPushMatrix();
    double renderProgress = getInter(progress, lastTickLine.progress, partialTick);
    GL11.glTranslated((getInter(endX, lastTickLine.endX, partialTick) - startX) * renderProgress, (getInter(endY, lastTickLine.endY, partialTick) - startY) * renderProgress, (getInter(endZ, lastTickLine.endZ, partialTick) - startZ) * renderProgress);
    GL11.glRotatef(rotationYaw, 0.0F, 1.0F, 0.0F);
    GL11.glRotatef(rotationPitch, 0.0F, 0.0F, 1.0F);
    Tessellator tess = Tessellator.instance;
    GL11.glEnable(GL11.GL_LINE_SMOOTH);
    tess.startDrawing(GL11.GL_LINE_LOOP);
    tess.setColorOpaque_I(color);
    double size = 5 / 16D;
    for(int i = 0; i < PneumaticCraftUtils.circlePoints; i++) {
        tess.addVertex(0, PneumaticCraftUtils.sin[i] * size, PneumaticCraftUtils.cos[i] * size);
    }
    tess.draw();
    GL11.glDisable(GL11.GL_LINE_SMOOTH);
    GL11.glPopMatrix();
}
 
Example 2
Source File: CellViewer.java    From ehacks-pro with GNU General Public License v3.0 5 votes vote down vote up
private void renderQuad(Tessellator p_77017_1_, int p_77017_2_, int p_77017_3_, int p_77017_4_, int p_77017_5_, int p_77017_6_) {
    p_77017_1_.startDrawingQuads();
    p_77017_1_.setColorOpaque_I(p_77017_6_);
    p_77017_1_.addVertex((p_77017_2_), (p_77017_3_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_), (p_77017_3_ + p_77017_5_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_ + p_77017_4_), (p_77017_3_ + p_77017_5_), 0.0D);
    p_77017_1_.addVertex((p_77017_2_ + p_77017_4_), (p_77017_3_), 0.0D);
    p_77017_1_.draw();
}
 
Example 3
Source File: RenderLaser.java    From PneumaticCraft with GNU General Public License v3.0 5 votes vote down vote up
private void renderQuad(int color){
    Tessellator t = Tessellator.instance;
    t.startDrawingQuads();
    t.setColorOpaque_I(color);
    t.addVertexWithUV(-0.5, 0, 0, 0, 0);
    t.addVertexWithUV(-0.5, 1, 0, 0, 1);
    t.addVertexWithUV(0.5, 1, 0, 1, 1);
    t.addVertexWithUV(0.5, 0, 0, 1, 0);
    t.draw();
}
 
Example 4
Source File: WidgetTank.java    From PneumaticCraft with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void render(int mouseX, int mouseY, float partialTick){
    GL11.glDisable(GL11.GL_LIGHTING);

    Fluid fluid = tank.getFluid() != null ? tank.getFluid().getFluid() : null;
    IIcon icon = fluid != null ? fluid.getStillIcon() : null;
    int amt = tank.getFluidAmount();
    int capacity = tank.getCapacity();
    int height = 64;
    int width = 16;

    if(fluid != null && icon != null && amt > 0 && capacity > 0) {
        Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.locationBlocksTexture);

        double fluidPercentage = amt / (double)capacity;
        double fluidHeight = height * fluidPercentage;

        GL11.glPushMatrix();
        {
            GL11.glTranslated(0, height, 0);
            GL11.glEnable(GL11.GL_BLEND);
            while(fluidHeight > 0) {
                double moved = Math.min(fluidHeight, icon.getIconHeight());
                GL11.glTranslated(0, -moved, 0);
                Tessellator t = Tessellator.instance;
                t.startDrawingQuads();
                t.setColorOpaque_I(fluid.getColor(tank.getFluid()));
                {
                    t.addVertexWithUV(x, y, 0, icon.getMinU(), icon.getMinV() + (icon.getMaxV() - icon.getMinV()) * (1 - moved / icon.getIconHeight()));
                    t.addVertexWithUV(x, y + moved, 0, icon.getMinU(), icon.getMaxV());
                    t.addVertexWithUV(x + width, y + moved, 0, icon.getMaxU(), icon.getMaxV());
                    t.addVertexWithUV(x + width, y, 0, icon.getMaxU(), icon.getMinV() + (icon.getMaxV() - icon.getMinV()) * (1 - moved / icon.getIconHeight()));
                }
                t.draw();
                fluidHeight -= moved;
            }
            GL11.glDisable(GL11.GL_BLEND);
        }
        GL11.glPopMatrix();
    }

    GL11.glColor4d(1, 1, 1, 1);
    Minecraft.getMinecraft().getTextureManager().bindTexture(Textures.WIDGET_TANK);
    Gui.func_146110_a(x, y, 0, 0, 16, 64, 16, 64);
}
 
Example 5
Source File: RenderHelperMonitorStorageFluid.java    From ExtraCells1 with MIT License 4 votes vote down vote up
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
	Tessellator ts = Tessellator.instance;
	ts.setColorOpaque_I(0xFFFFFF);
	ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	renderer.renderStandardBlock(block, x, y, z);
	BlockMonitorStorageFluid monitorBlock = (BlockMonitorStorageFluid) block;
	int[] color =
	{ 0, 0, 0 };
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityMonitorStorageFluid)
	{
		TileEntityMonitorStorageFluid monitorTE = (TileEntityMonitorStorageFluid) blockTE;
		switch (monitorTE.getColor())
		{
		case -1:
			color = fluix.clone();
			break;
		case 0:
			color = blue.clone();
			break;
		case 1:
			color = black.clone();
			break;
		case 2:
			color = white.clone();
			break;
		case 3:
			color = brown.clone();
			break;
		case 4:
			color = red.clone();
			break;
		case 5:
			color = yellow.clone();
			break;
		case 6:
			color = green.clone();
			break;
		}

		boolean active = monitorTE.isMachineActive();
		ts.setBrightness(15 << 2 | 15 << 0);
		if (active)
			ts.setBrightness(15 << 20 | 15 << 4);

		for (int i = 0; i < 3; i++)
		{
			ts.setColorOpaque_I(color[i]);
			drawFace(face, block, x, y, z, monitorBlock.colorLayers[i], renderer);
		}
	}
	return true;
}
 
Example 6
Source File: RenderHelperTerminalFluid.java    From ExtraCells1 with MIT License 4 votes vote down vote up
public boolean renderWorldBlock(IBlockAccess world, int x, int y, int z, Block block, int modelId, RenderBlocks renderer)
{
	renderer.renderStandardBlock(block, x, y, z);

	Tessellator ts = Tessellator.instance;
	ForgeDirection face = ForgeDirection.getOrientation(world.getBlockMetadata(x, y, z));
	BlockTerminalFluid terminalBlock = (BlockTerminalFluid) block;
	int[] color =
	{ 0, 0, 0 };
	TileEntity blockTE = world.getBlockTileEntity(x, y, z);
	if (blockTE instanceof TileEntityTerminalFluid)
	{
		TileEntityTerminalFluid terminalTE = (TileEntityTerminalFluid) blockTE;
		switch (terminalTE.getColor())
		{
		case -1:
			color = fluix.clone();
			break;
		case 0:
			color = blue.clone();
			break;
		case 1:
			color = black.clone();
			break;
		case 2:
			color = white.clone();
			break;
		case 3:
			color = brown.clone();
			break;
		case 4:
			color = red.clone();
			break;
		case 5:
			color = yellow.clone();
			break;
		case 6:
			color = green.clone();
			break;
		}

		boolean active = terminalTE.isMachineActive();

		ts.setBrightness(15 << 2 | 15 << 0);

		if (active)
			ts.setBrightness(15 << 20 | 15 << 4);

		ts.setColorOpaque_I(0xFFFFFF);
		drawFace(face, block, x, y, z, terminalBlock.baseLayer, renderer);
		for (int i = 0; i < 3; i++)
		{
			ts.setColorOpaque_I(color[i]);
			drawFace(face, block, x, y, z, terminalBlock.colorLayers[i], renderer);
		}
	}
	return true;
}