Подписывайтесь на наш Telegram и не пропускайте важные новости! Перейти

Исходник Включение элементов худа через чат | EvaWare 1.21.4

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
1 Авг 2024
Сообщения
447
Реакции
0
Выберите загрузчик игры
  1. Прочие моды
бля пацыки я честно не знаю нахуя, но это чето типа модно ща

1771250408615.png

анимашки есть


chatcontextmenu:
Expand Collapse Copy
package sweetie.evaware.client.ui;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import sweetie.evaware.client.ui.widget.WidgetManager;
import java.awt.Color;
import java.util.List;

public class ChatContextMenu {
    public static boolean visible = false;
    public static float x, y;

    private static float anim = 0f;
    private static final float WIDTH = 100;
    private static final float ELEMENT_HEIGHT = 18;

    public static void render(DrawContext context) {
        anim = MathHelper.lerp(0.05f, anim, visible ? 1f : 0f);
        if (anim < 0.001f) return;

        List<Widget> widgets = WidgetManager.getInstance().getWidgets();
        float totalHeight = widgets.size() * ELEMENT_HEIGHT + 4;

        context.getMatrices().push();

        float yOffset = (1f - anim) * 4f;
        context.getMatrices().translate(x, y - yOffset, 0);
        float scale = 0.98f + (anim * 0.02f);
        context.getMatrices().scale(scale, scale, 1f);
        context.getMatrices().translate(-x, -y, 0);

        int alpha = (int)(anim * 255);
        Color borderColor = new Color(122, 122, 122, alpha);
        Color bgColor = new Color(1, 0, 15, alpha);
        Color whiteWithAlpha = new Color(255, 255, 255, alpha);

        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x - 1, y - 1, WIDTH + 2, totalHeight + 2, 4f, borderColor, borderColor, borderColor, borderColor);
        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x, y, WIDTH, totalHeight, 3f, bgColor, bgColor, bgColor, bgColor);

        float currentY = y + 2;
        for (Widget widget : widgets) {
            float fontSize = 7.5f;

            Fonts.PS_BOLD.drawGradientText(context.getMatrices(), widget.getName(), x + 6, currentY + (ELEMENT_HEIGHT / 2f) - (fontSize / 2f), fontSize, whiteWithAlpha, whiteWithAlpha, WIDTH / 4f);

            float toggleState = widget.isEnabled() ? 1f : 0f;
            float swW = 16, swH = 8;
            float swX = x + WIDTH - swW - 6;
            float swY = currentY + (ELEMENT_HEIGHT - swH) / 2f;

            Color offColor = new Color(51, 51, 51, alpha);
            Color onColor = new Color(0, 227, 11, alpha);
            Color currentBg = interpolateColor(offColor, onColor, toggleState);

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), swX, swY, swW, swH, 3f,currentBg, currentBg, currentBg, currentBg);

            float dotSize = 6f;
            float padding = 1f;
            float dotX = swX + padding + (toggleState * (swW - dotSize - (padding * 2)));

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), dotX, swY + padding, dotSize, dotSize, 2f,whiteWithAlpha, whiteWithAlpha, whiteWithAlpha, whiteWithAlpha);

            currentY += ELEMENT_HEIGHT;
        }

        context.getMatrices().pop();
    }

    public static boolean mouseClicked(double mouseX, double mouseY, int button) {
        if (button == 1) {
            if (!visible) { x = (float) mouseX; y = (float) mouseY; }
            visible = !visible;
            return true;
        }

        if (visible && anim > 0.7f && button == 0) {
            List<Widget> widgets = WidgetManager.getInstance().getWidgets();
            float currentY = y + 2;
            for (Widget widget : widgets) {
                if (mouseX >= x && mouseX <= x + WIDTH && mouseY >= currentY && mouseY <= currentY + ELEMENT_HEIGHT) {
                    widget.setEnabled(!widget.isEnabled());
                    return true;
                }
                currentY += ELEMENT_HEIGHT;
            }
        }
        return false;
    }

    private static Color interpolateColor(Color c1, Color c2, float t) {
        int r = (int) (c1.getRed() + (c2.getRed() - c1.getRed()) * t);
        int g = (int) (c1.getGreen() + (c2.getGreen() - c1.getGreen()) * t);
        int b = (int) (c1.getBlue() + (c2.getBlue() - c1.getBlue()) * t);
        int a = (int) (c1.getAlpha() + (c2.getAlpha() - c1.getAlpha()) * t);
        return new Color(r, g, b, a);
    }
}

mixin:
Expand Collapse Copy
package sweetie.evaware.inject.client;


import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import sweetie.evaware.client.ui.ChatContextMenu;

@Mixin(ChatScreen.class)
public class MixinChatScreen {
    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        ChatContextMenu.render(context);
    }

    @Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
    private void onMouse(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
        if (ChatContextMenu.mouseClicked(mouseX, mouseY, button)) {
            cir.setReturnValue(true);
        }
    }

    @Inject(method = "removed", at = @At("HEAD"))
    private void onClosed(CallbackInfo ci) {
        ChatContextMenu.visible = false;
    }
}

с кодом намудрил пизда

с любофью!
 
я
бля пацыки я честно не знаю нахуя, но это чето типа модно ща

Посмотреть вложение 327812
анимашки есть


chatcontextmenu:
Expand Collapse Copy
package sweetie.evaware.client.ui;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import sweetie.evaware.client.ui.widget.WidgetManager;
import java.awt.Color;
import java.util.List;

public class ChatContextMenu {
    public static boolean visible = false;
    public static float x, y;

    private static float anim = 0f;
    private static final float WIDTH = 100;
    private static final float ELEMENT_HEIGHT = 18;

    public static void render(DrawContext context) {
        anim = MathHelper.lerp(0.05f, anim, visible ? 1f : 0f);
        if (anim < 0.001f) return;

        List<Widget> widgets = WidgetManager.getInstance().getWidgets();
        float totalHeight = widgets.size() * ELEMENT_HEIGHT + 4;

        context.getMatrices().push();

        float yOffset = (1f - anim) * 4f;
        context.getMatrices().translate(x, y - yOffset, 0);
        float scale = 0.98f + (anim * 0.02f);
        context.getMatrices().scale(scale, scale, 1f);
        context.getMatrices().translate(-x, -y, 0);

        int alpha = (int)(anim * 255);
        Color borderColor = new Color(122, 122, 122, alpha);
        Color bgColor = new Color(1, 0, 15, alpha);
        Color whiteWithAlpha = new Color(255, 255, 255, alpha);

        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x - 1, y - 1, WIDTH + 2, totalHeight + 2, 4f, borderColor, borderColor, borderColor, borderColor);
        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x, y, WIDTH, totalHeight, 3f, bgColor, bgColor, bgColor, bgColor);

        float currentY = y + 2;
        for (Widget widget : widgets) {
            float fontSize = 7.5f;

            Fonts.PS_BOLD.drawGradientText(context.getMatrices(), widget.getName(), x + 6, currentY + (ELEMENT_HEIGHT / 2f) - (fontSize / 2f), fontSize, whiteWithAlpha, whiteWithAlpha, WIDTH / 4f);

            float toggleState = widget.isEnabled() ? 1f : 0f;
            float swW = 16, swH = 8;
            float swX = x + WIDTH - swW - 6;
            float swY = currentY + (ELEMENT_HEIGHT - swH) / 2f;

            Color offColor = new Color(51, 51, 51, alpha);
            Color onColor = new Color(0, 227, 11, alpha);
            Color currentBg = interpolateColor(offColor, onColor, toggleState);

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), swX, swY, swW, swH, 3f,currentBg, currentBg, currentBg, currentBg);

            float dotSize = 6f;
            float padding = 1f;
            float dotX = swX + padding + (toggleState * (swW - dotSize - (padding * 2)));

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), dotX, swY + padding, dotSize, dotSize, 2f,whiteWithAlpha, whiteWithAlpha, whiteWithAlpha, whiteWithAlpha);

            currentY += ELEMENT_HEIGHT;
        }

        context.getMatrices().pop();
    }

    public static boolean mouseClicked(double mouseX, double mouseY, int button) {
        if (button == 1) {
            if (!visible) { x = (float) mouseX; y = (float) mouseY; }
            visible = !visible;
            return true;
        }

        if (visible && anim > 0.7f && button == 0) {
            List<Widget> widgets = WidgetManager.getInstance().getWidgets();
            float currentY = y + 2;
            for (Widget widget : widgets) {
                if (mouseX >= x && mouseX <= x + WIDTH && mouseY >= currentY && mouseY <= currentY + ELEMENT_HEIGHT) {
                    widget.setEnabled(!widget.isEnabled());
                    return true;
                }
                currentY += ELEMENT_HEIGHT;
            }
        }
        return false;
    }

    private static Color interpolateColor(Color c1, Color c2, float t) {
        int r = (int) (c1.getRed() + (c2.getRed() - c1.getRed()) * t);
        int g = (int) (c1.getGreen() + (c2.getGreen() - c1.getGreen()) * t);
        int b = (int) (c1.getBlue() + (c2.getBlue() - c1.getBlue()) * t);
        int a = (int) (c1.getAlpha() + (c2.getAlpha() - c1.getAlpha()) * t);
        return new Color(r, g, b, a);
    }
}

mixin:
Expand Collapse Copy
package sweetie.evaware.inject.client;


import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import sweetie.evaware.client.ui.ChatContextMenu;

@Mixin(ChatScreen.class)
public class MixinChatScreen {
    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        ChatContextMenu.render(context);
    }

    @Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
    private void onMouse(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
        if (ChatContextMenu.mouseClicked(mouseX, mouseY, button)) {
            cir.setReturnValue(true);
        }
    }

    @Inject(method = "removed", at = @At("HEAD"))
    private void onClosed(CallbackInfo ci) {
        ChatContextMenu.visible = false;
    }
}

с кодом намудрил пизда

с любофью!
через какой нахуй чат
 
ну типо а в чём была проблема взять ползунки из клик гуишки наебенить блюра оттуда или с худа и заебашить градиента вместо обристаного контура а так вырви глазно
 
бля пацыки я честно не знаю нахуя, но это чето типа модно ща

Посмотреть вложение 327812
анимашки есть


chatcontextmenu:
Expand Collapse Copy
package sweetie.evaware.client.ui;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import sweetie.evaware.client.ui.widget.WidgetManager;
import java.awt.Color;
import java.util.List;

public class ChatContextMenu {
    public static boolean visible = false;
    public static float x, y;

    private static float anim = 0f;
    private static final float WIDTH = 100;
    private static final float ELEMENT_HEIGHT = 18;

    public static void render(DrawContext context) {
        anim = MathHelper.lerp(0.05f, anim, visible ? 1f : 0f);
        if (anim < 0.001f) return;

        List<Widget> widgets = WidgetManager.getInstance().getWidgets();
        float totalHeight = widgets.size() * ELEMENT_HEIGHT + 4;

        context.getMatrices().push();

        float yOffset = (1f - anim) * 4f;
        context.getMatrices().translate(x, y - yOffset, 0);
        float scale = 0.98f + (anim * 0.02f);
        context.getMatrices().scale(scale, scale, 1f);
        context.getMatrices().translate(-x, -y, 0);

        int alpha = (int)(anim * 255);
        Color borderColor = new Color(122, 122, 122, alpha);
        Color bgColor = new Color(1, 0, 15, alpha);
        Color whiteWithAlpha = new Color(255, 255, 255, alpha);

        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x - 1, y - 1, WIDTH + 2, totalHeight + 2, 4f, borderColor, borderColor, borderColor, borderColor);
        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x, y, WIDTH, totalHeight, 3f, bgColor, bgColor, bgColor, bgColor);

        float currentY = y + 2;
        for (Widget widget : widgets) {
            float fontSize = 7.5f;

            Fonts.PS_BOLD.drawGradientText(context.getMatrices(), widget.getName(), x + 6, currentY + (ELEMENT_HEIGHT / 2f) - (fontSize / 2f), fontSize, whiteWithAlpha, whiteWithAlpha, WIDTH / 4f);

            float toggleState = widget.isEnabled() ? 1f : 0f;
            float swW = 16, swH = 8;
            float swX = x + WIDTH - swW - 6;
            float swY = currentY + (ELEMENT_HEIGHT - swH) / 2f;

            Color offColor = new Color(51, 51, 51, alpha);
            Color onColor = new Color(0, 227, 11, alpha);
            Color currentBg = interpolateColor(offColor, onColor, toggleState);

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), swX, swY, swW, swH, 3f,currentBg, currentBg, currentBg, currentBg);

            float dotSize = 6f;
            float padding = 1f;
            float dotX = swX + padding + (toggleState * (swW - dotSize - (padding * 2)));

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), dotX, swY + padding, dotSize, dotSize, 2f,whiteWithAlpha, whiteWithAlpha, whiteWithAlpha, whiteWithAlpha);

            currentY += ELEMENT_HEIGHT;
        }

        context.getMatrices().pop();
    }

    public static boolean mouseClicked(double mouseX, double mouseY, int button) {
        if (button == 1) {
            if (!visible) { x = (float) mouseX; y = (float) mouseY; }
            visible = !visible;
            return true;
        }

        if (visible && anim > 0.7f && button == 0) {
            List<Widget> widgets = WidgetManager.getInstance().getWidgets();
            float currentY = y + 2;
            for (Widget widget : widgets) {
                if (mouseX >= x && mouseX <= x + WIDTH && mouseY >= currentY && mouseY <= currentY + ELEMENT_HEIGHT) {
                    widget.setEnabled(!widget.isEnabled());
                    return true;
                }
                currentY += ELEMENT_HEIGHT;
            }
        }
        return false;
    }

    private static Color interpolateColor(Color c1, Color c2, float t) {
        int r = (int) (c1.getRed() + (c2.getRed() - c1.getRed()) * t);
        int g = (int) (c1.getGreen() + (c2.getGreen() - c1.getGreen()) * t);
        int b = (int) (c1.getBlue() + (c2.getBlue() - c1.getBlue()) * t);
        int a = (int) (c1.getAlpha() + (c2.getAlpha() - c1.getAlpha()) * t);
        return new Color(r, g, b, a);
    }
}

mixin:
Expand Collapse Copy
package sweetie.evaware.inject.client;


import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import sweetie.evaware.client.ui.ChatContextMenu;

@Mixin(ChatScreen.class)
public class MixinChatScreen {
    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        ChatContextMenu.render(context);
    }

    @Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
    private void onMouse(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
        if (ChatContextMenu.mouseClicked(mouseX, mouseY, button)) {
            cir.setReturnValue(true);
        }
    }

    @Inject(method = "removed", at = @At("HEAD"))
    private void onClosed(CallbackInfo ci) {
        ChatContextMenu.visible = false;
    }
}

с кодом намудрил пизда

с любофью!
что блять, нахуя?
 
бля пацыки я честно не знаю нахуя, но это чето типа модно ща

Посмотреть вложение 327812
анимашки есть


chatcontextmenu:
Expand Collapse Copy
package sweetie.evaware.client.ui;

import net.minecraft.client.gui.DrawContext;
import net.minecraft.util.math.MathHelper;
import sweetie.evaware.api.utils.render.RenderUtil;
import sweetie.evaware.api.utils.render.fonts.Fonts;
import sweetie.evaware.client.ui.widget.Widget;
import sweetie.evaware.client.ui.widget.WidgetManager;
import java.awt.Color;
import java.util.List;

public class ChatContextMenu {
    public static boolean visible = false;
    public static float x, y;

    private static float anim = 0f;
    private static final float WIDTH = 100;
    private static final float ELEMENT_HEIGHT = 18;

    public static void render(DrawContext context) {
        anim = MathHelper.lerp(0.05f, anim, visible ? 1f : 0f);
        if (anim < 0.001f) return;

        List<Widget> widgets = WidgetManager.getInstance().getWidgets();
        float totalHeight = widgets.size() * ELEMENT_HEIGHT + 4;

        context.getMatrices().push();

        float yOffset = (1f - anim) * 4f;
        context.getMatrices().translate(x, y - yOffset, 0);
        float scale = 0.98f + (anim * 0.02f);
        context.getMatrices().scale(scale, scale, 1f);
        context.getMatrices().translate(-x, -y, 0);

        int alpha = (int)(anim * 255);
        Color borderColor = new Color(122, 122, 122, alpha);
        Color bgColor = new Color(1, 0, 15, alpha);
        Color whiteWithAlpha = new Color(255, 255, 255, alpha);

        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x - 1, y - 1, WIDTH + 2, totalHeight + 2, 4f, borderColor, borderColor, borderColor, borderColor);
        RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), x, y, WIDTH, totalHeight, 3f, bgColor, bgColor, bgColor, bgColor);

        float currentY = y + 2;
        for (Widget widget : widgets) {
            float fontSize = 7.5f;

            Fonts.PS_BOLD.drawGradientText(context.getMatrices(), widget.getName(), x + 6, currentY + (ELEMENT_HEIGHT / 2f) - (fontSize / 2f), fontSize, whiteWithAlpha, whiteWithAlpha, WIDTH / 4f);

            float toggleState = widget.isEnabled() ? 1f : 0f;
            float swW = 16, swH = 8;
            float swX = x + WIDTH - swW - 6;
            float swY = currentY + (ELEMENT_HEIGHT - swH) / 2f;

            Color offColor = new Color(51, 51, 51, alpha);
            Color onColor = new Color(0, 227, 11, alpha);
            Color currentBg = interpolateColor(offColor, onColor, toggleState);

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), swX, swY, swW, swH, 3f,currentBg, currentBg, currentBg, currentBg);

            float dotSize = 6f;
            float padding = 1f;
            float dotX = swX + padding + (toggleState * (swW - dotSize - (padding * 2)));

            RenderUtil.GRADIENT_RECT.draw(context.getMatrices(), dotX, swY + padding, dotSize, dotSize, 2f,whiteWithAlpha, whiteWithAlpha, whiteWithAlpha, whiteWithAlpha);

            currentY += ELEMENT_HEIGHT;
        }

        context.getMatrices().pop();
    }

    public static boolean mouseClicked(double mouseX, double mouseY, int button) {
        if (button == 1) {
            if (!visible) { x = (float) mouseX; y = (float) mouseY; }
            visible = !visible;
            return true;
        }

        if (visible && anim > 0.7f && button == 0) {
            List<Widget> widgets = WidgetManager.getInstance().getWidgets();
            float currentY = y + 2;
            for (Widget widget : widgets) {
                if (mouseX >= x && mouseX <= x + WIDTH && mouseY >= currentY && mouseY <= currentY + ELEMENT_HEIGHT) {
                    widget.setEnabled(!widget.isEnabled());
                    return true;
                }
                currentY += ELEMENT_HEIGHT;
            }
        }
        return false;
    }

    private static Color interpolateColor(Color c1, Color c2, float t) {
        int r = (int) (c1.getRed() + (c2.getRed() - c1.getRed()) * t);
        int g = (int) (c1.getGreen() + (c2.getGreen() - c1.getGreen()) * t);
        int b = (int) (c1.getBlue() + (c2.getBlue() - c1.getBlue()) * t);
        int a = (int) (c1.getAlpha() + (c2.getAlpha() - c1.getAlpha()) * t);
        return new Color(r, g, b, a);
    }
}

mixin:
Expand Collapse Copy
package sweetie.evaware.inject.client;


import net.minecraft.client.gui.DrawContext;
import net.minecraft.client.gui.screen.ChatScreen;
import org.spongepowered.asm.mixin.Mixin;
import org.spongepowered.asm.mixin.injection.At;
import org.spongepowered.asm.mixin.injection.Inject;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfo;
import org.spongepowered.asm.mixin.injection.callback.CallbackInfoReturnable;
import sweetie.evaware.client.ui.ChatContextMenu;

@Mixin(ChatScreen.class)
public class MixinChatScreen {
    @Inject(method = "render", at = @At("TAIL"))
    private void onRender(DrawContext context, int mouseX, int mouseY, float delta, CallbackInfo ci) {
        ChatContextMenu.render(context);
    }

    @Inject(method = "mouseClicked", at = @At("HEAD"), cancellable = true)
    private void onMouse(double mouseX, double mouseY, int button, CallbackInfoReturnable<Boolean> cir) {
        if (ChatContextMenu.mouseClicked(mouseX, mouseY, button)) {
            cir.setReturnValue(true);
        }
    }

    @Inject(method = "removed", at = @At("HEAD"))
    private void onClosed(CallbackInfo ci) {
        ChatContextMenu.visible = false;
    }
}

с кодом намудрил пизда

с любофью!
Когда я посмотрел на ss, я захотел перенести проект на сурс евавара.
 
Назад
Сверху Снизу