Search in sources :

Example 16 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project meteor-client by MeteorDevelopment.

the class NametagUtils method begin.

public static void begin(Vec3 pos) {
    MatrixStack matrices = RenderSystem.getModelViewStack();
    matrices.push();
    matrices.translate(pos.x, pos.y, 0);
    matrices.scale((float) scale, (float) scale, 1);
}
Also used : MatrixStack(net.minecraft.client.util.math.MatrixStack)

Example 17 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project meteor-client by MeteorDevelopment.

the class HudEditorScreen method render.

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
    if (!Utils.canUpdate())
        renderBackground(matrices);
    double s = mc.getWindow().getScaleFactor();
    mouseX *= s;
    mouseY *= s;
    Utils.unscaledProjection();
    if (!Utils.canUpdate())
        hud.render(delta, hudElement -> true);
    Renderer2D.COLOR.begin();
    for (HudElement element : hud.elements) {
        if (element.active)
            continue;
        renderElement(element, INACTIVE_BG_COLOR, INACTIVE_OL_COLOR);
    }
    for (HudElement element : selectedElements) {
        renderElement(element, HOVER_BG_COLOR, HOVER_OL_COLOR);
    }
    if (!dragging) {
        hoveredModule = null;
        for (HudElement module : hud.elements) {
            if (module.box.isOver(mouseX, mouseY)) {
                if (!selectedElements.contains(module))
                    renderElement(module, HOVER_BG_COLOR, HOVER_OL_COLOR);
                hoveredModule = module;
                break;
            }
        }
        if (selecting) {
            renderQuad(mouseStartX, mouseStartY, mouseX - mouseStartX, mouseY - mouseStartY, HOVER_BG_COLOR, HOVER_OL_COLOR);
        }
    }
    Renderer2D.COLOR.render(new MatrixStack());
    Utils.scaledProjection();
    runAfterRenderTasks();
}
Also used : Systems(meteordevelopment.meteorclient.systems.Systems) HUD(meteordevelopment.meteorclient.systems.hud.HUD) GuiTheme(meteordevelopment.meteorclient.gui.GuiTheme) Color(meteordevelopment.meteorclient.utils.render.color.Color) NbtUtils(meteordevelopment.meteorclient.utils.misc.NbtUtils) MatrixStack(net.minecraft.client.util.math.MatrixStack) GLFW(org.lwjgl.glfw.GLFW) ArrayList(java.util.ArrayList) NbtCompound(net.minecraft.nbt.NbtCompound) Renderer2D(meteordevelopment.meteorclient.renderer.Renderer2D) List(java.util.List) Screen(net.minecraft.client.gui.screen.Screen) HudElement(meteordevelopment.meteorclient.systems.hud.modules.HudElement) WidgetScreen(meteordevelopment.meteorclient.gui.WidgetScreen) Utils(meteordevelopment.meteorclient.utils.Utils) MeteorClient.mc(meteordevelopment.meteorclient.MeteorClient.mc) MatrixStack(net.minecraft.client.util.math.MatrixStack) HudElement(meteordevelopment.meteorclient.systems.hud.modules.HudElement)

Example 18 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.

the class RenderUtils method drawLine2D.

public static void drawLine2D(double x1, double y1, double x2, double y2, LineColor color, float width) {
    setup();
    MatrixStack matrices = matrixFrom(x1, y1, 0);
    Tessellator tessellator = Tessellator.getInstance();
    BufferBuilder buffer = tessellator.getBuffer();
    // Line
    RenderSystem.disableDepthTest();
    RenderSystem.disableCull();
    RenderSystem.setShader(GameRenderer::getRenderTypeLinesShader);
    RenderSystem.lineWidth(width);
    buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
    Vertexer.vertexLine(matrices, buffer, (float) x1, (float) y1, 0f, (float) x2, (float) y2, 0, color);
    tessellator.draw();
    RenderSystem.enableCull();
    RenderSystem.enableDepthTest();
    cleanup();
}
Also used : MatrixStack(net.minecraft.client.util.math.MatrixStack)

Example 19 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.

the class RenderUtils method drawWorldGuiItem.

public static void drawWorldGuiItem(double x, double y, double z, double offX, double offY, double scale, ItemStack item) {
    if (item.isEmpty()) {
        return;
    }
    MatrixStack matrices = matrixFrom(x, y, z);
    Camera camera = Utils.mc.gameRenderer.getCamera();
    matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(-camera.getYaw()));
    matrices.multiply(Vec3f.POSITIVE_X.getDegreesQuaternion(camera.getPitch()));
    matrices.translate(offX, offY, 0);
    matrices.scale((float) scale, (float) scale, 0.001f);
    matrices.multiply(Vec3f.POSITIVE_Y.getDegreesQuaternion(180f));
    RenderSystem.enableBlend();
    RenderSystem.defaultBlendFunc();
    Vec3f[] currentLight = getCurrentLight();
    DiffuseLighting.disableGuiDepthLighting();
    Utils.mc.getBufferBuilders().getEntityVertexConsumers().draw();
    Utils.mc.getItemRenderer().renderItem(item, ModelTransformation.Mode.GUI, 0xF000F0, OverlayTexture.DEFAULT_UV, matrices, Utils.mc.getBufferBuilders().getEntityVertexConsumers(), 0);
    Utils.mc.getBufferBuilders().getEntityVertexConsumers().draw();
    RenderSystem.setShaderLights(currentLight[0], currentLight[1]);
    RenderSystem.disableBlend();
}
Also used : MatrixStack(net.minecraft.client.util.math.MatrixStack)

Example 20 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project KiwiClient by TangyKiwi.

the class RenderUtils method drawBoxFill.

public static void drawBoxFill(Box box, QuadColor color, Direction... excludeDirs) {
    if (!FrustumUtils.isBoxVisible(box)) {
        return;
    }
    setup();
    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.vertexBoxQuads(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
    tessellator.draw();
    cleanup();
}
Also used : MatrixStack(net.minecraft.client.util.math.MatrixStack)

Aggregations

MatrixStack (net.minecraft.client.util.math.MatrixStack)108 VertexConsumerProvider (net.minecraft.client.render.VertexConsumerProvider)15 BufferBuilder (net.minecraft.client.render.BufferBuilder)14 Inject (org.spongepowered.asm.mixin.injection.Inject)13 GameRenderer (net.minecraft.client.render.GameRenderer)12 Tessellator (net.minecraft.client.render.Tessellator)12 Camera (net.minecraft.client.render.Camera)11 MinecraftClient (net.minecraft.client.MinecraftClient)10 ItemStack (net.minecraft.item.ItemStack)10 PlayerEntity (net.minecraft.entity.player.PlayerEntity)9 Vec3d (net.minecraft.util.math.Vec3d)9 Identifier (net.minecraft.util.Identifier)8 BlockPos (net.minecraft.util.math.BlockPos)8 Random (java.util.Random)7 VertexConsumer (net.minecraft.client.render.VertexConsumer)7 Matrix4f (net.minecraft.util.math.Matrix4f)7 Color (java.awt.Color)6 BlockState (net.minecraft.block.BlockState)6 LiteralText (net.minecraft.text.LiteralText)6 BlockEntity (net.minecraft.block.entity.BlockEntity)5