• Ищем качественного (не новичок) разработчиков Xenforo для этого форума! В идеале, чтобы ты был фулл стек программистом. Если у тебя есть что показать, то свяжись с нами по контактным данным: https://t.me/DREDD

Визуальная часть EatingIndicator как в wexide fabric 1.21 tunderhack

  • Автор темы Автор темы v1xes
  • Дата начала Дата начала
Начинающий
Начинающий
Статус
Оффлайн
Регистрация
2 Мар 2024
Сообщения
232
Реакции
1
Выберите загрузчик игры
  1. Fabric
идею взял у вексайда ну вроде норм получилось буду рад любой критики панчур ликуй 3 тема про тандерхрюк
клауди аи солюшен:
Expand Collapse Copy
package thunder.hack.features.modules.render;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.item.ItemStack;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.Vec3d;
import thunder.hack.events.impl.EventEatFood;
import thunder.hack.features.modules.Module;
import thunder.hack.features.modules.client.HudEditor;
import thunder.hack.setting.Setting;
import thunder.hack.utility.render.Render2DEngine;
import thunder.hack.utility.render.Render3DEngine;
import thunder.hack.utility.render.animation.AnimationUtility;
import thunder.hack.ThunderHack;

import java.awt.*;

public class EatingIndicator extends Module {

    private final Setting<Integer> animationSpeed = new Setting<>("AnimationSpeed", 15, 1, 30);
    private final Setting<Float> height = new Setting<>("Height", 0.5f, 0.1f, 3f);
    private final Setting<Float> scale = new Setting<>("Scale", 1f, 0.5f, 2f);
    private final Setting<Boolean> showItem = new Setting<>("ShowItem", true);

    private float width = 100;
    private float height_size = 25;

    // Animation variables
    private float vAnimation = 0, hAnimation = 0;
    private float contentAlpha = 1.0f;
    private float targetHeight = 0, targetWidth = 0;
    private boolean shouldShow = false;
    private long lastCheckTime = 0;
    private static final long CHECK_INTERVAL = 50;

    // Eating progress tracking
    private ItemStack currentEatingItem = null;
    private int eatingProgress = 0;
    private int maxEatingTime = 32;
    private long lastEatingUpdate = 0;

    public EatingIndicator() {
        super("EatingIndicator", Category.RENDER);
        ThunderHack.EVENT_BUS.subscribe(this);
    }

    [USER=1367676]@override[/USER]
    public void onEnable() {
        reset();
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        reset();
    }

    [USER=1367676]@override[/USER]
    public void onUpdate() {
        long currentTime = System.currentTimeMillis();
        if (currentTime - lastCheckTime > CHECK_INTERVAL) {
            updateVisibility();
            lastCheckTime = currentTime;
        }
    }

    private void updateVisibility() {
        // Check if player is eating
        shouldShow = false;
        if (mc.player != null) {
            ItemStack activeItem = mc.player.getActiveItem();
            if (!activeItem.isEmpty() && mc.player.isUsingItem()) {
                UseAction useAction = activeItem.getUseAction();
                if (useAction == UseAction.EAT || useAction == UseAction.DRINK) {
                    shouldShow = true;
                    currentEatingItem = activeItem.copy();
                    int useTime = mc.player.getItemUseTime();
                    eatingProgress = Math.min(useTime, maxEatingTime);
                    lastEatingUpdate = System.currentTimeMillis();
                }
            }
        }

        if (!shouldShow && System.currentTimeMillis() - lastEatingUpdate > 500) {
            currentEatingItem = null;
            eatingProgress = 0;
        }
    }

    public void onEatFood(EventEatFood event) {
        if (event.getFood() != null && currentEatingItem != null &&
                event.getFood().getItem() == currentEatingItem.getItem()) {
            currentEatingItem = null;
            eatingProgress = 0;
            shouldShow = false;
        }
    }

    public void onRender2D(DrawContext context) {
        if (mc.player == null || mc.options.hudHidden) return;

        targetWidth = width * scale.getValue();
        targetHeight = height_size * scale.getValue();

        // Animation
        if (shouldShow) {
            contentAlpha = AnimationUtility.fast(contentAlpha, 1.0f, animationSpeed.getValue() * 1.5f);
        } else {
            contentAlpha = AnimationUtility.fast(contentAlpha, 0.0f, animationSpeed.getValue() * 1.5f);
        }

        if (shouldShow) {
            vAnimation = AnimationUtility.fast(vAnimation, targetHeight, animationSpeed.getValue());
            hAnimation = AnimationUtility.fast(hAnimation, targetWidth, animationSpeed.getValue());
        } else {
            if (contentAlpha < 0.1f) {
                vAnimation = AnimationUtility.fast(vAnimation, 0, animationSpeed.getValue());
                hAnimation = AnimationUtility.fast(hAnimation, 0, animationSpeed.getValue());
            }
        }

        if (vAnimation <= 1 || hAnimation <= 1) return;

        // Get player position
        double x = mc.player.prevX + (mc.player.getX() - mc.player.prevX) * Render3DEngine.getTickDelta();
        double y = mc.player.prevY + (mc.player.getY() - mc.player.prevY) * Render3DEngine.getTickDelta();
        double z = mc.player.prevZ + (mc.player.getZ() - mc.player.prevZ) * Render3DEngine.getTickDelta();

        Vec3d vector = new Vec3d(x, y - height.getValue(), z);
        vector = Render3DEngine.worldSpaceToScreenSpace(vector);

        if (vector.z > 0 && vector.z < 1) {
            renderEatingIndicator(context, vector);
        }
    }

    private void renderEatingIndicator(DrawContext context, Vec3d screenPos) {
        float centerX = (float) screenPos.x;
        float centerY = (float) screenPos.y;

        float drawPosX = centerX - hAnimation / 2;
        float drawPosY = centerY - vAnimation / 2;

        // Draw background with HUD style
        Render2DEngine.drawHudBase(context.getMatrices(), drawPosX, drawPosY, hAnimation, vAnimation, HudEditor.hudRound.getValue());

        // Draw content with alpha
        if (contentAlpha > 0.01f && currentEatingItem != null) {
            Render2DEngine.addWindow(context.getMatrices(), drawPosX, drawPosY, drawPosX + hAnimation, drawPosY + vAnimation, contentAlpha);

            // Draw item icon if enabled
            if (showItem.getValue()) {
                float iconY = drawPosY + 4;
                context.getMatrices().push();
                context.getMatrices().translate(drawPosX + 4, iconY, 0);
                context.getMatrices().scale(scale.getValue(), scale.getValue(), 1.0f);

                float[] color = {1.0f, 1.0f, 1.0f, contentAlpha};
                context.setShaderColor(color[0], color[1], color[2], color[3]);

                DiffuseLighting.enableGuiDepthLighting();
                context.drawItem(currentEatingItem, 0, 0);

                if (currentEatingItem.getCount() > 1) {
                    context.drawItemInSlot(mc.textRenderer, currentEatingItem, 0, 0);
                }
                DiffuseLighting.disableGuiDepthLighting();

                context.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
                context.getMatrices().pop();

                // Render progress bar with item offset
                renderProgressBar(context, iconY, drawPosX + 22, contentAlpha, hAnimation - 26);
            } else {
                // Render progress bar without item offset
                renderProgressBar(context, drawPosY + 4, drawPosX + 4, contentAlpha, hAnimation - 8);
            }

            Render2DEngine.popWindow();
        }
    }

    private void renderProgressBar(DrawContext context, float iconY, float barX, float alpha, float barWidth) {
        float progressPercent = maxEatingTime > 0 ? (float) eatingProgress / maxEatingTime : 0.0f;
        progressPercent = Math.min(1.0f, Math.max(0.0f, progressPercent));

        float barY = iconY + 6;
        float barHeight = 6 * scale.getValue();

        // Progress bar background - using same style as EatingProgress
        Color darkColor = HudEditor.getColor(90).darker().darker().darker();
        Color darkColor2 = HudEditor.getColor(180).darker().darker().darker();
        Color darkColor3 = HudEditor.getColor(0).darker().darker().darker();
        Color darkColor4 = HudEditor.getColor(270).darker().darker().darker();

        Color alphaDarkColor = new Color(darkColor.getRed(), darkColor.getGreen(), darkColor.getBlue(), (int)(darkColor.getAlpha() * alpha));
        Color alphaDarkColor2 = new Color(darkColor2.getRed(), darkColor2.getGreen(), darkColor2.getBlue(), (int)(darkColor2.getAlpha() * alpha));
        Color alphaDarkColor3 = new Color(darkColor3.getRed(), darkColor3.getGreen(), darkColor3.getBlue(), (int)(darkColor3.getAlpha() * alpha));
        Color alphaDarkColor4 = new Color(darkColor4.getRed(), darkColor4.getGreen(), darkColor4.getBlue(), (int)(darkColor4.getAlpha() * alpha));

        Render2DEngine.drawGradientRound(
                context.getMatrices(),
                barX,
                barY,
                barWidth,
                barHeight,
                2.0f,
                alphaDarkColor,
                alphaDarkColor2,
                alphaDarkColor3,
                alphaDarkColor4
        );

        // Progress bar fill - same style as EatingProgress
        if (progressPercent > 0) {
            if (HudEditor.hudStyle.is(HudEditor.HudStyle.Blurry)) {
                Render2DEngine.drawRect(
                        context.getMatrices(),
                        barX,
                        barY,
                        barWidth * progressPercent,
                        barHeight,
                        2.0f,
                        alpha
                );
            } else {
                Color gradColor1 = new Color(34, 139, 34);
                Color gradColor2 = new Color(255, 215, 0);

                Color alphaGradColor1 = new Color(
                        gradColor1.getRed(),
                        gradColor1.getGreen(),
                        gradColor1.getBlue(),
                        (int)(255 * alpha)
                );

                Color alphaGradColor2 = new Color(
                        gradColor2.getRed(),
                        gradColor2.getGreen(),
                        gradColor2.getBlue(),
                        (int)(255 * alpha)
                );

                Render2DEngine.renderRoundedGradientRect(
                        context.getMatrices(),
                        alphaGradColor1,
                        alphaGradColor2,
                        alphaGradColor2,
                        alphaGradColor1,
                        barX,
                        barY,
                        (int) (barWidth * progressPercent),
                        (int) barHeight,
                        2.0f
                );
            }
        }
    }

    private void reset() {
        currentEatingItem = null;
        eatingProgress = 0;
        shouldShow = false;
        lastEatingUpdate = 0;
    }
}
 

Вложения

  • 1748467023534.png
    1748467023534.png
    2.2 MB · Просмотры: 527
пока модеры одобрят летов из тойги выйдет
 
идею взял у вексайда ну вроде норм получилось буду рад любой критики панчур ликуй 3 тема про тандерхрюк
клауди аи солюшен:
Expand Collapse Copy
package thunder.hack.features.modules.render;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.render.DiffuseLighting;
import net.minecraft.item.ItemStack;
import net.minecraft.util.UseAction;
import net.minecraft.util.math.Vec3d;
import thunder.hack.events.impl.EventEatFood;
import thunder.hack.features.modules.Module;
import thunder.hack.features.modules.client.HudEditor;
import thunder.hack.setting.Setting;
import thunder.hack.utility.render.Render2DEngine;
import thunder.hack.utility.render.Render3DEngine;
import thunder.hack.utility.render.animation.AnimationUtility;
import thunder.hack.ThunderHack;

import java.awt.*;

public class EatingIndicator extends Module {

    private final Setting<Integer> animationSpeed = new Setting<>("AnimationSpeed", 15, 1, 30);
    private final Setting<Float> height = new Setting<>("Height", 0.5f, 0.1f, 3f);
    private final Setting<Float> scale = new Setting<>("Scale", 1f, 0.5f, 2f);
    private final Setting<Boolean> showItem = new Setting<>("ShowItem", true);

    private float width = 100;
    private float height_size = 25;

    // Animation variables
    private float vAnimation = 0, hAnimation = 0;
    private float contentAlpha = 1.0f;
    private float targetHeight = 0, targetWidth = 0;
    private boolean shouldShow = false;
    private long lastCheckTime = 0;
    private static final long CHECK_INTERVAL = 50;

    // Eating progress tracking
    private ItemStack currentEatingItem = null;
    private int eatingProgress = 0;
    private int maxEatingTime = 32;
    private long lastEatingUpdate = 0;

    public EatingIndicator() {
        super("EatingIndicator", Category.RENDER);
        ThunderHack.EVENT_BUS.subscribe(this);
    }

    [USER=1367676]@override[/USER]
    public void onEnable() {
        reset();
    }

    [USER=1367676]@override[/USER]
    public void onDisable() {
        reset();
    }

    [USER=1367676]@override[/USER]
    public void onUpdate() {
        long currentTime = System.currentTimeMillis();
        if (currentTime - lastCheckTime > CHECK_INTERVAL) {
            updateVisibility();
            lastCheckTime = currentTime;
        }
    }

    private void updateVisibility() {
        // Check if player is eating
        shouldShow = false;
        if (mc.player != null) {
            ItemStack activeItem = mc.player.getActiveItem();
            if (!activeItem.isEmpty() && mc.player.isUsingItem()) {
                UseAction useAction = activeItem.getUseAction();
                if (useAction == UseAction.EAT || useAction == UseAction.DRINK) {
                    shouldShow = true;
                    currentEatingItem = activeItem.copy();
                    int useTime = mc.player.getItemUseTime();
                    eatingProgress = Math.min(useTime, maxEatingTime);
                    lastEatingUpdate = System.currentTimeMillis();
                }
            }
        }

        if (!shouldShow && System.currentTimeMillis() - lastEatingUpdate > 500) {
            currentEatingItem = null;
            eatingProgress = 0;
        }
    }

    public void onEatFood(EventEatFood event) {
        if (event.getFood() != null && currentEatingItem != null &&
                event.getFood().getItem() == currentEatingItem.getItem()) {
            currentEatingItem = null;
            eatingProgress = 0;
            shouldShow = false;
        }
    }

    public void onRender2D(DrawContext context) {
        if (mc.player == null || mc.options.hudHidden) return;

        targetWidth = width * scale.getValue();
        targetHeight = height_size * scale.getValue();

        // Animation
        if (shouldShow) {
            contentAlpha = AnimationUtility.fast(contentAlpha, 1.0f, animationSpeed.getValue() * 1.5f);
        } else {
            contentAlpha = AnimationUtility.fast(contentAlpha, 0.0f, animationSpeed.getValue() * 1.5f);
        }

        if (shouldShow) {
            vAnimation = AnimationUtility.fast(vAnimation, targetHeight, animationSpeed.getValue());
            hAnimation = AnimationUtility.fast(hAnimation, targetWidth, animationSpeed.getValue());
        } else {
            if (contentAlpha < 0.1f) {
                vAnimation = AnimationUtility.fast(vAnimation, 0, animationSpeed.getValue());
                hAnimation = AnimationUtility.fast(hAnimation, 0, animationSpeed.getValue());
            }
        }

        if (vAnimation <= 1 || hAnimation <= 1) return;

        // Get player position
        double x = mc.player.prevX + (mc.player.getX() - mc.player.prevX) * Render3DEngine.getTickDelta();
        double y = mc.player.prevY + (mc.player.getY() - mc.player.prevY) * Render3DEngine.getTickDelta();
        double z = mc.player.prevZ + (mc.player.getZ() - mc.player.prevZ) * Render3DEngine.getTickDelta();

        Vec3d vector = new Vec3d(x, y - height.getValue(), z);
        vector = Render3DEngine.worldSpaceToScreenSpace(vector);

        if (vector.z > 0 && vector.z < 1) {
            renderEatingIndicator(context, vector);
        }
    }

    private void renderEatingIndicator(DrawContext context, Vec3d screenPos) {
        float centerX = (float) screenPos.x;
        float centerY = (float) screenPos.y;

        float drawPosX = centerX - hAnimation / 2;
        float drawPosY = centerY - vAnimation / 2;

        // Draw background with HUD style
        Render2DEngine.drawHudBase(context.getMatrices(), drawPosX, drawPosY, hAnimation, vAnimation, HudEditor.hudRound.getValue());

        // Draw content with alpha
        if (contentAlpha > 0.01f && currentEatingItem != null) {
            Render2DEngine.addWindow(context.getMatrices(), drawPosX, drawPosY, drawPosX + hAnimation, drawPosY + vAnimation, contentAlpha);

            // Draw item icon if enabled
            if (showItem.getValue()) {
                float iconY = drawPosY + 4;
                context.getMatrices().push();
                context.getMatrices().translate(drawPosX + 4, iconY, 0);
                context.getMatrices().scale(scale.getValue(), scale.getValue(), 1.0f);

                float[] color = {1.0f, 1.0f, 1.0f, contentAlpha};
                context.setShaderColor(color[0], color[1], color[2], color[3]);

                DiffuseLighting.enableGuiDepthLighting();
                context.drawItem(currentEatingItem, 0, 0);

                if (currentEatingItem.getCount() > 1) {
                    context.drawItemInSlot(mc.textRenderer, currentEatingItem, 0, 0);
                }
                DiffuseLighting.disableGuiDepthLighting();

                context.setShaderColor(1.0f, 1.0f, 1.0f, 1.0f);
                context.getMatrices().pop();

                // Render progress bar with item offset
                renderProgressBar(context, iconY, drawPosX + 22, contentAlpha, hAnimation - 26);
            } else {
                // Render progress bar without item offset
                renderProgressBar(context, drawPosY + 4, drawPosX + 4, contentAlpha, hAnimation - 8);
            }

            Render2DEngine.popWindow();
        }
    }

    private void renderProgressBar(DrawContext context, float iconY, float barX, float alpha, float barWidth) {
        float progressPercent = maxEatingTime > 0 ? (float) eatingProgress / maxEatingTime : 0.0f;
        progressPercent = Math.min(1.0f, Math.max(0.0f, progressPercent));

        float barY = iconY + 6;
        float barHeight = 6 * scale.getValue();

        // Progress bar background - using same style as EatingProgress
        Color darkColor = HudEditor.getColor(90).darker().darker().darker();
        Color darkColor2 = HudEditor.getColor(180).darker().darker().darker();
        Color darkColor3 = HudEditor.getColor(0).darker().darker().darker();
        Color darkColor4 = HudEditor.getColor(270).darker().darker().darker();

        Color alphaDarkColor = new Color(darkColor.getRed(), darkColor.getGreen(), darkColor.getBlue(), (int)(darkColor.getAlpha() * alpha));
        Color alphaDarkColor2 = new Color(darkColor2.getRed(), darkColor2.getGreen(), darkColor2.getBlue(), (int)(darkColor2.getAlpha() * alpha));
        Color alphaDarkColor3 = new Color(darkColor3.getRed(), darkColor3.getGreen(), darkColor3.getBlue(), (int)(darkColor3.getAlpha() * alpha));
        Color alphaDarkColor4 = new Color(darkColor4.getRed(), darkColor4.getGreen(), darkColor4.getBlue(), (int)(darkColor4.getAlpha() * alpha));

        Render2DEngine.drawGradientRound(
                context.getMatrices(),
                barX,
                barY,
                barWidth,
                barHeight,
                2.0f,
                alphaDarkColor,
                alphaDarkColor2,
                alphaDarkColor3,
                alphaDarkColor4
        );

        // Progress bar fill - same style as EatingProgress
        if (progressPercent > 0) {
            if (HudEditor.hudStyle.is(HudEditor.HudStyle.Blurry)) {
                Render2DEngine.drawRect(
                        context.getMatrices(),
                        barX,
                        barY,
                        barWidth * progressPercent,
                        barHeight,
                        2.0f,
                        alpha
                );
            } else {
                Color gradColor1 = new Color(34, 139, 34);
                Color gradColor2 = new Color(255, 215, 0);

                Color alphaGradColor1 = new Color(
                        gradColor1.getRed(),
                        gradColor1.getGreen(),
                        gradColor1.getBlue(),
                        (int)(255 * alpha)
                );

                Color alphaGradColor2 = new Color(
                        gradColor2.getRed(),
                        gradColor2.getGreen(),
                        gradColor2.getBlue(),
                        (int)(255 * alpha)
                );

                Render2DEngine.renderRoundedGradientRect(
                        context.getMatrices(),
                        alphaGradColor1,
                        alphaGradColor2,
                        alphaGradColor2,
                        alphaGradColor1,
                        barX,
                        barY,
                        (int) (barWidth * progressPercent),
                        (int) barHeight,
                        2.0f
                );
            }
        }
    }

    private void reset() {
        currentEatingItem = null;
        eatingProgress = 0;
        shouldShow = false;
        lastEatingUpdate = 0;
    }
}
чат гпт?
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
гепете
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
второй тх реди, прогресс
 
уф пастеры уже и до бедного тандерхака дошли
 
Наконец то пастеры слезают с экспенсива и насилуют то что уже и так давно трахнуто!
 
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
панчур 2 реди тандерхак,пастеры слезли с 3.1
 
Назад
Сверху Снизу