net.minecraft.client.renderer.VertexBuffer Java Examples

The following examples show how to use net.minecraft.client.renderer.VertexBuffer. 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: PotionNeuropozyne.java    From Cyberware with MIT License 6 votes vote down vote up
@SideOnly(Side.CLIENT)
private void render(int x, int y, float alpha)
{
	Minecraft.getMinecraft().renderEngine.bindTexture(resource);
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buf = tessellator.getBuffer();
	buf.begin(7, DefaultVertexFormats.POSITION_TEX);
	GlStateManager.color(1, 1, 1, alpha);

	int textureX = iconIndex % 8 * 18;
	int textureY = 198 + iconIndex / 8 * 18;

	buf.pos(x, y + 18, 0).tex(textureX * 0.00390625, (textureY + 18) * 0.00390625).endVertex();
	buf.pos(x + 18, y + 18, 0).tex((textureX + 18) * 0.00390625, (textureY + 18) * 0.00390625).endVertex();
	buf.pos(x + 18, y, 0).tex((textureX + 18) * 0.00390625, textureY * 0.00390625).endVertex();
	buf.pos(x, y, 0).tex(textureX * 0.00390625, textureY * 0.00390625).endVertex();

	tessellator.draw();
}
 
Example #2
Source File: ParticleAnvil.java    From TFC2 with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void renderParticle(VertexBuffer worldRendererIn, Entity entityIn, float partialTicks, float rotationX, float rotationZ, float rotationYZ, float rotationXY, float rotationXZ) 
{
	Tessellator tessellator = Tessellator.getInstance();

	Core.bindTexture(getTexture());

	if(((float)this.particleAge/(float)this.particleMaxAge) > 1)
		return;

	float scale = particleScale-(particleScale/2f)*((float)this.particleAge/(float)this.particleMaxAge);
	float posX = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) partialTicks - interpPosX);
	float posY = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) partialTicks - interpPosY);
	float posZ = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) partialTicks - interpPosZ);
	//rotationXY = 0;
	//rotationXZ = 0.05f;
	height = 1f;

	worldRendererIn.begin(7, getVertexFormat());
	worldRendererIn.pos((double) (posX - rotationX * scale - rotationXY * scale),  (posY - rotationZ * scale * height), (double) (posZ - rotationYZ * scale - rotationXZ * scale)).tex((double) 1, (double) 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex();
	worldRendererIn.pos((double) (posX - rotationX * scale + rotationXY * scale),  (posY + rotationZ * scale * height), (double) (posZ - rotationYZ * scale + rotationXZ * scale)).tex((double) 1, (double) 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex();
	worldRendererIn.pos((double) (posX + rotationX * scale + rotationXY * scale),  (posY + rotationZ * scale * height), (double) (posZ + rotationYZ * scale + rotationXZ * scale)).tex((double) 0, (double) 0).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex();
	worldRendererIn.pos((double) (posX + rotationX * scale - rotationXY * scale),  (posY - rotationZ * scale * height), (double) (posZ + rotationYZ * scale - rotationXZ * scale)).tex((double) 0, (double) 1).color(this.particleRed, this.particleGreen, this.particleBlue, 1.0F).lightmap(0, 240).endVertex();

	tessellator.draw();
}
 
Example #3
Source File: FWParticle.java    From NOVA-Core with GNU Lesser General Public License v3.0 6 votes vote down vote up
@Override
public void renderParticle(VertexBuffer worldRendererIn, net.minecraft.entity.Entity p_180434_2_, float p_70539_2_, float x, float y, float z, float p_70539_6_, float p_70539_7_) {
	if (firstTick) {
		prevPosX = posX;
		prevPosY = posY;
		prevPosZ = posZ;
		setPosition(posX, posY, posZ);
		firstTick = false;
	}
	float f11 = (float) (this.prevPosX + (this.posX - this.prevPosX) * (double) p_70539_2_ - interpPosX);
	float f12 = (float) (this.prevPosY + (this.posY - this.prevPosY) * (double) p_70539_2_ - interpPosY);
	float f13 = (float) (this.prevPosZ + (this.posZ - this.prevPosZ) * (double) p_70539_2_ - interpPosZ);

	Tessellator.getInstance().draw();
	FWEntityRenderer.render(this, wrapped, f11, f12, f13);
	Tessellator.getInstance().getBuffer().begin(GL_QUADS, DefaultVertexFormats.BLOCK);
	FMLClientHandler.instance().getClient().renderEngine.bindTexture(RenderUtility.particleResource);
}
 
Example #4
Source File: UIStringComponent.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void draw(Tessellator tess, VertexBuffer buffer)
{
	GlStateManager.color(color & 0xff0000, color & 0x00ff00, color & 0x0000ff);
	for(UIComponent c : charCompList)
	{
		c.draw(tess, buffer);
	}
}
 
Example #5
Source File: SmallVesselHighlightHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public static void drawOutlinedBox(AxisAlignedBB aabb)
{
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();

	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();

	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();

	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	tessellator.draw();
}
 
Example #6
Source File: RenderOverlayHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void drawTexturedModalRect(float xCoord, float yCoord, int minU, int minV, int maxU, int maxV)
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vb = tessellator.getBuffer();
	vb.begin(7, DefaultVertexFormats.POSITION_TEX);
	vb.pos(xCoord + 0.0F, yCoord + maxV, 0).tex((minU + 0) * f, (minV + maxV) * f1).endVertex();
	vb.pos(xCoord + maxU, yCoord + maxV, 0).tex((minU + maxU) * f, (minV + maxV) * f1).endVertex();
	vb.pos(xCoord + maxU, yCoord + 0.0F, 0).tex((minU + maxU) * f, (minV + 0) * f1).endVertex();
	vb.pos(xCoord + 0.0F, yCoord + 0.0F, 0).tex((minU + 0) * f, (minV + 0) * f1).endVertex();
	tessellator.draw();
}
 
Example #7
Source File: AnvilHighlightHandler.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public static void drawOutlinedBox(AxisAlignedBB aabb)
{
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	buffer.begin(GL11.GL_LINES, DefaultVertexFormats.POSITION);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();

	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).endVertex();

	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();

	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).endVertex();

	tessellator.draw();
}
 
Example #8
Source File: GuiKnappingButton.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
protected void drawLocal()
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexBuffer = tessellator.getBuffer();
	vertexBuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexBuffer.pos(xPosition + 0, yPosition + 16, this.zLevel).tex(0, 1).endVertex();
	vertexBuffer.pos(xPosition + 16, yPosition + 16, this.zLevel).tex(1, 1).endVertex();
	vertexBuffer.pos(xPosition + 16, yPosition + 0, this.zLevel).tex(1, 0).endVertex();
	vertexBuffer.pos(xPosition + 0, yPosition + 0, this.zLevel).tex(0, 0).endVertex();
	tessellator.draw();
}
 
Example #9
Source File: ModelBoxTFC.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
@Override
@SideOnly(Side.CLIENT)
public void render(VertexBuffer renderer, float scale)
{
	for (int i = 0; i < this.quadList.length; ++i)
	{
		if(this.quadList[i] != null)
			this.quadList[i].draw(renderer, scale);
	}
}
 
Example #10
Source File: GuiInventoryButton.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void drawIcon(int x, int y, int textureX, int textureY, int width, int height)
{
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos((double)(x + 0), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 16), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 16), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)this.zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	tessellator.draw();
}
 
Example #11
Source File: RenderSieve.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
@Override
public void renderTileEntityAt(TileSieve te, double x, double y, double z,
		float partialTicks, int destroyStage) 
{
	Tessellator tes = Tessellator.getInstance();
	VertexBuffer wr = tes.getBuffer();

	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	if (te.getTexture() != null)
	{
		TextureAtlasSprite icon = te.getTexture();
		double minU = (double) icon.getMinU();
		double maxU = (double) icon.getMaxU();
		double minV = (double) icon.getMinV();
		double maxV = (double) icon.getMaxV();

		this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

		wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
		double height = (100.0-te.getProgress()) / 100;
		float fillAmount = (float) (0.15625*height + 0.84375);
		
		wr.pos(0.0625f,fillAmount,0.0625f).tex(minU, minV).normal(0, 1, 0).endVertex();
		wr.pos(0.0625f,fillAmount,0.9375f).tex(minU,maxV).normal(0, 1, 0).endVertex();
		wr.pos(0.9375f,fillAmount,0.9375f).tex(maxU,maxV).normal(0, 1, 0).endVertex();
		wr.pos(0.9375f,fillAmount,0.0625f).tex(maxU,minV).normal(0, 1, 0).endVertex();

		tes.draw();
	}

	GlStateManager.disableBlend();
	GlStateManager.enableLighting();
	GlStateManager.popMatrix();

}
 
Example #12
Source File: UICharComponent.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
protected float renderUnicodeChar(char ch, boolean italic)
{
	int i = this.glyphWidth[ch] & 255;

	if (i == 0)
	{
		return 0.0F;
	}
	else
	{
		int j = ch / 256;
		this.loadGlyphTexture(j);
		int k = i >>> 4;
		int l = i & 15;
		float f = (float)k;
		float f1 = (float)(l + 1);
		float f2 = (float)(ch % 16 * 16) + f;
		float f3 = (float)((ch & 255) / 16 * 16);
		float f4 = f1 - f - 0.02F;
		float f5 = italic ? 1.0F : 0.0F;

		Tessellator tess = Tessellator.getInstance();
		VertexBuffer buffer = tess.getBuffer();
		GlStateManager.enableTexture2D();
		buffer.begin(GL11.GL_TRIANGLE_STRIP, DefaultVertexFormats.POSITION_TEX);
		buffer.pos(this.xPos + (f4 / 2.0F + f5)*scale, this.yPos, zPos+zLevel).tex((f2 + f4) / 256.0F, (f3 + 15.98F) / 256.0F).endVertex();
		buffer.pos(this.xPos + (f4 / 2.0F - f5)*scale, this.yPos + (7.99F)*scale, zPos+zLevel).tex((f2 + f4) / 256.0F, (f3) / 256.0F).endVertex();
		buffer.pos(this.xPos + (f5)*scale, this.yPos, zPos+zLevel).tex(f2 / 256.0F, (f3 + 15.98F) / 256.0F).endVertex();
		buffer.pos(this.xPos - (f5)*scale, this.yPos + (7.99F)*scale, zPos+zLevel).tex(f2 / 256.0F, (f3) / 256.0F).endVertex();
		tess.draw();
		xPos += ((f1 - f) / 2.0F + 1.0F)*scale;
		return (f1 - f) / 2.0F + 1.0F;
	}
}
 
Example #13
Source File: RenderProjectileStone.java    From ExNihiloAdscensio with MIT License 5 votes vote down vote up
@Override
public void doRender(ProjectileStone entity, double x, double y, double z, float entityYaw, float partialTicks)
{
    TextureAtlasSprite texture = getTexture(Blocks.STONE.getDefaultState());
    
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer buffer = tessellator.getBuffer();
    
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    
    double minU = (double) texture.getMinU();
    double maxU = (double) texture.getMaxU();
    double minV = (double) texture.getMinV();
    double maxV = (double) texture.getMaxV();

    this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    
    buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_NORMAL);
    
    double size = 0.5;
    
    //bufferCuboid(buffer, 1, minU, minV, maxU, maxV, -8, -8, -8, 8, 8, 8);
    
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -4, -2, -2, -2,  2,  2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  4,  2,  2,  2, -2, -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -4, -2,  2, -2,  2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  2,  4,  2, -2,  2, -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV, -2, -2, -4,  2,  2,  -2);
    bufferCuboid(buffer, size, minU, minV, maxU, maxV,  2,  2,  4, -2, -2,  2);
    
    tessellator.draw();
    
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
 
Example #14
Source File: UIModel.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void draw(Tessellator tess, VertexBuffer buffer)
{
	setupGL();
	for(UIComponent c : componentList)
	{
		c.draw(tess, buffer);
	}
}
 
Example #15
Source File: UIComponent.java    From TFC2 with GNU General Public License v3.0 5 votes vote down vote up
public void draw(Tessellator tess, VertexBuffer buffer)
{
	setupGL();
	buffer.begin(GLMode, format);
	for(Vertex v : vertexList)
	{
		v.addVertex(buffer);
	}
	tess.draw();
}
 
Example #16
Source File: ClientUtils.java    From Cyberware with MIT License 5 votes vote down vote up
public static void drawTexturedModalRect(int x, int y, int textureX, int textureY, int width, int height)
{
	float zLevel = -10;
	float f = 0.00390625F;
	float f1 = 0.00390625F;
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos((double)(x + 0), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + width), (double)(y + height), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + height) * f1)).endVertex();
	vertexbuffer.pos((double)(x + width), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + width) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	vertexbuffer.pos((double)(x + 0), (double)(y + 0), (double)zLevel).tex((double)((float)(textureX + 0) * f), (double)((float)(textureY + 0) * f1)).endVertex();
	tessellator.draw();
}
 
Example #17
Source File: RenderCyberlimbHand.java    From Cyberware with MIT License 5 votes vote down vote up
private void renderMapFirstPerson(ItemStack stack)
{
	GlStateManager.rotate(180.0F, 0.0F, 1.0F, 0.0F);
	GlStateManager.rotate(180.0F, 0.0F, 0.0F, 1.0F);
	GlStateManager.scale(0.38F, 0.38F, 0.38F);
	GlStateManager.disableLighting();
	this.mc.getTextureManager().bindTexture(RES_MAP_BACKGROUND);
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer vertexbuffer = tessellator.getBuffer();
	GlStateManager.translate(-0.5F, -0.5F, 0.0F);
	GlStateManager.scale(0.0078125F, 0.0078125F, 0.0078125F);
	vertexbuffer.begin(7, DefaultVertexFormats.POSITION_TEX);
	vertexbuffer.pos(-7.0D, 135.0D, 0.0D).tex(0.0D, 1.0D).endVertex();
	vertexbuffer.pos(135.0D, 135.0D, 0.0D).tex(1.0D, 1.0D).endVertex();
	vertexbuffer.pos(135.0D, -7.0D, 0.0D).tex(1.0D, 0.0D).endVertex();
	vertexbuffer.pos(-7.0D, -7.0D, 0.0D).tex(0.0D, 0.0D).endVertex();
	tessellator.draw();
	
	if (stack != null)
	{
		MapData mapdata = Items.FILLED_MAP.getMapData(stack, Minecraft.getMinecraft().theWorld);

		if (mapdata != null)
		{
			this.mc.entityRenderer.getMapItemRenderer().renderMap(mapdata, false);
		}
	}

	GlStateManager.enableLighting();
}
 
Example #18
Source File: VertexTex.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addVertex(VertexBuffer buffer) 
{
	buffer.pos(pos.xCoord, pos.yCoord, pos.zCoord).tex(u, v).endVertex();
}
 
Example #19
Source File: VertexColor.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void addVertex(VertexBuffer buffer) 
{
	buffer.pos(pos.xCoord, pos.yCoord, pos.zCoord).color(color.getRed()/255f, color.getGreen()/255f, color.getBlue()/255f, color.getAlpha()/255f).endVertex();
}
 
Example #20
Source File: SmallVesselHighlightHandler.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public static void drawFace(AxisAlignedBB aabb, float[] color, EnumFacing facing)
{
	//TODO: Add UV coords for other faces
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	if(facing == EnumFacing.UP)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).tex(0, 1).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).tex(0, 0).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).tex(1, 0).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).tex(1, 1).color(color[0], color[1], color[2], color[3]).endVertex();

		tessellator.draw();
	}
	else if(facing == EnumFacing.DOWN)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.WEST)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.EAST)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.NORTH)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
	else if(facing == EnumFacing.SOUTH)
	{
		buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
		buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
		tessellator.draw();
	}
}
 
Example #21
Source File: SmallVesselHighlightHandler.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public static void drawBox(AxisAlignedBB aabb, float[] color)
{
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	//Top
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//Bottom
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//-x
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//+x
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//-z
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//+z
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();
}
 
Example #22
Source File: AnvilHighlightHandler.java    From TFC2 with GNU General Public License v3.0 4 votes vote down vote up
public static void drawBox(AxisAlignedBB aabb, float[] color)
{
	Tessellator tessellator = Tessellator.getInstance();
	VertexBuffer buffer = tessellator.getBuffer();
	//Top
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//Bottom
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//-x
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//+x
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//-z
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.minX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.minY, aabb.minZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();

	//+z
	buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_COLOR);
	buffer.pos(aabb.maxX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.maxX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.maxY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	buffer.pos(aabb.minX, aabb.minY, aabb.maxZ).color(color[0], color[1], color[2], color[3]).endVertex();
	tessellator.draw();
}
 
Example #23
Source File: GuiVertTextField.java    From pycode-minecraft with MIT License 4 votes vote down vote up
/**
 * Draws the current selection and a vertical line cursor in the text box.
 */
private void drawCursorVertical(int startX, int startY, int endX, int endY)
{
    if (startX < endX)
    {
        int i = startX;
        startX = endX;
        endX = i;
    }

    if (startY < endY)
    {
        int j = startY;
        startY = endY;
        endY = j;
    }

    if (endX > this.xPosition + this.width)
    {
        endX = this.xPosition + this.width;
    }

    if (startX > this.xPosition + this.width)
    {
        startX = this.xPosition + this.width;
    }

    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    GlStateManager.color(0.0F, 0.0F, 255.0F, 255.0F);
    GlStateManager.disableTexture2D();
    GlStateManager.enableColorLogic();
    GlStateManager.colorLogicOp(GlStateManager.LogicOp.OR_REVERSE);
    vertexbuffer.begin(7, DefaultVertexFormats.POSITION);
    vertexbuffer.pos((double)startX, (double)endY, 0.0D).endVertex();
    vertexbuffer.pos((double)endX, (double)endY, 0.0D).endVertex();
    vertexbuffer.pos((double)endX, (double)startY, 0.0D).endVertex();
    vertexbuffer.pos((double)startX, (double)startY, 0.0D).endVertex();
    tessellator.draw();
    GlStateManager.disableColorLogic();
    GlStateManager.enableTexture2D();
}
 
Example #24
Source File: RenderBarrel.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileBarrel tile, double x, double y, double z, float partialTicks, int destroyStage)
{
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer buffer = tessellator.getBuffer();
    
    GlStateManager.pushMatrix();
    GlStateManager.translate(x, y, z);
    
    if (tile.getMode() != null)
    {
        float fillAmount = tile.getMode().getFilledLevelForRender(tile);
        
        if (fillAmount > 0)
        {
            Color color = tile.getMode().getColorForRender();
            
            if (color == null)
            {
                color = Util.whiteColor;
            }
            
            TextureAtlasSprite icon = tile.getMode().getTextureForRender(tile);
            if (icon == null)
            	icon = Minecraft.getMinecraft().getTextureMapBlocks().getMissingSprite();
            
            double minU = (double) icon.getMinU();
            double maxU = (double) icon.getMaxU();
            double minV = (double) icon.getMinV();
            double maxV = (double) icon.getMaxV();
            
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            
            buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
            
            buffer.pos(0.125f, fillAmount, 0.125f).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
            buffer.pos(0.125f, fillAmount, 0.875f).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
            buffer.pos(0.875f, fillAmount, 0.875f).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
            buffer.pos(0.875f, fillAmount, 0.125f).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
            
            tessellator.draw();
        }
    }
    
    GlStateManager.disableBlend();
    GlStateManager.enableLighting();
    GlStateManager.popMatrix();
}
 
Example #25
Source File: RenderProjectileStone.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
private static void bufferCuboid(VertexBuffer buffer, double size, double minU, double minV, double maxU, double maxV, double x1, double y1, double z1, double x2, double y2, double z2)
{
    size /= 16.0;
    
    double xMin = Math.min(x1, x2);
    double xMax = Math.max(x1, x2);
    
    double yMin = Math.min(y1, y2);
    double yMax = Math.max(y1, y2);
    
    double zMin = Math.min(z1, z2);
    double zMax = Math.max(z1, z2);

    double xUMin = minU + (maxU - minU) * (xMin + 8.0) / 16.0;
    double xUMax = minU + (maxU - minU) * (xMax + 8.0) / 16.0;
    
    //double yUMin = minU + (maxU - minU) * (yMin + 8.0) / 16.0;
    //double yUMax = minU + (maxU - minU) * (yMax + 8.0) / 16.0;
    
    double zUMin = minU + (maxU - minU) * (zMin + 8.0) / 16.0;
    double zUMax = minU + (maxU - minU) * (zMax + 8.0) / 16.0;
    
    //double xVMin = minV + (maxV - minV) * (xMin + 8.0) / 16.0;
    //double xVMax = minV + (maxV - minV) * (xMax + 8.0) / 16.0;
    
    double yVMin = minV + (maxV - minV) * (yMin + 8.0) / 16.0;
    double yVMax = minV + (maxV - minV) * (yMax + 8.0) / 16.0;
    
    double zVMin = minV + (maxV - minV) * (zMin + 8.0) / 16.0;
    double zVMax = minV + (maxV - minV) * (zMax + 8.0) / 16.0;

    xMin *= size;
    xMax *= size;
    
    yMin *= size;
    yMax *= size;
    
    zMin *= size;
    zMax *= size;

    buffer.pos(xMin, yMin, zMin).tex(zUMin, yVMax).normal(-1, 0, 0).endVertex();
    buffer.pos(xMin, yMin, zMax).tex(zUMax, yVMax).normal(-1, 0, 0).endVertex();
    buffer.pos(xMin, yMax, zMax).tex(zUMax, yVMin).normal(-1, 0, 0).endVertex();
    buffer.pos(xMin, yMax, zMin).tex(zUMin, yVMin).normal(-1, 0, 0).endVertex();

    buffer.pos(xMax, yMin, zMin).tex(zUMax, yVMax).normal(1, 0, 0).endVertex();
    buffer.pos(xMax, yMax, zMin).tex(zUMax, yVMin).normal(1, 0, 0).endVertex();
    buffer.pos(xMax, yMax, zMax).tex(zUMin, yVMin).normal(1, 0, 0).endVertex();
    buffer.pos(xMax, yMin, zMax).tex(zUMin, yVMax).normal(1, 0, 0).endVertex();
    
    buffer.pos(xMin, yMin, zMin).tex(xUMin, zVMax).normal(0, -1, 0).endVertex();
    buffer.pos(xMax, yMin, zMin).tex(xUMax, zVMax).normal(0, -1, 0).endVertex();
    buffer.pos(xMax, yMin, zMax).tex(xUMax, zVMin).normal(0, -1, 0).endVertex();
    buffer.pos(xMin, yMin, zMax).tex(xUMin, zVMin).normal(0, -1, 0).endVertex();

    buffer.pos(xMin, yMax, zMin).tex(xUMin, zVMin).normal(0, 1, 0).endVertex();
    buffer.pos(xMin, yMax, zMax).tex(xUMin, zVMax).normal(0, 1, 0).endVertex();
    buffer.pos(xMax, yMax, zMax).tex(xUMax, zVMax).normal(0, 1, 0).endVertex();
    buffer.pos(xMax, yMax, zMin).tex(xUMax, zVMin).normal(0, 1, 0).endVertex();

    buffer.pos(xMin, yMin, zMin).tex(xUMax, yVMax).normal(0, 0, -1).endVertex();
    buffer.pos(xMin, yMax, zMin).tex(xUMax, yVMin).normal(0, 0, -1).endVertex();
    buffer.pos(xMax, yMax, zMin).tex(xUMin, yVMin).normal(0, 0, -1).endVertex();
    buffer.pos(xMax, yMin, zMin).tex(xUMin, yVMax).normal(0, 0, -1).endVertex();
    
    buffer.pos(xMin, yMin, zMax).tex(xUMin, yVMax).normal(0, 0, 1).endVertex();
    buffer.pos(xMax, yMin, zMax).tex(xUMax, yVMax).normal(0, 0, 1).endVertex();
    buffer.pos(xMax, yMax, zMax).tex(xUMax, yVMin).normal(0, 0, 1).endVertex();
    buffer.pos(xMin, yMax, zMax).tex(xUMin, yVMin).normal(0, 0, 1).endVertex();
}
 
Example #26
Source File: RenderCrucible.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileCrucible te, double x, double y, double z,
		float partialTicks, int destroyStage) 
{
	Tessellator tes = Tessellator.getInstance();
	VertexBuffer wr = tes.getBuffer();

	RenderHelper.disableStandardItemLighting();
	GlStateManager.pushMatrix();
	GlStateManager.translate(x, y, z);
	SpriteColor sprite = te.getSpriteAndColor();
	if (sprite != null)
	{
		TextureAtlasSprite icon = sprite.getSprite();
		double minU = (double) icon.getMinU();
		double maxU = (double) icon.getMaxU();
		double minV = (double) icon.getMinV();
		double maxV = (double) icon.getMaxV();
		
		// determine the tint for the fluid/block
		Color color = sprite.getColor();

		this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

		wr.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR_NORMAL);
		//wr.begin(GL11.GL_QUADS, new VertexFormat().addElement(DefaultVertexFormats.POSITION_3F).addElement(DefaultVertexFormats.COLOR_4UB).addElement(DefaultVertexFormats.NORMAL_3B));
		// Offset by bottome of crucible, which is 4 pixels above the base of the block
		float fillAmount = (12F / 16F) * te.getFilledAmount() + (4F / 16F);
		
		wr.pos(0.125F, fillAmount, 0.125F).tex(minU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.125F, fillAmount, 0.875F).tex(minU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.875F, fillAmount, 0.875F).tex(maxU, maxV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();
		wr.pos(0.875F, fillAmount, 0.125F).tex(maxU, minV).color(color.r, color.g, color.b, color.a).normal(0, 1, 0).endVertex();

		tes.draw();
	}

	GlStateManager.disableBlend();
	GlStateManager.enableLighting();
	GlStateManager.popMatrix();
	RenderHelper.enableStandardItemLighting();

}
 
Example #27
Source File: RenderInfestedLeaves.java    From ExNihiloAdscensio with MIT License 4 votes vote down vote up
@Override
public void renderTileEntityAt(TileInfestedLeaves tile, double x, double y, double z, float partialTicks, int destroyStage)
{
    if(tile != null)
    {
        long seed = tile.getWorld().rand.nextLong();
        int color = tile.getColor();
        
        IBlockState leafBlock = tile.getLeafBlock();
        IBakedModel leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(leafBlock);
        
        if(leafModel == null)
        {
            leafModel = Minecraft.getMinecraft().getBlockRendererDispatcher().getModelForState(Blocks.LEAVES.getDefaultState());
        }
        
        List<BakedQuad> leafQuads = Lists.newArrayList();
        
        for(EnumFacing side : EnumFacing.VALUES)
        {
            if(leafBlock.shouldSideBeRendered(tile.getWorld(), tile.getPos(), side))
            {
                leafQuads.addAll(leafModel.getQuads(leafBlock, side, seed));
            }
        }
        
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer buffer = tessellator.getBuffer();
        
        bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        
        GlStateManager.pushMatrix();
        GlStateManager.translate(x, y, z);
        RenderHelper.disableStandardItemLighting();
        
        buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.ITEM);
        
        for(BakedQuad quad : leafQuads)
        {
            LightUtil.renderQuadColor(buffer, quad, color);
        }
        
        tessellator.draw();
        
        RenderHelper.enableStandardItemLighting();
        GlStateManager.popMatrix();
    }
}
 
Example #28
Source File: ParticleRenderer.java    From Logistics-Pipes-2 with MIT License 4 votes vote down vote up
public void renderParticles(EntityPlayer aPlayer, float pTicks) {
	float f = ActiveRenderInfo.getRotationX();
       float f1 = ActiveRenderInfo.getRotationZ();
       float f2 = ActiveRenderInfo.getRotationYZ();
       float f3 = ActiveRenderInfo.getRotationXY();
       float f4 = ActiveRenderInfo.getRotationXZ();
       EntityPlayer player = Minecraft.getMinecraft().player;
       if(player!=null) {
       	Particle.interpPosX = player.lastTickPosX + (player.posX - player.lastTickPosX) * pTicks;
        Particle.interpPosY = player.lastTickPosY + (player.posY - player.lastTickPosY) * pTicks;
        Particle.interpPosZ = player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * pTicks;
        Particle.cameraViewDir = player.getLook(pTicks);
        GlStateManager.enableAlpha();
        GlStateManager.enableBlend();
        GlStateManager.alphaFunc(516, 0.003921569F);
           GlStateManager.disableCull();
           
           GlStateManager.depthMask(false);
           
           Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
		Tessellator tess = Tessellator.getInstance();
		VertexBuffer buffer = tess.getBuffer();
		
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
			for(int i = 0; i < particles.size(); i ++) {
				if(!((ILP2Particle) particles.get(i)).isAdditive()) {
					particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3);
				}
			}
			tess.draw();
		
		GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE);
			buffer.begin(GL11.GL_QUADS, DefaultVertexFormats.PARTICLE_POSITION_TEX_COLOR_LMAP);
			for(int i = 0; i < particles.size(); i ++) {
				if(((ILP2Particle) particles.get(i)).isAdditive()) {
					particles.get(i).renderParticle(buffer, player, pTicks, f, f4, f1, f2, f3);
				}
			}
			tess.draw();
		
		GlStateManager.enableCull();
           GlStateManager.depthMask(true);
        GlStateManager.blendFunc(GlStateManager.SourceFactor.SRC_ALPHA, GlStateManager.DestFactor.ONE_MINUS_SRC_ALPHA);
        GlStateManager.disableBlend();
        GlStateManager.alphaFunc(516, 0.1F);
       }
}
 
Example #29
Source File: TextureHelper.java    From malmo with MIT License 4 votes vote down vote up
public void render(float partialTicks, WorldClient world, Minecraft mc)
{
    // Adapted from the End sky renderer - just fill with solid colour.
    GlStateManager.disableFog();
    GlStateManager.disableAlpha();
    GlStateManager.disableBlend();
    RenderHelper.disableStandardItemLighting();
    GlStateManager.depthMask(false);
    GlStateManager.disableTexture2D();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();

    for (int i = 0; i < 6; ++i)
    {
        GlStateManager.pushMatrix();

        if (i == 1)
        {
            GlStateManager.rotate(90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 2)
        {
            GlStateManager.rotate(-90.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 3)
        {
            GlStateManager.rotate(180.0F, 1.0F, 0.0F, 0.0F);
        }

        if (i == 4)
        {
            GlStateManager.rotate(90.0F, 0.0F, 0.0F, 1.0F);
        }

        if (i == 5)
        {
            GlStateManager.rotate(-90.0F, 0.0F, 0.0F, 1.0F);
        }

        vertexbuffer.begin(7, DefaultVertexFormats.POSITION_COLOR);
        vertexbuffer.pos(-100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(-100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(100.0D, -100.0D, 100.0D).color(this.r, this.g, this.b, 255).endVertex();
        vertexbuffer.pos(100.0D, -100.0D, -100.0D).color(this.r, this.g, this.b, 255).endVertex();
        tessellator.draw();
        GlStateManager.popMatrix();
    }

    GlStateManager.depthMask(true);
    GlStateManager.enableTexture2D();
    GlStateManager.enableAlpha();
}
 
Example #30
Source File: Vertex.java    From TFC2 with GNU General Public License v3.0 votes vote down vote up
public abstract void addVertex(VertexBuffer buffer);