Search in sources :

Example 56 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityCannonBallRenderer method doRender.

@Override
public void doRender(EntityCannonBall entity, double x, double y, double z, float entityYaw, float partialTicks) {
    IBlockState iblockstate = ValkyrienWarfareCombatMod.instance.fakecannonblock.getStateFromMeta(2);
    double renderX = (entity.posX - entity.lastTickPosX) * partialTicks + entity.lastTickPosX;
    double renderY = (entity.posY - entity.lastTickPosY) * partialTicks + entity.lastTickPosY;
    double renderZ = (entity.posZ - entity.lastTickPosZ) * partialTicks + entity.lastTickPosZ;
    if (iblockstate.getRenderType() == EnumBlockRenderType.MODEL) {
        World world = entity.worldObj;
        if (iblockstate != world.getBlockState(new BlockPos(entity)) && iblockstate.getRenderType() != EnumBlockRenderType.INVISIBLE) {
            this.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
            GlStateManager.pushMatrix();
            GlStateManager.disableLighting();
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();
            if (this.renderOutlines) {
                GlStateManager.enableColorMaterial();
                GlStateManager.enableOutlineMode(this.getTeamColor(entity));
            }
            vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
            // BlockPos blockpos = new BlockPos(renderX, renderY, renderZ);
            GlStateManager.translate((float) (x - renderX + .25D), (float) (y - renderY - .07D), (float) (z - renderZ + .778D));
            BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
            vertexbuffer.setTranslation(renderX - .5D, renderY, renderZ - .5D);
            blockrendererdispatcher.getBlockModelRenderer().renderModel(world, blockrendererdispatcher.getModelForState(iblockstate), iblockstate, BlockPos.ORIGIN, vertexbuffer, false, 0);
            tessellator.draw();
            vertexbuffer.setTranslation(0, 0, 0);
            if (this.renderOutlines) {
                GlStateManager.disableOutlineMode();
                GlStateManager.disableColorMaterial();
            }
            GlStateManager.enableLighting();
            GlStateManager.popMatrix();
            super.doRender(entity, x, y, z, entityYaw, partialTicks);
        }
    }
}
Also used : IBlockState(net.minecraft.block.state.IBlockState) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) BlockPos(net.minecraft.util.math.BlockPos) World(net.minecraft.world.World) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 57 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityCannonBasicRender method doRender.

@Override
public void doRender(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) {
    float paritalTickYaw = entity.prevRotationYaw + (entity.rotationYaw - entity.prevRotationYaw) * partialTicks;
    float paritalTickPitch = entity.prevRotationPitch + (entity.rotationPitch - entity.prevRotationPitch) * partialTicks;
    double renderYaw = -paritalTickYaw + 90f;
    double renderPitch = paritalTickPitch;
    bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    double oldX = vertexbuffer.xOffset;
    double oldY = vertexbuffer.yOffset;
    double oldZ = vertexbuffer.zOffset;
    GL11.glPushMatrix();
    GlStateManager.disableLighting();
    if (this.renderOutlines) {
        GlStateManager.enableColorMaterial();
        GlStateManager.enableOutlineMode(this.getTeamColor(entity));
    }
    // BlockPos blockpos = new BlockPos(entity.posX, entity.getEntityBoundingBox().maxY, entity.posZ);
    // GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
    vertexbuffer.setTranslation((float) (0 - entity.posX), (float) (0 - entity.posY), (float) (0 - entity.posZ));
    GL11.glTranslated(x, y, z);
    double offsetAngle = entity.getBaseAngleOffset();
    GL11.glRotated(offsetAngle, 0, 1D, 0);
    GL11.glPushMatrix();
    GL11.glTranslated(-.1D, 0, 0);
    renderBase(entity, x, y, z, entityYaw, partialTicks);
    GL11.glPopMatrix();
    GL11.glTranslated(.15D, .5D, 0);
    // GL11.glTranslated(.1D,0,0);
    GL11.glRotated(renderYaw - offsetAngle, 0, 1D, 0);
    GL11.glRotated(renderPitch, 0, 0, 1D);
    GL11.glTranslated(-.8D, 0, -0.25);
    GL11.glPushMatrix();
    renderHead(entity, x, y, z, entityYaw, partialTicks);
    GL11.glPopMatrix();
    if (this.renderOutlines) {
        GlStateManager.disableOutlineMode();
        GlStateManager.disableColorMaterial();
    }
    vertexbuffer.setTranslation(oldX, oldY, oldZ);
    GlStateManager.enableLighting();
    GL11.glPopMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Example 58 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class EntityCannonBasicRender method renderHead.

private void renderHead(EntityCannonBasic entity, double x, double y, double z, float entityYaw, float partialTicks) {
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer vertexbuffer = tessellator.getBuffer();
    vertexbuffer.begin(7, DefaultVertexFormats.BLOCK);
    BlockPos blockpos = new BlockPos(entity.posX, entity.posY, entity.posZ);
    // GlStateManager.translate((float)(x - (double)blockpos.getX() - 0.5D), (float)(y - (double)blockpos.getY()), (float)(z - (double)blockpos.getZ() - 0.5D));
    BlockRendererDispatcher blockrendererdispatcher = Minecraft.getMinecraft().getBlockRendererDispatcher();
    blockrendererdispatcher.getBlockModelRenderer().renderModel(entity.worldObj, blockrendererdispatcher.getModelForState(headState), headState, blockpos, vertexbuffer, false, 0);
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) BlockPos(net.minecraft.util.math.BlockPos) BlockRendererDispatcher(net.minecraft.client.renderer.BlockRendererDispatcher)

Example 59 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Valkyrien-Warfare-Revamped by ValkyrienWarfare.

the class HovercraftControllerGUI method drawBackground.

@Override
public void drawBackground(int tint) {
    GlStateManager.disableLighting();
    GlStateManager.disableFog();
    Tessellator tessellator = Tessellator.getInstance();
    VertexBuffer worldrenderer = tessellator.getBuffer();
    this.mc.getTextureManager().bindTexture(background);
    GlStateManager.color(1.0F, 1.0F, 1.0F, 1.0F);
    float f = 32.0F;
    worldrenderer.begin(7, DefaultVertexFormats.POSITION_TEX_COLOR);
    worldrenderer.pos(0.0D, (double) this.height, 0.0D).tex(0.0D, (double) ((float) this.height / 32.0F + (float) tint)).color(64, 64, 64, 255).endVertex();
    worldrenderer.pos((double) this.width, (double) this.height, 0.0D).tex((double) ((float) this.width / 32.0F), (double) ((float) this.height / 32.0F + (float) tint)).color(64, 64, 64, 255).endVertex();
    worldrenderer.pos((double) this.width, 0.0D, 0.0D).tex((double) ((float) this.width / 32.0F), (double) tint).color(64, 64, 64, 255).endVertex();
    worldrenderer.pos(0.0D, 0.0D, 0.0D).tex(0.0D, (double) tint).color(64, 64, 64, 255).endVertex();
    tessellator.draw();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Example 60 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Engine by VoltzEngine-Project.

the class Render2DHelper method drawRect.

/**
     * Draws a solid color rectangle with the specified coordinates and color. Args: x1, y1, x2, y2, color
     */
public static void drawRect(int p_73734_0_, int p_73734_1_, int p_73734_2_, int p_73734_3_, int p_73734_4_) {
    int j1;
    if (p_73734_0_ < p_73734_2_) {
        j1 = p_73734_0_;
        p_73734_0_ = p_73734_2_;
        p_73734_2_ = j1;
    }
    if (p_73734_1_ < p_73734_3_) {
        j1 = p_73734_1_;
        p_73734_1_ = p_73734_3_;
        p_73734_3_ = j1;
    }
    float f3 = (float) (p_73734_4_ >> 24 & 255) / 255.0F;
    float f = (float) (p_73734_4_ >> 16 & 255) / 255.0F;
    float f1 = (float) (p_73734_4_ >> 8 & 255) / 255.0F;
    float f2 = (float) (p_73734_4_ & 255) / 255.0F;
    Tessellator tessellator = Tessellator.instance;
    GL11.glEnable(GL11.GL_BLEND);
    GL11.glDisable(GL11.GL_TEXTURE_2D);
    OpenGlHelper.glBlendFunc(770, 771, 1, 0);
    GL11.glColor4f(f, f1, f2, f3);
    tessellator.startDrawingQuads();
    tessellator.addVertex((double) p_73734_0_, (double) p_73734_3_, 0.0D);
    tessellator.addVertex((double) p_73734_2_, (double) p_73734_3_, 0.0D);
    tessellator.addVertex((double) p_73734_2_, (double) p_73734_1_, 0.0D);
    tessellator.addVertex((double) p_73734_0_, (double) p_73734_1_, 0.0D);
    tessellator.draw();
    GL11.glEnable(GL11.GL_TEXTURE_2D);
    GL11.glDisable(GL11.GL_BLEND);
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Aggregations

Tessellator (net.minecraft.client.renderer.Tessellator)298 VertexBuffer (net.minecraft.client.renderer.VertexBuffer)50 BufferBuilder (net.minecraft.client.renderer.BufferBuilder)49 ResourceLocation (net.minecraft.util.ResourceLocation)15 Block (net.minecraft.block.Block)13 IIcon (net.minecraft.util.IIcon)13 BlockPos (net.minecraft.util.math.BlockPos)12 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)10 Vec3d (net.minecraft.util.math.Vec3d)9 WorldRenderer (net.minecraft.client.renderer.WorldRenderer)8 EnumFacing (net.minecraft.util.EnumFacing)8 Icon (net.minecraft.util.Icon)8 Random (java.util.Random)7 FontRenderer (net.minecraft.client.gui.FontRenderer)7 EntityPlayer (net.minecraft.entity.player.EntityPlayer)7 World (net.minecraft.world.World)7 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)6 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)6 SideOnly (cpw.mods.fml.relauncher.SideOnly)5 IBlockState (net.minecraft.block.state.IBlockState)5