Search in sources :

Example 61 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Bewitchment by Um-Mitternacht.

the class GirdleOfTheWoodedHUD method renderTexture.

private static void renderTexture(double x, double y, double width, double height, double vMin, double vMax) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buff = tessellator.getBuffer();
    buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    buff.pos(x, y + height, 0).tex(0, vMax).endVertex();
    buff.pos(x + width, y + height, 0).tex(1, vMax).endVertex();
    buff.pos(x + width, y, 0).tex(1, vMin).endVertex();
    buff.pos(x, y, 0).tex(0, vMin).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 62 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Bewitchment by Um-Mitternacht.

the class VampireBloodBarHUD method renderTextureAtTile.

private static void renderTextureAtTile(double x, double y, int filled, int available, double lasth, double lasta) {
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buff = tessellator.getBuffer();
    for (int i = 0; i < filled; i++) {
        buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buff.pos(x + i * 8, y + 9, 0).tex(0, 0.5).endVertex();
        buff.pos(x + (i * 8) + 7, y + 9, 0).tex(1, 0.5).endVertex();
        buff.pos(x + (i * 8) + 7, y, 0).tex(1, 0).endVertex();
        buff.pos(x + i * 8, y, 0).tex(0, 0).endVertex();
        tessellator.draw();
    }
    for (int i = filled; i < available; i++) {
        buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buff.pos(x + i * 8, y + 9, 0).tex(0, 1).endVertex();
        buff.pos(x + (i * 8) + 7, y + 9, 0).tex(1, 1).endVertex();
        buff.pos(x + (i * 8) + 7, y, 0).tex(1, 0.5).endVertex();
        buff.pos(x + i * 8, y, 0).tex(0, 0.5).endVertex();
        tessellator.draw();
    }
    if (lasta > 0) {
        buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buff.pos(x + filled * 8, y + 9, 0).tex(0, 1).endVertex();
        buff.pos(x + (filled * 8) + (7 * lasta), y + 9, 0).tex(lasta, 1).endVertex();
        buff.pos(x + (filled * 8) + (7 * lasta), y, 0).tex(lasta, 0.5).endVertex();
        buff.pos(x + filled * 8, y, 0).tex(0, 0.5).endVertex();
        tessellator.draw();
    }
    if (lasth > 0) {
        buff.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
        buff.pos(x + filled * 8, y + 9, 0).tex(0, 0.5).endVertex();
        buff.pos(x + (filled * 8) + (7 * lasth), y + 9, 0).tex(lasth, 0.5).endVertex();
        buff.pos(x + (filled * 8) + (7 * lasth), y, 0).tex(lasth, 0).endVertex();
        buff.pos(x + filled * 8, y, 0).tex(0, 0).endVertex();
        tessellator.draw();
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Example 63 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Fracture by HellFirePvP.

the class EffectLightning method renderFast.

public static void renderFast(float pTicks, java.util.List<EffectLightning> toBeRendered) {
    GlStateManager.pushMatrix();
    RenderingUtils.removeStandartTranslationFromTESRMatrix(pTicks);
    GlStateManager.color(1F, 1F, 1F, 1F);
    GlStateManager.enableBlend();
    GlStateManager.disableCull();
    GlStateManager.disableAlpha();
    Blending.ADDITIVE_ALPHA.applyStateManager();
    connection.bind();
    Tessellator tes = Tessellator.getInstance();
    BufferBuilder buf = tes.getBuffer();
    buf.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
    for (EffectLightning fl : new ArrayList<>(toBeRendered)) {
        fl.renderF(pTicks, buf);
    }
    buf.sortVertexData((float) TileEntityRendererDispatcher.staticPlayerX, (float) TileEntityRendererDispatcher.staticPlayerY, (float) TileEntityRendererDispatcher.staticPlayerZ);
    tes.draw();
    TextureHelper.refreshTextureBindState();
    Blending.DEFAULT.applyStateManager();
    GlStateManager.disableBlend();
    GlStateManager.enableAlpha();
    GlStateManager.color(1F, 1F, 1F, 1F);
    GlStateManager.enableCull();
    GlStateManager.popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ArrayList(java.util.ArrayList)

Example 64 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Fracture by HellFirePvP.

the class EntityFXFacingParticle method renderBatched.

public static void renderBatched(float parTicks, Collection<EntityFXFacingParticle> particles) {
    GlStateManager.disableAlpha();
    GlStateManager.enableBlend();
    Blending.DEFAULT.apply();
    Blending.DEFAULT.applyStateManager();
    GlStateManager.disableCull();
    GlStateManager.depthMask(false);
    staticFlareTex.bind();
    Tessellator t = Tessellator.getInstance();
    BufferBuilder vb = t.getBuffer();
    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX_COLOR);
    for (EntityFXFacingParticle particle : new ArrayList<>(particles)) {
        if (particle == null)
            continue;
        particle.renderBatched(parTicks, vb);
    }
    t.draw();
    GlStateManager.enableAlpha();
    GlStateManager.disableBlend();
    GlStateManager.depthMask(true);
    GlStateManager.enableCull();
    TextureHelper.refreshTextureBindState();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder) ArrayList(java.util.ArrayList)

Example 65 with BufferBuilder

use of net.minecraft.client.renderer.BufferBuilder in project Fracture by HellFirePvP.

the class RenderingUtils method renderTexturedCubeCentral.

public static void renderTexturedCubeCentral(Vector3 offset, double size, double u, double v, double uLength, double vLength) {
    Tessellator tes = Tessellator.getInstance();
    BufferBuilder vb = tes.getBuffer();
    double half = size / 2D;
    vb.begin(GL11.GL_QUADS, DefaultVertexFormats.POSITION_TEX);
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() - half).tex(u, v).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() - half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() - half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() - half).tex(u + uLength, v).endVertex();
    vb.pos(offset.getX() - half, offset.getY() - half, offset.getZ() + half).tex(u, v).endVertex();
    vb.pos(offset.getX() - half, offset.getY() + half, offset.getZ() + half).tex(u, v + vLength).endVertex();
    vb.pos(offset.getX() + half, offset.getY() + half, offset.getZ() + half).tex(u + uLength, v + vLength).endVertex();
    vb.pos(offset.getX() + half, offset.getY() - half, offset.getZ() + half).tex(u + uLength, v).endVertex();
    tes.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) BufferBuilder(net.minecraft.client.renderer.BufferBuilder)

Aggregations

BufferBuilder (net.minecraft.client.renderer.BufferBuilder)319 Tessellator (net.minecraft.client.renderer.Tessellator)251 BlockPos (net.minecraft.util.math.BlockPos)35 Vec3d (net.minecraft.util.math.Vec3d)27 ResourceLocation (net.minecraft.util.ResourceLocation)25 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)23 IBlockState (net.minecraft.block.state.IBlockState)21 EnumFacing (net.minecraft.util.EnumFacing)21 Minecraft (net.minecraft.client.Minecraft)14 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)14 EntityPlayer (net.minecraft.entity.player.EntityPlayer)11 ItemStack (net.minecraft.item.ItemStack)11 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)11 ArrayList (java.util.ArrayList)10 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)10 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)9 AxisAlignedBB (net.minecraft.util.math.AxisAlignedBB)9 World (net.minecraft.world.World)8 Random (java.util.Random)7 FontRenderer (net.minecraft.client.gui.FontRenderer)7