Java Code Examples for net.minecraft.client.renderer.texture.TextureAtlasSprite#getMinU()

The following examples show how to use net.minecraft.client.renderer.texture.TextureAtlasSprite#getMinU() . 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: RenderUtil.java    From GregTech with GNU Lesser General Public License v3.0 6 votes vote down vote up
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite, int maskTop, int maskRight, double zLevel) {
    double uMin = textureSprite.getMinU();
    double uMax = textureSprite.getMaxU();
    double vMin = textureSprite.getMinV();
    double vMax = textureSprite.getMaxV();
    uMax = uMax - maskRight / 16.0 * (uMax - uMin);
    vMax = vMax - maskTop / 16.0 * (vMax - vMin);

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    buffer.begin(7, DefaultVertexFormats.POSITION_TEX);
    buffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
    buffer.pos(xCoord + 16 - maskRight, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
    buffer.pos(xCoord + 16 - maskRight, yCoord + maskTop, zLevel).tex(uMax, vMin).endVertex();
    buffer.pos(xCoord, yCoord + maskTop, zLevel).tex(uMin, vMin).endVertex();
    tessellator.draw();
}
 
Example 2
Source File: FluidStackRenderer.java    From YouTubeModdingTutorial with MIT License 6 votes vote down vote up
private static void drawFluidTexture(double xCoord, double yCoord, TextureAtlasSprite textureSprite) {
    double uMin = textureSprite.getMinU();
    double uMax = textureSprite.getMaxU();
    double vMin = textureSprite.getMinV();
    double vMax = textureSprite.getMaxV();
    double zLevel = 100;

    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder vertexBuffer = tessellator.getBuffer();
    vertexBuffer.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    vertexBuffer.pos(xCoord, yCoord + 16, zLevel).tex(uMin, vMax).endVertex();
    vertexBuffer.pos(xCoord + 16, yCoord + 16, zLevel).tex(uMax, vMax).endVertex();
    vertexBuffer.pos(xCoord + 16, yCoord, zLevel).tex(uMax, vMin).endVertex();
    vertexBuffer.pos(xCoord, yCoord, zLevel).tex(uMin, vMin).endVertex();
    tessellator.draw();
}
 
Example 3
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 4
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 5
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 5 votes vote down vote up
/**
 * Draws a tessellated quadrilateral bottom to top, left to right
 *
 * @param base The bottom left corner of the quad
 * @param wide The bottom of the quad
 * @param high The left side of the quad
 * @param res  Units per icon
 */
public static void renderFluidQuad(Vector3 base, Vector3 wide, Vector3 high, TextureAtlasSprite icon, double res) {
    WorldRenderer r = Tessellator.getInstance().getWorldRenderer();

    double u1 = icon.getMinU();
    double du = icon.getMaxU() - icon.getMinU();
    double v2 = icon.getMaxV();
    double dv = icon.getMaxV() - icon.getMinV();

    double wlen = wide.mag();
    double hlen = high.mag();

    double x = 0;
    while (x < wlen) {
        double rx = wlen - x;
        if (rx > res)
            rx = res;

        double y = 0;
        while (y < hlen) {
            double ry = hlen - y;
            if (ry > res)
                ry = res;

            Vector3 dx1 = vectors[2].set(wide).multiply(x / wlen);
            Vector3 dx2 = vectors[3].set(wide).multiply((x + rx) / wlen);
            Vector3 dy1 = vectors[4].set(high).multiply(y / hlen);
            Vector3 dy2 = vectors[5].set(high).multiply((y + ry) / hlen);

            r.pos(base.x + dx1.x + dy2.x, base.y + dx1.y + dy2.y, base.z + dx1.z + dy2.z).tex(u1, v2 - ry / res * dv).endVertex();
            r.pos(base.x + dx1.x + dy1.x, base.y + dx1.y + dy1.y, base.z + dx1.z + dy1.z).tex(u1, v2).endVertex();
            r.pos(base.x + dx2.x + dy1.x, base.y + dx2.y + dy1.y, base.z + dx2.z + dy1.z).tex(u1 + rx / res * du, v2).endVertex();
            r.pos(base.x + dx2.x + dy2.x, base.y + dx2.y + dy2.y, base.z + dx2.z + dy2.z).tex(u1 + rx / res * du, v2 - ry / res * dv).endVertex();

            y += ry;
        }

        x += rx;
    }
}
 
Example 6
Source File: GuiComponentTankLevel.java    From OpenModsLib with MIT License 5 votes vote down vote up
@Override
public void render(int offsetX, int offsetY, int mouseX, int mouseY) {
	bindComponentsSheet();
	BOX_RENDERER.render(this, x + offsetX, y + offsetY, width, height, BORDER_COLOR);

	if (fluidStack == null) return;
	final Fluid fluid = fluidStack.getFluid();
	if (fluid == null) return;

	parent.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);

	final ResourceLocation textureLocation = fluid.getStill(fluidStack);
	TextureAtlasSprite icon = parent.getIcon(textureLocation);

	if (icon != null) {
		double percentFull = Math.max(0, Math.min(1, (double)fluidStack.amount / (double)capacity));
		double fluidHeight = (height - 3) * percentFull;
		final int posX = offsetX + x;
		final int posY = offsetY + y;

		final float minU = icon.getMinU();
		final float maxU = icon.getMaxU();

		final float minV = icon.getMinV();
		final float maxV = icon.getMaxV();

		GL11.glBegin(GL11.GL_QUADS);
		addVertexWithUV(posX + 3, posY + height - 3, this.zLevel, minU, maxV);
		addVertexWithUV(posX + width - 3, posY + height - 3, this.zLevel, maxU, maxV);
		addVertexWithUV(posX + width - 3, posY + (height - fluidHeight), this.zLevel, maxU, minV);
		addVertexWithUV(posX + 3, posY + (height - fluidHeight), this.zLevel, minU, minV);
		GL11.glEnd();
	}
}
 
Example 7
Source File: RenderHelper.java    From customstuff4 with GNU General Public License v3.0 4 votes vote down vote up
public static void renderGuiFluid(FluidStack fluid, float fill, int x, int y, int width, int maxHeight)
{
    if (fluid != null && fluid.getFluid() != null && fluid.amount > 0)
    {
        TextureAtlasSprite sprite = getStillTexture(fluid);
        if (sprite != null)
        {
            int rendHeight = (int) Math.max(Math.min((float) maxHeight, (float) maxHeight * fill), 1.0F);
            int yPos = y + maxHeight - rendHeight;
            Minecraft.getMinecraft().renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            int fluidColor = fluid.getFluid().getColor(fluid);
            GL11.glColor3ub((byte) (fluidColor >> 16 & 255), (byte) (fluidColor >> 8 & 255), (byte) (fluidColor & 255));
            GlStateManager.enableBlend();

            for (int i = 0; i < width; i += 16)
            {
                for (int j = 0; j < rendHeight; j += 16)
                {
                    int dwt = Math.min(width - i, 16);
                    int dht = Math.min(rendHeight - j, 16);
                    int dx = x + i;
                    int dy = yPos + j;
                    double minU = (double) sprite.getMinU();
                    double maxU = (double) sprite.getMaxU();
                    double minV = (double) sprite.getMinV();
                    double maxV = (double) sprite.getMaxV();
                    Tessellator tessellator = Tessellator.getInstance();
                    BufferBuilder tes = tessellator.getBuffer();
                    tes.begin(7, DefaultVertexFormats.POSITION_TEX);
                    tes.pos((double) dx, (double) (dy + dht), 0.0D).tex(minU, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
                    tes.pos((double) (dx + dwt), (double) (dy + dht), 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV + (maxV - minV) * (double) dht / 16.0D).endVertex();
                    tes.pos((double) (dx + dwt), (double) dy, 0.0D).tex(minU + (maxU - minU) * (double) dwt / 16.0D, minV).endVertex();
                    tes.pos((double) dx, (double) dy, 0.0D).tex(minU, minV).endVertex();
                    tessellator.draw();
                }
            }

            GlStateManager.disableBlend();
        }
    }
}
 
Example 8
Source File: RenderUtils.java    From CodeChickenLib with GNU Lesser General Public License v2.1 4 votes vote down vote up
public static void makeFluidQuadVertices(List<Vertex5> vertices, Vector3 base, Vector3 wide, Vector3 high, TextureAtlasSprite icon, double res) {
    Vector3 a = new Vector3();
    Vector3 b = new Vector3();
    Vector3 c = new Vector3();
    Vector3 d = new Vector3();

    double u1 = icon.getMinU();
    double du = icon.getMaxU() - icon.getMinU();
    double v2 = icon.getMaxV();
    double dv = icon.getMaxV() - icon.getMinV();

    double wlen = wide.mag();
    double hlen = high.mag();

    double x = 0;
    while (x < wlen) {
        double rx = wlen - x;
        if (rx > res) {
            rx = res;
        }

        double y = 0;
        while (y < hlen) {
            double ry = hlen - y;
            if (ry > res) {
                ry = res;
            }

            Vector3 dx1 = a.set(wide).multiply(x / wlen);
            Vector3 dx2 = b.set(wide).multiply((x + rx) / wlen);
            Vector3 dy1 = c.set(high).multiply(y / hlen);
            Vector3 dy2 = d.set(high).multiply((y + ry) / hlen);

            vertices.add(new Vertex5(base.x + dx1.x + dy2.x, base.y + dx1.y + dy2.y, base.z + dx1.z + dy2.z, u1, v2 - ry / res * dv));
            vertices.add(new Vertex5(base.x + dx1.x + dy1.x, base.y + dx1.y + dy1.y, base.z + dx1.z + dy1.z, u1, v2));
            vertices.add(new Vertex5(base.x + dx2.x + dy1.x, base.y + dx2.y + dy1.y, base.z + dx2.z + dy1.z, (u1 + rx / res * du), v2));
            vertices.add(new Vertex5(base.x + dx2.x + dy2.x, base.y + dx2.y + dy2.y, base.z + dx2.z + dy2.z, (u1 + rx / res * du), v2 - ry / res * dv));

            y += ry;
        }

        x += rx;
    }
}
 
Example 9
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 10
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 11
Source File: BWBakedModel.java    From NOVA-Core with GNU Lesser General Public License v3.0 4 votes vote down vote up
private double deinterpolateU(double u, Optional<TextureAtlasSprite> texture) {
	if (!texture.isPresent())
		return u;
	TextureAtlasSprite tex = texture.get();
	return (u - tex.getMinU()) / (tex.getMaxU() - tex.getMinU());
}
 
Example 12
Source File: RenderTank.java    From AdvancedRocketry with MIT License 4 votes vote down vote up
@Override
public void render(TileEntity tile, double x,
		double y, double z, float f, int damage, float a) {

	IFluidHandler fluidTile = (IFluidHandler)tile;
	FluidStack fluid = fluidTile.getTankProperties()[0].getContents();
	ResourceLocation fluidIcon = new ResourceLocation("advancedrocketry:textures/blocks/fluid/oxygen_flow.png");

	if(fluid != null && fluid.getFluid() != null)
	{
		GL11.glPushMatrix();

		GL11.glTranslatef((float)x, (float)y, (float)z);

		double minU = 0, maxU = 1, minV = 0, maxV = 1;
		TextureMap map = Minecraft.getMinecraft().getTextureMapBlocks();
		TextureAtlasSprite sprite = map.getTextureExtry(fluid.getFluid().getStill().toString());
		if(sprite != null) {
			minU = sprite.getMinU();
			maxU = sprite.getMaxU();
			minV = sprite.getMinV();
			maxV = sprite.getMaxV();
			GlStateManager.bindTexture(map.getGlTextureId());
		}
		else {
			int color = fluid.getFluid().getColor();
			GL11.glColor4f(((color >>> 16) & 0xFF)/255f, ((color >>> 8) & 0xFF)/255f, ((color& 0xFF)/255f),1f);
			
			bindTexture(fluidIcon);
		}
		

		
		Block block = tile.getBlockType();
		Tessellator tess = Tessellator.getInstance();

		float amt = fluid.amount / (float)fluidTile.getTankProperties()[0].getCapacity();
		
		GL11.glEnable(GL11.GL_BLEND);
		GL11.glDisable(GL11.GL_LIGHTING);
		
		GL11.glBlendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
		
		AxisAlignedBB bb = block.getDefaultState().getBoundingBox(tile.getWorld(), tile.getPos());
		
		tess.getBuffer().begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		RenderHelper.renderCubeWithUV(tess.getBuffer(), bb.minX + 0.01, bb.minY + 0.01, bb.minZ + 0.01, bb.maxX - 0.01, bb.maxY*amt - 0.01, bb.maxZ - 0.01, minU, maxU, minV, maxV);
		tess.draw();

		GL11.glEnable(GL11.GL_LIGHTING);
		GL11.glDisable(GL11.GL_BLEND);
		GL11.glPopMatrix();
		GL11.glColor3f(1f, 1f, 1f);
	}
}
 
Example 13
Source File: TESRBTank.java    From BetterChests with GNU Lesser General Public License v3.0 4 votes vote down vote up
@Override
public void render(TileEntityBTank te, double x, double y, double z, float partialTicks, int destroyStage, float alpha) {
	FluidTank tank = te.getTank();
	FluidStack stack = tank.getFluid();
	if (stack != null) {

		float fillPercentage = ((float)stack.amount) / tank.getCapacity();
		boolean gaseous = stack.getFluid().isGaseous(stack);
		GlStateManager.pushMatrix();
		GL11.glEnable(GL11.GL_BLEND);

		ResourceLocation loc = stack.getFluid().getStill(stack);
		TextureAtlasSprite sprite = RenderHelper.getAtlasSprite(loc);
		RenderHelper.bindBlockTexture();

		float minY = !gaseous ? 0 : 1 - fillPercentage;
		float maxY = gaseous ? 1 : fillPercentage;

		float minU = sprite.getMinU();
		float maxU = sprite.getMaxU();
		float minV = sprite.getMinV();
		float maxV = sprite.getMaxV();
		float minVHorizontal = minV + (maxV - minV) * minY;
		float maxVHorizontal = minV + (maxV - minV) * maxY;

		GlStateManager.translate(x, y, z);

		GlStateManager.translate(0.5, 0.5, 0.5);
		GlStateManager.scale(12/16D, 12/16D, 12/16D);
		GlStateManager.translate(-0.5, -0.5, -0.5);

		Tessellator tessellator = Tessellator.getInstance();
		BufferBuilder builder = tessellator.getBuffer();

		//south
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(0, minY, 1).tex(minU, minVHorizontal).endVertex();
		builder.pos(1, minY, 1).tex(maxU, minVHorizontal).endVertex();
		builder.pos(1, maxY, 1).tex(maxU, maxVHorizontal).endVertex();
		builder.pos(0, maxY, 1).tex(minU, maxVHorizontal).endVertex();
		tessellator.draw();

		//north
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(1, minY, 0).tex(minU, minVHorizontal).endVertex();
		builder.pos(0, minY, 0).tex(maxU, minVHorizontal).endVertex();
		builder.pos(0, maxY, 0).tex(maxU, maxVHorizontal).endVertex();
		builder.pos(1, maxY, 0).tex(minU, maxVHorizontal).endVertex();
		tessellator.draw();

		//east
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(1, minY, 1).tex(minU, minVHorizontal).endVertex();
		builder.pos(1, minY, 0).tex(maxU, minVHorizontal).endVertex();
		builder.pos(1, maxY, 0).tex(maxU, maxVHorizontal).endVertex();
		builder.pos(1, maxY, 1).tex(minU, maxVHorizontal).endVertex();
		tessellator.draw();

		//west
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(0, minY, 0).tex(minU, minVHorizontal).endVertex();
		builder.pos(0, minY, 1).tex(maxU, minVHorizontal).endVertex();
		builder.pos(0, maxY, 1).tex(maxU, maxVHorizontal).endVertex();
		builder.pos(0, maxY, 0).tex(minU, maxVHorizontal).endVertex();
		tessellator.draw();

		//up
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(1, maxY, 0).tex(minU, minV).endVertex();
		builder.pos(0, maxY, 0).tex(maxU, minV).endVertex();
		builder.pos(0, maxY, 1).tex(maxU, maxV).endVertex();
		builder.pos(1, maxY, 1).tex(minU, maxV).endVertex();
		tessellator.draw();

		//down
		builder.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
		builder.pos(0, minY, 0).tex(minU, minV).endVertex();
		builder.pos(1, minY, 0).tex(maxU, minV).endVertex();
		builder.pos(1, minY, 1).tex(maxU, maxV).endVertex();
		builder.pos(0, minY, 1).tex(minU, maxV).endVertex();
		tessellator.draw();

		GL11.glDisable(GL11.GL_BLEND);
		GlStateManager.popMatrix();
	}
}
 
Example 14
Source File: GuiComponentSprite.java    From OpenModsLib with MIT License 4 votes vote down vote up
public static Icon adaptSprite(TextureAtlasSprite icon) {
	return new Icon(TextureMap.LOCATION_BLOCKS_TEXTURE, icon.getMinU(), icon.getMaxU(), icon.getMinV(), icon.getMaxV(), icon.getIconWidth(), icon.getIconHeight());
}