Search in sources :

Example 21 with GameRenderer

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

the class RenderUtils method drawFaceFill.

public static void drawFaceFill(BlockPos blockPos, QuadColor color, Direction face) {
    Box box = new Box(blockPos);
    if (!getFrustum().isVisible(box)) {
        return;
    }
    setup3DRender(true);
    MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    // Fill
    RenderSystem.setShader(GameRenderer::getPositionColorShader);
    buffer.begin(VertexFormat.DrawMode.QUADS, VertexFormats.POSITION_COLOR);
    Vertexer.vertexBoxQuadsFace(matrices, buffer, Boxes.moveToZero(box), color, face);
    tessellator.draw();
    end3DRender();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) MatrixStack(net.minecraft.client.util.math.MatrixStack) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer) Box(net.minecraft.util.math.Box)

Example 22 with GameRenderer

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

the class RenderUtils method drawFaceOutline.

public static void drawFaceOutline(BlockPos blockPos, QuadColor color, int width, Direction face) {
    Box box = new Box(blockPos);
    if (!getFrustum().isVisible(box)) {
        return;
    }
    setup3DRender(true);
    MatrixStack matrices = matrixFrom(box.minX, box.minY, box.minZ);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    // Outline
    RenderSystem.disableCull();
    RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
    RenderSystem.lineWidth(width);
    buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
    Vertexer.vertexBoxLinesFace(matrices, buffer, Boxes.moveToZero(box), color, face);
    tessellator.draw();
    RenderSystem.enableCull();
    end3DRender();
}
Also used : Tessellator(net.minecraft.client.render.Tessellator) MatrixStack(net.minecraft.client.util.math.MatrixStack) BufferBuilder(net.minecraft.client.render.BufferBuilder) GameRenderer(net.minecraft.client.render.GameRenderer) Box(net.minecraft.util.math.Box)

Example 23 with GameRenderer

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

the class TextBox 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(GlStateManager.LogicOp.OR_REVERSE);
    bufferBuilder.begin(VertexFormat.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 24 with GameRenderer

use of net.minecraft.client.render.GameRenderer 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 25 with GameRenderer

use of net.minecraft.client.render.GameRenderer in project WildfireFemaleGenderMod by WildfireRomeo.

the class WildfirePlayerListScreen method render.

@Override
public void render(MatrixStack m, int f1, int f2, float f3) {
    HOVER_PLAYER = null;
    this.setTooltip(null);
    PLAYER_LIST.refreshList();
    super.renderBackground(m);
    MinecraftClient mc = MinecraftClient.getInstance();
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    if (this.TXTR_BACKGROUND != null) {
        RenderSystem.setShader(GameRenderer::getPositionTexShader);
        RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
        RenderSystem.setShaderTexture(0, this.TXTR_BACKGROUND);
    }
    int i = (this.width - 132) / 2;
    int j = (this.height - 156) / 2 - 20;
    drawTexture(m, i, j, 0, 0, 192, 174);
    int x = (this.width / 2);
    int y = (this.height / 2) - 20;
    super.render(m, f1, f2, f3);
    double scale = mc.getWindow().getScaleFactor();
    int left = x - 59;
    int bottom = y - 32;
    int width = 118;
    int height = 134;
    RenderSystem.enableScissor((int) (left * scale), (int) (bottom * scale), (int) (width * scale), (int) (height * scale));
    PLAYER_LIST.render(m, f1, f2, f3);
    RenderSystem.disableScissor();
    if (HOVER_PLAYER != null) {
        int dialogX = x + 75;
        int dialogY = y - 73;
        PlayerEntity pEntity = mc.world.getPlayerByUuid(HOVER_PLAYER.uuid);
        if (pEntity != null) {
            this.textRenderer.drawWithShadow(m, pEntity.getDisplayName().copy().formatted(Formatting.UNDERLINE), dialogX, dialogY - 2, 0xFFFFFF);
        }
        Gender gender = HOVER_PLAYER.getGender();
        this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.label.gender").append(" ").append(gender.getDisplayName()), dialogX, dialogY + 10, 0xBBBBBB);
        if (gender.canHaveBreasts()) {
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.wardrobe.slider.breast_size", Math.round(HOVER_PLAYER.getBustSize() * 100)), dialogX, dialogY + 20, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.char_settings.physics", new TranslatableText(HOVER_PLAYER.hasBreastPhysics() ? "wildfire_gender.label.enabled" : "wildfire_gender.label.disabled")), dialogX, dialogY + 40, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.bounce_multiplier", HOVER_PLAYER.getBounceMultiplier()), dialogX + 6, dialogY + 50, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.breast_momentum", Math.round(HOVER_PLAYER.getFloppiness() * 100)), dialogX + 6, dialogY + 60, 0xBBBBBB);
            this.textRenderer.drawWithShadow(m, new TranslatableText("wildfire_gender.player_list.female_sounds", new TranslatableText(HOVER_PLAYER.hasHurtSounds() ? "wildfire_gender.label.enabled" : "wildfire_gender.label.disabled")), dialogX, dialogY + 80, 0xBBBBBB);
        }
        if (pEntity != null) {
            WardrobeBrowserScreen.drawEntityOnScreen(x - 110, y + 45, 45, (x - 300), (y - 26 - f2), pEntity);
        }
    }
    this.textRenderer.draw(m, new TranslatableText("wildfire_gender.player_list.title"), x - 60, y - 73, 4473924);
    boolean withCreator = false;
    ClientPlayNetworkHandler clientPlayNetworkHandler = this.client.player.networkHandler;
    Collection<PlayerListEntry> list = clientPlayNetworkHandler.getPlayerList();
    for (PlayerListEntry plr : list) {
        if (plr.getProfile().getId().equals(CREATOR_UUID)) {
            withCreator = true;
        }
    }
    if (withCreator) {
        drawCenteredText(m, this.textRenderer, new TranslatableText("wildfire_gender.label.with_creator"), this.width / 2, y + 100, 0xFF00FF);
    }
    /*if(Calendar.getInstance().get(Calendar.MONTH) == 9) {
			fill(m, x - 159, y + 106, x + 159, y + 136, 0x55000000);
			textRenderer.draw(m, Formatting.ITALIC + "Hey, it's Breast Cancer Awareness Month!", this.width / 2 - 155, y + 110, 0xFFFFFF);
			textRenderer.draw(m, "Click here to donate to " + Formatting.LIGHT_PURPLE + "Susan G. Komen Foundation" + Formatting.WHITE + "!", this.width / 2 - 155, y + 124, 0xAAAAAA);
			RenderSystem.setShader(GameRenderer::getPositionTexShader);
		RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
		RenderSystem.setShaderTexture(0, this.TXTR_RIBBON);
			Screen.drawTexture(m, x + 130, y + 109, 26, 26, 0, 0, 20, 20, 20, 20);
		}*/
    if (tooltip != null) {
        this.renderTooltip(m, tooltip, f1, f2);
    }
}
Also used : TranslatableText(net.minecraft.text.TranslatableText) MinecraftClient(net.minecraft.client.MinecraftClient) GameRenderer(net.minecraft.client.render.GameRenderer) PlayerListEntry(net.minecraft.client.network.PlayerListEntry) WildfireGender(com.wildfire.main.WildfireGender) Gender(com.wildfire.main.GenderPlayer.Gender) ClientPlayNetworkHandler(net.minecraft.client.network.ClientPlayNetworkHandler) PlayerEntity(net.minecraft.entity.player.PlayerEntity)

Aggregations

GameRenderer (net.minecraft.client.render.GameRenderer)71 BufferBuilder (net.minecraft.client.render.BufferBuilder)46 Tessellator (net.minecraft.client.render.Tessellator)31 MatrixStack (net.minecraft.client.util.math.MatrixStack)12 Matrix4f (net.minecraft.util.math.Matrix4f)11 IMatrix4f (dev.hypnotic.utils.mixin.IMatrix4f)6 MinecraftClient (net.minecraft.client.MinecraftClient)5 ItemStack (net.minecraft.item.ItemStack)5 TranslatableText (net.minecraft.text.TranslatableText)4 Color (java.awt.Color)3 TextRenderer (net.minecraft.client.font.TextRenderer)3 Text (net.minecraft.text.Text)3 Vec3d (net.minecraft.util.math.Vec3d)3 Camera (net.minecraft.client.render.Camera)2 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)2 PlayerEntity (net.minecraft.entity.player.PlayerEntity)2 MapState (net.minecraft.item.map.MapState)2 LiteralText (net.minecraft.text.LiteralText)2 OrderedText (net.minecraft.text.OrderedText)2 Box (net.minecraft.util.math.Box)2