Search in sources :

Example 26 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.

the class RenderUtils method drawBoxOutline.

public static void drawBoxOutline(Box box, QuadColor color, float lineWidth, Direction... excludeDirs) {
    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(lineWidth);
    buffer.begin(VertexFormat.DrawMode.LINES, VertexFormats.LINES);
    Vertexer.vertexBoxLines(matrices, buffer, Boxes.moveToZero(box), color, excludeDirs);
    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)

Example 27 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack 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 28 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack 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 29 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.

the class ItemRendererMixin method preRenderItem.

@Inject(method = "renderItem(Lnet/minecraft/item/ItemStack;Lnet/minecraft/client/render/model/json/ModelTransformation$Mode;ZLnet/minecraft/client/util/math/MatrixStack;Lnet/minecraft/client/render/VertexConsumerProvider;IILnet/minecraft/client/render/model/BakedModel;)V", at = @At("HEAD"), cancellable = true)
public void preRenderItem(ItemStack stack, ModelTransformation.Mode renderMode, boolean leftHanded, MatrixStack matrices, VertexConsumerProvider vertexConsumers, int light, int overlay, BakedModel model, CallbackInfo ci) {
    EventRenderItem event = new EventRenderItem(matrices, stack, renderMode, EventRenderItem.RenderTime.PRE, leftHanded);
    event.call();
    if (ModuleManager.INSTANCE.getModule(OldBlock.class).isEnabled()) {
        if ((ModuleManager.INSTANCE.getModule(Killaura.class).autoBlockMode.is("Visual") && Killaura.target != null ? Killaura.target == null : !mc.player.isUsingItem()) || renderMode != ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND)
            return;
        MatrixStack matrixStack = event.getMatrixStack();
        boolean offHand = event.isLeftHanded() ? event.getType() == ModelTransformation.Mode.FIRST_PERSON_RIGHT_HAND : event.getType() == ModelTransformation.Mode.FIRST_PERSON_LEFT_HAND;
        if (!offHand) {
            if ((event.getItemStack().getItem() instanceof AxeItem || event.getItemStack().getItem() instanceof SwordItem) && event.getItemStack() == mc.player.getMainHandStack()) {
                matrixStack.multiply(new Quaternion(-270f, 0f, 270f, true));
                matrixStack.multiply(new Quaternion(-120f, 270f, -150f, true));
                matrixStack.multiply(new Quaternion(-70f, -108f, 90f, true));
                // Only plays with killaura
                if (Killaura.target != null && !Killaura.target.isDead()) {
                    switch(ModuleManager.INSTANCE.getModule(OldBlock.class).animation.getSelected()) {
                        case "1.7(ish)":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, 0, 0, true));
                            break;
                        case "Slide":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks / 2, true));
                            break;
                        case "Sigma":
                            matrixStack.multiply(new Quaternion(-ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.15f, 0, 0, true));
                            matrixStack.multiply(new Quaternion(0, 0, ModuleManager.INSTANCE.getModule(OldBlock.class).swingTicks * 0.5f, true));
                            break;
                        case "Swing":
                            mc.player.swingHand(Hand.MAIN_HAND);
                            break;
                    }
                }
                ArmCustomize arm = ModuleManager.INSTANCE.getModule(ArmCustomize.class);
                if (arm.isEnabled())
                    matrixStack.translate(arm.mainX.getValue(), arm.mainY.getValue(), arm.mainZ.getValue());
            }
        }
    }
    if (event.isCancelled())
        ci.cancel();
}
Also used : OldBlock(dev.hypnotic.module.render.OldBlock) Quaternion(net.minecraft.util.math.Quaternion) MatrixStack(net.minecraft.client.util.math.MatrixStack) EventRenderItem(dev.hypnotic.event.events.EventRenderItem) SwordItem(net.minecraft.item.SwordItem) AxeItem(net.minecraft.item.AxeItem) ArmCustomize(dev.hypnotic.module.render.ArmCustomize) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 30 with MatrixStack

use of net.minecraft.client.util.math.MatrixStack in project Hypnotic-Client by Hypnotic-Development.

the class AltManagerScreen method render.

@Override
public void render(MatrixStack matrices, int mouseX, int mouseY, float delta) {
    this.renderBackground(matrices);
    fill(matrices, 100, 70, width - 100, height - 70, new Color(0, 0, 0, 100).getRGB());
    drawStringWithShadow(matrices, textRenderer, MinecraftClient.getInstance().getSession().getProfile().getName(), 20, 20, -1);
    RenderUtils.drawCenteredStringWithShadow(matrices, textRenderer, status, width / 2, 20, -1);
    ((ButtonWidget) this.addDrawableChild(new ButtonWidget(this.width / 2 - 100, height - 50, 200, 20, new LiteralText("Add alt"), (button) -> {
        MinecraftClient.getInstance().setScreen(new AddAltScreen(this));
    }))).active = true;
    int offset = 0;
    RenderSystem.enableScissor(10, 10, 1000, 1000);
    // GL11.glScissor(10, 10, 100000, 10000);
    for (Account<?> alt : Accounts.get()) {
        ((ButtonWidget) this.addDrawableChild(new ButtonWidget(100, height - 50 + offset, 200, 20, new LiteralText("Login"), (button) -> {
            MinecraftClient.getInstance().setScreen(new AddAltScreen(this));
        }))).active = true;
        drawStringWithShadow(matrices, textRenderer, alt.getUsername(), 100 + 5, offset, -1);
        drawStringWithShadow(matrices, textRenderer, alt.getType().name(), 100 + 5, offset + 20, -1);
        offset += 50;
    }
    RenderSystem.disableScissor();
    super.render(matrices, mouseX, mouseY, delta);
}
Also used : Color(java.awt.Color) LiteralText(net.minecraft.text.LiteralText) Screen(net.minecraft.client.gui.screen.Screen) RenderSystem(com.mojang.blaze3d.systems.RenderSystem) MatrixStack(net.minecraft.client.util.math.MatrixStack) MinecraftClient(net.minecraft.client.MinecraftClient) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) Hypnotic(dev.hypnotic.Hypnotic) RenderUtils(dev.hypnotic.utils.render.RenderUtils) File(java.io.File) Account(dev.hypnotic.ui.altmanager.account.Account) Accounts(dev.hypnotic.ui.altmanager.account.Accounts) Color(java.awt.Color) ButtonWidget(net.minecraft.client.gui.widget.ButtonWidget) LiteralText(net.minecraft.text.LiteralText)

Aggregations

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