Search in sources :

Example 81 with MatrixStack

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

the class GameRendererMixin method renderForEvent.

@Inject(method = "render", at = @At(value = "INVOKE", target = "net/minecraft/client/render/WorldRenderer.drawEntityOutlinesFramebuffer()V"))
public void renderForEvent(float float_1, long long_1, boolean boolean_1, CallbackInfo ci) {
    RenderUtils.setup2DProjection();
    new EventRender2DNoScale(new MatrixStack(), float_1).call();
}
Also used : EventRender2DNoScale(dev.hypnotic.event.events.EventRender2DNoScale) MatrixStack(net.minecraft.client.util.math.MatrixStack) Inject(org.spongepowered.asm.mixin.injection.Inject)

Example 82 with MatrixStack

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

the class ItemRendererMixin method renderGuiItemModel.

@SuppressWarnings("deprecation")
protected void renderGuiItemModel(ItemStack stack, float x, float y, BakedModel model, float scale) {
    this.textureManager.getTexture(SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE).setFilter(false, false);
    RenderSystem.setShaderTexture(0, SpriteAtlasTexture.BLOCK_ATLAS_TEXTURE);
    RenderSystem.enableBlend();
    RenderSystem.blendFunc(GlStateManager.SrcFactor.SRC_ALPHA, GlStateManager.DstFactor.ONE_MINUS_SRC_ALPHA);
    RenderSystem.setShaderColor(1.0F, 1.0F, 1.0F, 1.0F);
    MatrixStack matrixStack = RenderSystem.getModelViewStack();
    matrixStack.push();
    matrixStack.translate((double) x, (double) y, (double) (100.0F + this.zOffset));
    matrixStack.translate(8.0D, 8.0D, 0.0D);
    matrixStack.scale(scale, -scale, 1.0F);
    matrixStack.scale(16.0F, 16.0F, 16.0F);
    RenderSystem.applyModelViewMatrix();
    MatrixStack matrixStack2 = new MatrixStack();
    VertexConsumerProvider.Immediate immediate = MinecraftClient.getInstance().getBufferBuilders().getEntityVertexConsumers();
    boolean bl = !model.isSideLit();
    if (bl) {
        DiffuseLighting.disableGuiDepthLighting();
    }
    this.renderItem(stack, ModelTransformation.Mode.GUI, false, matrixStack2, immediate, 15728880, OverlayTexture.DEFAULT_UV, model);
    immediate.draw();
    RenderSystem.enableDepthTest();
    if (bl) {
        DiffuseLighting.enableGuiDepthLighting();
    }
    matrixStack.pop();
    RenderSystem.applyModelViewMatrix();
}
Also used : MatrixStack(net.minecraft.client.util.math.MatrixStack) VertexConsumerProvider(net.minecraft.client.render.VertexConsumerProvider)

Example 83 with MatrixStack

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

the class StorageESP method onBlockEntityRender.

@EventTarget
public void onBlockEntityRender(EventBlockEntityRender.PreAll event) {
    if (mode.is("Shader")) {
        try {
            for (Entry<BlockEntity, float[]> be : blockEntities.entrySet()) {
                BlockEntityRenderer<BlockEntity> beRenderer = mc.getBlockEntityRenderDispatcher().get(be.getKey());
                BlockPos pos = be.getKey().getPos();
                MatrixStack matrices = RenderUtils.matrixFrom(pos.getX(), pos.getY(), pos.getZ());
                if (beRenderer != null) {
                    beRenderer.render(be.getKey(), mc.getTickDelta(), matrices, OutlineVertexConsumers.outlineOnlyProvider(be.getValue()[0], be.getValue()[1], be.getValue()[2], 1f), 0xf000f0, OverlayTexture.DEFAULT_UV);
                } else {
                    BlockState state = be.getKey().getCachedState();
                    mc.getBlockRenderManager().getModelRenderer().render(mc.world, mc.getBlockRenderManager().getModel(state), state, BlockPos.ORIGIN, matrices, OutlineVertexConsumers.outlineOnlyConsumer(be.getValue()[0], be.getValue()[1], be.getValue()[2], 1f), false, new Random(), 0L, OverlayTexture.DEFAULT_UV);
                }
            }
        } catch (Exception e) {
        }
    }
}
Also used : BlockState(net.minecraft.block.BlockState) Random(java.util.Random) MatrixStack(net.minecraft.client.util.math.MatrixStack) BlockPos(net.minecraft.util.math.BlockPos) JsonSyntaxException(com.google.gson.JsonSyntaxException) IOException(java.io.IOException) BlockEntity(net.minecraft.block.entity.BlockEntity) EnderChestBlockEntity(net.minecraft.block.entity.EnderChestBlockEntity) AbstractFurnaceBlockEntity(net.minecraft.block.entity.AbstractFurnaceBlockEntity) ShulkerBoxBlockEntity(net.minecraft.block.entity.ShulkerBoxBlockEntity) ChestBlockEntity(net.minecraft.block.entity.ChestBlockEntity) DispenserBlockEntity(net.minecraft.block.entity.DispenserBlockEntity) FurnaceBlockEntity(net.minecraft.block.entity.FurnaceBlockEntity) BarrelBlockEntity(net.minecraft.block.entity.BarrelBlockEntity) EventTarget(dev.hypnotic.event.EventTarget)

Example 84 with MatrixStack

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

the class TabGUI method renderGUI.

@EventTarget
public void renderGUI(EventRenderGUI event) {
    MatrixStack matrices = event.getMatrices();
    x = 4;
    y = 30;
    width = 80;
    height = 15;
    if (animTicks != currentTab * 15) {
        if (shouldMoveDown)
            animTicks++;
        if (shouldMoveUp)
            animTicks--;
    } else {
        shouldMoveUp = false;
        shouldMoveDown = false;
    }
    if (animTicks > (Category.values().length - 1) * 15) {
        animTicks = 0;
    }
    if (animTicks < 0) {
        animTicks = 0;
    }
    if (animTicks2 != Category.values()[currentTab].moduleIndex * 15) {
        if (shouldMoveDown2)
            animTicks2++;
        if (shouldMoveUp2)
            animTicks2--;
    } else {
        shouldMoveUp2 = false;
        shouldMoveDown2 = false;
    }
    if (animTicks2 > (ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]).size() - 1) * 15) {
        animTicks2 = 0;
    }
    if (animTicks2 < 0) {
        animTicks2 = 0;
    }
    DrawableHelper.fill(matrices, x, y, x + width, y + Category.values().length * 15, new Color(0, 0, 0, 100).getRGB());
    DrawableHelper.fill(matrices, x, y + animTicks, x + width, y + height + animTicks, ColorUtils.defaultClientColor);
    DrawableHelper.fill(matrices, x, y, x + width, y - 1, ColorUtils.defaultClientColor);
    DrawableHelper.fill(matrices, x, y, x + 1, y + Category.values().length * 15, ColorUtils.defaultClientColor);
    DrawableHelper.fill(matrices, x, y + Category.values().length * 15, x + width, y - 1 + Category.values().length * 15, ColorUtils.defaultClientColor);
    DrawableHelper.fill(matrices, x + width, y - 1, x + width + 1, y + Category.values().length * 15, ColorUtils.defaultClientColor);
    int offset = 0;
    for (Category category : Category.values()) {
        FontManager.robotoMed.drawWithShadow(matrices, category.name, x + 4, y + offset + 2, -1);
        offset += 15;
    }
    if (expanded) {
        if (expandTicks < 165) {
            expandTicks += Math.max(event.getTickDelta() * 10, 10);
        }
    } else {
        if (expandTicks > 0) {
            expandTicks -= Math.max(event.getTickDelta() * 10, 10);
        }
    }
    int x2 = x + 4;
    if (expanded || expandTicks > 0) {
        ArrayList<Mod> modules = ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]);
        RenderSystem.enableScissor(x, y, x + width * 100, mc.getWindow().getScaledHeight());
        GlStateManager._scissorBox(168, 100, expandTicks, 10000);
        DrawableHelper.fill(matrices, x2 + width, y + (currentTab * 15), x2 + width * 2, y + (currentTab * 15) + ((ModuleManager.INSTANCE.getModulesInCategory(Category.values()[currentTab]).size() - 1) * 15) + height, new Color(0, 0, 0, 100).getRGB());
        DrawableHelper.fill(matrices, x + width + 3, y + currentTab * 15, x2 + width, y + modules.size() * 15 + currentTab * 15, ColorUtils.defaultClientColor);
        DrawableHelper.fill(matrices, x2 + 1 + width * 2, y - 1 + currentTab * 15, x2 - 1 + width, y + currentTab * 15, ColorUtils.defaultClientColor);
        DrawableHelper.fill(matrices, x + 3 + width, y + (currentTab * 15) + 1 + modules.size() * 15, x2 + width * 2, y + (currentTab * 15) + modules.size() * 15, ColorUtils.defaultClientColor);
        DrawableHelper.fill(matrices, x2 + width * 2, y + (currentTab * 15), x2 + width * 2 + 1, y + (currentTab * 15) + 1 + modules.size() * 15, ColorUtils.defaultClientColor);
        DrawableHelper.fill(matrices, x2 + width, y + (currentTab * 15) + animTicks2, x2 + width * 2, y + (currentTab * 15) + animTicks2 + height, ColorUtils.defaultClientColor);
        int modCount2 = 0;
        for (Mod mod : modules) {
            FontManager.robotoMed.drawWithShadow(matrices, mod.getName(), x2 + width + 4, y + 2 + (currentTab * 15) + modCount2, mod.isEnabled() ? ColorUtils.defaultClientColor : -1);
            modCount2 += 15;
        }
        RenderSystem.disableScissor();
    } else if (!expanded) {
    }
}
Also used : Category(dev.hypnotic.module.Category) Mod(dev.hypnotic.module.Mod) MatrixStack(net.minecraft.client.util.math.MatrixStack) Color(java.awt.Color) EventTarget(dev.hypnotic.event.EventTarget)

Example 85 with MatrixStack

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

the class Nametags method drawInv.

private void drawInv(LivingEntity player, float posX, float posY, EventRenderGUI eventRender2D) {
    int itemWidth = 16;
    int totalCount = getItems(player).size();
    float startX = (posX - ((totalCount * itemWidth) / 2.f));
    posY = (posY - 28);
    count = 0;
    for (ItemStack itemStack : getItems(player)) {
        if (!(itemStack.getItem() instanceof AirBlockItem)) {
            float newX = startX + (count * 16);
            RenderUtils.drawItem(itemStack, newX, posY);
            if (itemStack.hasEnchantments()) {
                float scale = 0.5f;
                MatrixStack matrixStack = eventRender2D.getMatrices();
                matrixStack.push();
                matrixStack.scale(scale, scale, 1);
                int enchCount = 1;
                for (NbtElement tag : itemStack.getEnchantments()) {
                    try {
                        NbtCompound compoundTag = (NbtCompound) tag;
                        float newY = ((posY - ((10 * scale) * enchCount) + 0.5f) / scale);
                        float newerX = (newX / scale);
                        String name = getEnchantName(compoundTag);
                        float nameWidth = font.getStringWidth(name);
                        RenderUtils.fill(eventRender2D.getMatrices(), newerX, newY - 1, newerX + nameWidth, newY + 9, 0x35000000);
                        font.draw(eventRender2D.getMatrices(), name, newerX, newY - 3, -1);
                        enchCount++;
                    } catch (Exception ignored) {
                    }
                }
                matrixStack.pop();
            }
            count++;
        }
    }
}
Also used : NbtCompound(net.minecraft.nbt.NbtCompound) MatrixStack(net.minecraft.client.util.math.MatrixStack) NbtElement(net.minecraft.nbt.NbtElement) ItemStack(net.minecraft.item.ItemStack) AirBlockItem(net.minecraft.item.AirBlockItem)

Aggregations

MatrixStack (net.minecraft.client.util.math.MatrixStack)99 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 Vec3d (net.minecraft.util.math.Vec3d)9 ItemStack (net.minecraft.item.ItemStack)8 Identifier (net.minecraft.util.Identifier)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 BlockEntity (net.minecraft.block.entity.BlockEntity)5