Search in sources :

Example 31 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project Hypnotic-Client by Hypnotic-Development.

the class Radar method drawPointer.

private void drawPointer(MatrixStack matrixStack) {
    Matrix4f matrix4f = matrixStack.peek().getPositionMatrix();
    Color color1 = color.getColor();
    RenderUtils.setup2DRender(false);
    BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
    matrixStack.scale(2.5f, 2.5f, 2.5f);
    matrixStack.translate(0, 1.5, 0);
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, /*QUADS*/
    VertexFormats.POSITION_COLOR);
    bufferBuilder.vertex(matrix4f, 0, -4, 0).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
    bufferBuilder.vertex(matrix4f, -1, 0, 0).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
    bufferBuilder.vertex(matrix4f, 1, 0, 0).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
    bufferBuilder.vertex(matrix4f, 0, -4, 0).color(color1.getRed(), color1.getGreen(), color1.getBlue(), color1.getAlpha()).next();
    bufferBuilder.end();
    BufferRenderer.draw(bufferBuilder);
    RenderUtils.end2DRender();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Color(java.awt.Color) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 32 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project Hypnotic-Client by Hypnotic-Development.

the class ESP method renderOutline.

void renderOutline(Entity e, Color color, MatrixStack stack) {
    float red = color.getRed() / 255f;
    float green = color.getGreen() / 255f;
    float blue = color.getBlue() / 255f;
    float alpha = color.getAlpha() / 255f;
    Camera c = mc.gameRenderer.getCamera();
    Vec3d camPos = c.getPos();
    Vec3d start = e.getPos().subtract(camPos);
    float x = (float) start.x;
    float y = (float) start.y;
    float z = (float) start.z;
    double r = Math.toRadians(-c.getYaw() + 90);
    float sin = (float) (Math.sin(r) * (e.getWidth() / 1.7));
    float cos = (float) (Math.cos(r) * (e.getWidth() / 1.7));
    stack.push();
    Matrix4f matrix = stack.peek().getPositionMatrix();
    BufferBuilder buffer = Tessellator.getInstance().getBuffer();
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    GL11.glDepthFunc(GL11.GL_ALWAYS);
    RenderSystem.setShaderColor(1f, 1f, 1f, 1f);
    RenderSystem.defaultBlendFunc();
    RenderSystem.enableBlend();
    buffer.begin(VertexFormat.DrawMode.DEBUG_LINES, VertexFormats.POSITION_COLOR);
    buffer.vertex(matrix, x + sin, y, z + cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x - sin, y, z - cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x - sin, y, z - cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x - sin, y + e.getHeight(), z - cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x - sin, y + e.getHeight(), z - cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x + sin, y + e.getHeight(), z + cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x + sin, y + e.getHeight(), z + cos).color(red, green, blue, alpha).next();
    buffer.vertex(matrix, x + sin, y, z + cos).color(red, green, blue, alpha).next();
    buffer.end();
    BufferRenderer.draw(buffer);
    GL11.glDepthFunc(GL11.GL_LEQUAL);
    RenderSystem.disableBlend();
    stack.pop();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer) Camera(net.minecraft.client.render.Camera) Vec3d(net.minecraft.util.math.Vec3d)

Example 33 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project Paradise-Lost by devs-immortal.

the class InGameOverlayRendererMixin method renderInAercloudOverlay.

// Follows the same procedures as the renderUnderwaterOverlay method in the original class
private static void renderInAercloudOverlay(MinecraftClient minecraftClient, Block block, MatrixStack matrixStack) {
    minecraftClient.getTextureManager().bindTexture(new Identifier("the_aether:textures/block/aercloud_overlay.png"));
    // color[0] = red, color[1] = green, color[2] = blue
    int[] color = rgbFromMaterialColor(block.getDefaultMaterialColor());
    BufferBuilder bufferBuilder = Tessellator.getInstance().getBuffer();
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    // m and n move the overlay as the player rotates
    float m = -minecraftClient.player.yaw / 256.0F;
    float n = minecraftClient.player.pitch / 256.0F;
    Matrix4f matrix4f = matrixStack.peek().getModel();
    bufferBuilder.begin(7, VertexFormats.POSITION_COLOR_TEXTURE);
    // The reason it's 255-color[n] is because this function calculates colors backwards.
    bufferBuilder.vertex(matrix4f, -2.0F, -2.0F, -0.5F).color(255 - color[0], 255 - color[1], 255 - color[2], 0.4F).texture(4.0F + m, 4.0F + n).next();
    bufferBuilder.vertex(matrix4f, 2.0F, -2.0F, -0.5F).color(255 - color[0], 255 - color[1], 255 - color[2], 0.4F).texture(0.0F + m, 4.0F + n).next();
    bufferBuilder.vertex(matrix4f, 2.0F, 2.0F, -0.5F).color(255 - color[0], 255 - color[1], 255 - color[2], 0.4F).texture(0.0F + m, 0.0F + n).next();
    bufferBuilder.vertex(matrix4f, -2.0F, 2.0F, -0.5F).color(255 - color[0], 255 - color[1], 255 - color[2], 0.4F).texture(4.0F + m, 0.0F + n).next();
    bufferBuilder.end();
    // Overlays it on the screen
    BufferRenderer.draw(bufferBuilder);
    RenderSystem.disableBlend();
}
Also used : Matrix4f(net.minecraft.util.math.Matrix4f) Identifier(net.minecraft.util.Identifier) BufferBuilder(net.minecraft.client.render.BufferBuilder)

Example 34 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project JexClient by DustinRepo.

the class GuiPasswordField method drawSelectionHighlight.

private void drawSelectionHighlight(int x1, int y1, int x2, int y2) {
    int j;
    if (x1 < x2) {
        j = x1;
        x1 = x2;
        x2 = j;
    }
    if (y1 < y2) {
        j = y1;
        y1 = y2;
        y2 = j;
    }
    if (x2 > this.x + this.width) {
        x2 = this.x + this.width;
    }
    if (x1 > this.x + this.width) {
        x1 = this.x + this.width;
    }
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    RenderSystem.setShader(GameRenderer::getPositionShader);
    RenderSystem.setShaderColor(0.0F, 0.0F, 1.0F, 1.0F);
    RenderSystem.disableTexture();
    RenderSystem.enableColorLogicOp();
    RenderSystem.logicOp(LogicOp.OR_REVERSE);
    bufferBuilder.begin(DrawMode.QUADS, VertexFormats.POSITION);
    bufferBuilder.vertex((double) x1, (double) y2, 0.0D).next();
    bufferBuilder.vertex((double) x2, (double) y2, 0.0D).next();
    bufferBuilder.vertex((double) x2, (double) y1, 0.0D).next();
    bufferBuilder.vertex((double) x1, (double) y1, 0.0D).next();
    tessellator.draw();
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    RenderSystem.disableColorLogicOp();
    RenderSystem.enableTexture();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Example 35 with BufferBuilder

use of net.minecraft.client.render.BufferBuilder in project HWG by cybercat-mods.

the class SniperMixin method renderSniperOverlay.

private void renderSniperOverlay() {
    RenderSystem.disableDepthTest();
    RenderSystem.depthMask(false);
    RenderSystem.defaultBlendFunc();
    RenderSystem.setShader(GameRenderer::getPositionTexShader);
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    RenderSystem.setShaderTexture(0, SNIPER);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder bufferBuilder = tessellator.getBuffer();
    bufferBuilder.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_TEXTURE);
    bufferBuilder.vertex(0.0D, (double) this.scaledHeight, -90.0D).texture(0.0F, 1.0F).next();
    bufferBuilder.vertex((double) this.scaledWidth, (double) this.scaledHeight, -90.0D).texture(1.0F, 1.0F).next();
    bufferBuilder.vertex((double) this.scaledWidth, 0.0D, -90.0D).texture(1.0F, 0.0F).next();
    bufferBuilder.vertex(0.0D, 0.0D, -90.0D).texture(0.0F, 0.0F).next();
    tessellator.draw();
    RenderSystem.depthMask(true);
    RenderSystem.enableDepthTest();
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer)

Aggregations

BufferBuilder (net.minecraft.client.render.BufferBuilder)76 GameRenderer (net.minecraft.client.render.GameRenderer)46 Tessellator (net.minecraft.client.render.Tessellator)44 Matrix4f (net.minecraft.util.math.Matrix4f)18 MatrixStack (net.minecraft.client.util.math.MatrixStack)14 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)9 Color (java.awt.Color)9 RenderLayer (net.minecraft.client.render.RenderLayer)5 Vec3d (net.minecraft.util.math.Vec3d)5 BlockState (net.minecraft.block.BlockState)4 BlockEntity (net.minecraft.block.entity.BlockEntity)4 ChunkOcclusionDataBuilder (net.minecraft.client.render.chunk.ChunkOcclusionDataBuilder)4 FluidState (net.minecraft.fluid.FluidState)4 BlockPos (net.minecraft.util.math.BlockPos)4 Random (java.util.Random)3 BlockRenderManager (net.minecraft.client.render.block.BlockRenderManager)3 ChunkRendererRegion (net.minecraft.client.render.chunk.ChunkRendererRegion)3 Inject (org.spongepowered.asm.mixin.injection.Inject)3 Mirror (com.qouteall.immersive_portals.portal.Mirror)2 HashSet (java.util.HashSet)2