Search in sources :

Example 1 with VertexBuffer

use of net.minecraft.client.renderer.VertexBuffer in project MinecraftForge by MinecraftForge.

the class LightUtil method getTessellator.

public static IVertexConsumer getTessellator() {
    if (tessellator == null) {
        Tessellator tes = Tessellator.getInstance();
        VertexBuffer wr = tes.getBuffer();
        tessellator = new VertexBufferConsumer(wr);
    }
    return tessellator;
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer)

Example 2 with VertexBuffer

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

the class EventsClient method onDrawBlockHighlightEventFirst.

@SubscribeEvent(priority = EventPriority.HIGHEST, receiveCanceled = true)
public void onDrawBlockHighlightEventFirst(DrawBlockHighlightEvent event) {
    BlockPos pos = Minecraft.getMinecraft().objectMouseOver.getBlockPos();
    if (pos != null) {
        PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(Minecraft.getMinecraft().theWorld, pos);
        if (wrapper != null && wrapper.wrapping != null && wrapper.wrapping.renderer != null && wrapper.wrapping.centerCoord != null) {
            //				GL11.glPushMatrix();
            float partialTicks = event.getPartialTicks();
            Entity player = Minecraft.getMinecraft().thePlayer;
            wrapper.wrapping.renderer.setupTranslation(partialTicks);
            Tessellator tessellator = Tessellator.getInstance();
            VertexBuffer vertexbuffer = tessellator.getBuffer();
            double xOff = (player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getX();
            double yOff = (player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getY();
            double zOff = (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getZ();
            vertexbuffer.xOffset += xOff;
            vertexbuffer.yOffset += yOff;
            vertexbuffer.zOffset += zOff;
        }
    }
}
Also used : Entity(net.minecraft.entity.Entity) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity) BlockPos(net.minecraft.util.math.BlockPos) SubscribeEvent(net.minecraftforge.fml.common.eventhandler.SubscribeEvent)

Example 3 with VertexBuffer

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

the class CallRunnerClient method onDrawSelectionBox.

public static void onDrawSelectionBox(RenderGlobal renderGlobal, EntityPlayer player, RayTraceResult movingObjectPositionIn, int execute, float partialTicks) {
    PhysicsWrapperEntity wrapper = ValkyrienWarfareMod.physicsManager.getObjectManagingPos(player.worldObj, movingObjectPositionIn.getBlockPos());
    if (wrapper != null && wrapper.wrapping != null && wrapper.wrapping.renderer != null && wrapper.wrapping.renderer.offsetPos != null) {
        ;
        wrapper.wrapping.renderer.setupTranslation(partialTicks);
        Tessellator tessellator = Tessellator.getInstance();
        VertexBuffer vertexbuffer = tessellator.getBuffer();
        double xOff = (player.lastTickPosX + (player.posX - player.lastTickPosX) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getX();
        double yOff = (player.lastTickPosY + (player.posY - player.lastTickPosY) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getY();
        double zOff = (player.lastTickPosZ + (player.posZ - player.lastTickPosZ) * (double) partialTicks) - wrapper.wrapping.renderer.offsetPos.getZ();
        vertexbuffer.xOffset += xOff;
        vertexbuffer.yOffset += yOff;
        vertexbuffer.zOffset += zOff;
        renderGlobal.drawSelectionBox(player, movingObjectPositionIn, execute, partialTicks);
        vertexbuffer.xOffset -= xOff;
        vertexbuffer.yOffset -= yOff;
        vertexbuffer.zOffset -= zOff;
        wrapper.wrapping.renderer.inverseTransform(partialTicks);
    } else {
        renderGlobal.drawSelectionBox(player, movingObjectPositionIn, execute, partialTicks);
    }
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator) VertexBuffer(net.minecraft.client.renderer.VertexBuffer) PhysicsWrapperEntity(ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)

Example 4 with VertexBuffer

use of net.minecraft.client.renderer.VertexBuffer 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 5 with VertexBuffer

use of net.minecraft.client.renderer.VertexBuffer 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)

Aggregations

VertexBuffer (net.minecraft.client.renderer.VertexBuffer)38 Tessellator (net.minecraft.client.renderer.Tessellator)36 BlockPos (net.minecraft.util.math.BlockPos)8 BakedQuad (net.minecraft.client.renderer.block.model.BakedQuad)4 EnumFacing (net.minecraft.util.EnumFacing)4 PhysicsWrapperEntity (ValkyrienWarfareBase.PhysicsManagement.PhysicsWrapperEntity)3 BlockRendererDispatcher (net.minecraft.client.renderer.BlockRendererDispatcher)3 TextureAtlasSprite (net.minecraft.client.renderer.texture.TextureAtlasSprite)3 Vec3i (net.minecraft.util.math.Vec3i)3 SubscribeEvent (net.minecraftforge.fml.common.eventhandler.SubscribeEvent)3 SideOnly (net.minecraftforge.fml.relauncher.SideOnly)3 Entity (net.minecraft.entity.Entity)2 IImmersiveConnectable (blusunrize.immersiveengineering.api.energy.wires.IImmersiveConnectable)1 Connection (blusunrize.immersiveengineering.api.energy.wires.ImmersiveNetHandler.Connection)1 EnumGlyphType (mdc.voodoocraft.util.EnumGlyphType)1 IBlockState (net.minecraft.block.state.IBlockState)1 Minecraft (net.minecraft.client.Minecraft)1 ScaledResolution (net.minecraft.client.gui.ScaledResolution)1 IBakedModel (net.minecraft.client.renderer.block.model.IBakedModel)1 EntityPlayer (net.minecraft.entity.player.EntityPlayer)1