Search in sources :

Example 51 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Guide-API by TeamAmeriFrance.

the class GuiBase method drawTexturedModalRectWithColor.

public void drawTexturedModalRectWithColor(int x, int y, int textureX, int textureY, int width, int height, Color color) {
    pushMatrix();
    enableBlend();
    blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    float f = 0.00390625F;
    float f1 = 0.00390625F;
    disableLighting();
    color((float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F);
    Tessellator tessellator = Tessellator.getInstance();
    tessellator.getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
    tessellator.getBuffer().pos((double) (x), (double) (y + height), (double) this.zLevel).tex((double) ((float) (textureX) * f), (double) ((float) (textureY + height) * f1)).endVertex();
    tessellator.getBuffer().pos((double) (x + width), (double) (y + height), (double) this.zLevel).tex((double) ((float) (textureX + width) * f), (double) ((float) (textureY + height) * f1)).endVertex();
    tessellator.getBuffer().pos((double) (x + width), (double) (y), (double) this.zLevel).tex((double) ((float) (textureX + width) * f), (double) ((float) (textureY) * f1)).endVertex();
    tessellator.getBuffer().pos((double) (x), (double) (y), (double) this.zLevel).tex((double) ((float) (textureX) * f), (double) ((float) (textureY) * f1)).endVertex();
    tessellator.draw();
    disableBlend();
    popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 52 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Guide-API by TeamAmeriFrance.

the class GuiHelper method drawSizedIconWithColor.

/**
     * @param x      - The position on the x-axis to draw the icon
     * @param y      - The position on the y-axis to draw the icon
     * @param width  - The width of the icon
     * @param height - The height of the icon
     * @param color  - The color the icon will have
     */
public static void drawSizedIconWithColor(int x, int y, int width, int height, float zLevel, Color color) {
    pushMatrix();
    enableBlend();
    blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    scale(0.5D, 0.5D, 0.5D);
    color((float) color.getRed() / 255F, (float) color.getGreen() / 255F, (float) color.getBlue() / 255F, (float) color.getAlpha() / 255F);
    translate(x, y, zLevel);
    RenderHelper.enableGUIStandardItemLighting();
    disableLighting();
    enableRescaleNormal();
    enableDepth();
    Tessellator tessellator = Tessellator.getInstance();
    tessellator.getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
    tessellator.getBuffer().pos(x, y + height, zLevel).tex(0D, 1D).endVertex();
    tessellator.getBuffer().pos(x + width, y + height, zLevel).tex(1D, 1D).endVertex();
    tessellator.getBuffer().pos(x + width, y, zLevel).tex(1D, 0D).endVertex();
    tessellator.getBuffer().pos(x, y, zLevel).tex(0D, 0D).endVertex();
    tessellator.draw();
    RenderHelper.disableStandardItemLighting();
    popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 53 with Tessellator

use of net.minecraft.client.renderer.Tessellator in project Guide-API by TeamAmeriFrance.

the class GuiHelper method drawIconWithoutColor.

/**
     * @param x      - The position on the x-axis to draw the icon
     * @param y      - The position on the y-axis to draw the icon
     * @param width  - The width of the icon
     * @param height - The height of the icon
     * @param zLevel -
     */
public static void drawIconWithoutColor(int x, int y, int width, int height, float zLevel) {
    pushMatrix();
    enableBlend();
    blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);
    RenderHelper.enableGUIStandardItemLighting();
    disableLighting();
    enableRescaleNormal();
    enableDepth();
    Tessellator tessellator = Tessellator.getInstance();
    tessellator.getBuffer().begin(7, DefaultVertexFormats.POSITION_TEX);
    tessellator.getBuffer().pos(x, y + height, zLevel).tex(0D, 1D).endVertex();
    tessellator.getBuffer().pos(x + width, y + height, zLevel).tex(1D, 1D).endVertex();
    tessellator.getBuffer().pos(x + width, y, zLevel).tex(1D, 0D).endVertex();
    tessellator.getBuffer().pos(x, y, zLevel).tex(0D, 0D).endVertex();
    tessellator.draw();
    RenderHelper.disableStandardItemLighting();
    popMatrix();
}
Also used : Tessellator(net.minecraft.client.renderer.Tessellator)

Example 54 with Tessellator

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

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

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