Исходник Target HUD exp 3.1 ready

Начинающий
Статус
Оффлайн
Регистрация
27 Ноя 2023
Сообщения
16
Реакции[?]
1
Поинты[?]
1K
Забаненный
Статус
Оффлайн
Регистрация
2 Ноя 2024
Сообщения
136
Реакции[?]
0
Поинты[?]
0
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Просто таргет худ, первая работа так-что не пиздите
Если чо-то из утилок забыл то пишите

и оцените код если хотите

Пожалуйста, авторизуйтесь для просмотра ссылки.

targethud:
private final Animation animation = new EaseBackIn(400, 1.0, 1.0F);

   public void drawNewTargetHud(EventDisplay eventDisplay) {
        this.entity = this.getTarget(this.entity);
        boolean out = !this.allow || this.stopWatch.isReached(1000L);
        this.animation.setDuration(out ? 400 : 300);
        this.animation.setDirection(out ? Direction.BACKWARDS : Direction.FORWARDS);
        if (this.animation.getOutput() == 0.0) {
            this.entity = null;
        }

// -------------- yep ---------------- //

        if (this.entity != null) {
            String entityName = entity.getName().getString();
            Style style = Expensive.getInstance().getStyleManager().getCurrentStyle();

            float hp = entity.getHealth();
            float maxHp = entity.getMaxHealth();

            float width = 120.0F;
            float height = 40.0F;

            float fontWidth = Fonts.sfui.getWidth(entityName, 8.0F);
            float fontHeight = Fonts.sfui.getHeight(8.0F);

            float headSize = 30F;

            float healtBarWidth = 115.0F;
            float healtBarHeight = 2.5F;

            float space = 2.5F;

            drag.setWidth(width);
            drag.setHeight(height);

            float anyX = this.drag.getX();
            float anyY = this.drag.getY();

            sizeAnimation((anyX + width / 2.0F), (anyY + height / 2.0F), this.animation.getOutput());
            sizeAnimation((anyX + fontWidth / 2.0F), (anyY + fontHeight / 2.0F), this.animation.getOutput());

            healthAnimation = MathUtil.fast(healthAnimation, MathHelper.clamp(hp / maxHp, 0.0F, 1.0F), 10.0F);

            GlStateManager.pushMatrix();

            drawRoundedRect(
                    anyX,
                    anyY,
                    width,
                    height,
                    new Vector4f(
                            4.0F,
                            4.0F,
                            4.0F,
                            4.0F
                    )
            );

            // X + space для отступа

            anyX += space;


            Stencil.initStencilToWrite();

            DisplayUtils.drawRoundedRect(
                    anyX,
                    anyY + space,
                    headSize,
                    headSize,
                    1.5F,
                    style.getSecondColor().getRGB()
            );

            Stencil.readStencilBuffer(1);

            this.drawTargetHead(
                    this.entity,
                    anyX,
                    anyY + space,
                    headSize,
                    headSize
            );

            Stencil.uninitStencilBuffer();

            DisplayUtils.drawRoundedRect(
                    anyX,
                    anyY  + (height - space - (healtBarHeight)),
                    (healtBarWidth * this.healthAnimation),
                    healtBarHeight,
                    new Vector4f(
                            2.0F,
                            2.0F,
                            2.0F,
                            2.0F
                    ),
                    healtBarColor(hp, maxHp).getRGB()
            );

            DisplayUtils.drawShadow(
                    anyX,
                    anyY  + (height - space - (healtBarHeight)),
                    (healtBarWidth + space * this.healthAnimation),
                    healtBarHeight,
                    6,
                    healtBarColor(hp, maxHp).getRGB()
            );

            DisplayUtils.drawRoundedRect(
                    anyX,
                    anyY  + (height - space - (healtBarHeight)),
                    healtBarWidth,
                    healtBarHeight,
                    new Vector4f(
                            2.0F,
                            2.0F,
                            2.0F,
                            2.0F
                    ),
                    ColorUtils.rgba(10, 13, 15, 60)
            );

            anyX += (headSize + space);

            Scissor.push();
            Scissor.setFromComponentCoordinates(anyX, anyY, width - headSize - (space * 3), height);

            Fonts.sfui.drawText(
                    eventDisplay.getMatrixStack(),
                    entityName,
                    anyX,
                    anyY + ((height / 2) - (fontHeight / 2)),
                    ColorUtils.rgba(255, 255, 255, 200),
                    8.0F
                    );

            Scissor.unset();
            Scissor.pop();

            GlStateManager.popMatrix();
        }
    }

    public void drawRoundedRect(float x, float y, float width, float height, Vector4f radius) {

        DisplayUtils.drawRoundedRect(
                x - 1,
                y - 1,
                width + 2,
                height + 2,
                radius,
                ColorUtils.rgba(100, 100, 100, 100)
        ); // обводка если чо

        DisplayUtils.drawRoundedRect(
                x,
                y,
                width,
                height,
                radius,
                ColorUtils.setAlpha(ColorUtils.rgb(10, 15, 13), 60)
        );

        DisplayUtils.drawShadow(
                x - 2,
                y - 2,
                width + 4,
                height + 4,
                6,
                ColorUtils.setAlpha(ColorUtils.rgb(10, 15, 13), 60)
        );
    }

    public Color healtBarColor(float hp, float maxHp) {
            if (hp >= maxHp / 1.5) {
                return new Color(155, 223, 19, 150);
            } else if (hp >= maxHp / 2) {
                return new Color(221, 134, 21, 150);
            } else if (hp >= maxHp / 3) {
                return new Color(180, 19, 19, 150);
            }
        return new Color(255, 0, 0, 255);
    }

    public void drawTargetHead(LivingEntity entity, float x, float y, float width, float height) {
        if (entity != null) {
            EntityRenderer<? super LivingEntity> rendererManager = mc.getRenderManager().getRenderer(entity);
            this.drawFace(rendererManager.getEntityTexture(entity), x, y, 8.0F, 8.0F, 8.0F, 8.0F, width, height, 64.0F, 64.0F, entity);
            this.drawFace(rendererManager.getEntityTexture(entity), x, y, 104.0F, 8.0F, 8.0F, 8.0F, width, height, 64.0F, 64.0F, entity);
        }

    }

    public static void sizeAnimation(double width, double height, double scale) {
        GlStateManager.translated(
                width,
                height,
                0.0
        );
        GlStateManager.scaled(
                scale,
                scale,
                scale
        );
        GlStateManager.translated(
                -width,
                -height,
                0.0
        );
    }

    public void drawFace(ResourceLocation res, float d, float y, float u, float v, float uWidth, float vHeight, float width, float height, float tileWidth, float tileHeight, LivingEntity target) {

        GL11.glPushMatrix();
        GL11.glEnable(3042);
        mc.getTextureManager().bindTexture(res);
        float hurtPercent = ((float)target.hurtTime - (target.hurtTime != 0 ? mc.timer.renderPartialTicks : 0.0F)) / 10.0F;

        GL11.glColor4f(
                1.0F,
                1.0F - hurtPercent,
                1.0F - hurtPercent,
                1.0F
        );
        AbstractGui.drawScaledCustomSizeModalRect(
                d,
                y,
                u,
                v,
                uWidth,
                vHeight,
                width,
                height,
                tileWidth,
                tileHeight
        );
        GL11.glColor4f(1.0F, 1.0F, 1.0F, 1.0F);
        GL11.glPopMatrix();
    }
+-
 
Сверху Снизу