Исходник Main menu expensive 3.1

Начинающий
Статус
Оффлайн
Регистрация
5 Апр 2024
Сообщения
46
Реакции[?]
1
Поинты[?]
0
Хуево, я знаю, первая работа, так получилось
Я пидор:
package im.furious.ui.mainmenu;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.furious.Furious;
import im.furious.functions.impl.render.HUD;
import im.furious.ui.styles.Style;
import im.furious.utils.client.ClientUtil;
import im.furious.utils.client.IMinecraft;
import im.furious.utils.client.Vec2i;
import im.furious.utils.math.MathUtil;
import im.furious.utils.math.StopWatch;
import im.furious.utils.math.Vector4i;
import im.furious.utils.render.ColorUtils;
import im.furious.utils.render.DisplayUtils;
import im.furious.utils.render.KawaseBlur;
import im.furious.utils.render.Stencil;
import im.furious.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;


public class MainScreen extends Screen implements IMinecraft {
    public MainScreen() {
        super(ITextComponent.getTextComponentOrEmpty(""));

    }

    private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        float widthButton = 225 / 2f;


        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float x = ClientUtil.calc(width) / 1f - widthButton / 1f;
        float y = Math.round(ClientUtil.calc(height) / 2.50f + 1);
        buttons.clear();

        buttons.add(new Button(x, y, widthButton, 34 / 2f, "одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "сетевая игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "настройки", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "выход", mc::shutdownMinecraftApplet));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
        Furious.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
        return super.mouseScrolled(mouseX, mouseY, delta);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        if (stopWatch.isReached(100)) {
            particles.add(new Particle());
            stopWatch.reset();
        }
        MainWindow mainWindow = mc.getMainWindow();
        int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
        int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());

        int logoWidth = 1920 / 2;
        int logoHeight = 1080 / 2;

        // Расчет координат для рисования логотипа по центру
        int xLogo = (windowWidth - logoWidth) / 2;
        int yLogo = (windowHeight - logoHeight) / 2 + 50;
        boolean small = mainWindow.getWidth() < 900 && mainWindow.getHeight() < 900;
        if (small) {
            yLogo += 50;
        }
        // Рисование логотипа по центру
        DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
        mc.gameRenderer.setupOverlayRendering(2);

        KawaseBlur.blur.updateBlur(3, 4);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);

        Furious.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
        mc.gameRenderer.setupOverlayRendering();

    }

    @Override
    public boolean charTyped(char codePoint, int modifiers) {
        Furious.getInstance().getAltWidget().onChar(codePoint);
        return super.charTyped(codePoint, modifiers);
    }

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        Furious.getInstance().getAltWidget().onKey(keyCode);
        return false;
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
        buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
        Furious.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawStyledRect(MatrixStack stack, float x, float y, float width, float height, float radius) {
        Vector4i colors = new Vector4i(HUD.getColor(0, 1), HUD.getColor(90, 1), HUD.getColor(180, 1), HUD.getColor(270, 1));
        DisplayUtils.drawRoundedRect(x - 1.5f, y - 1.5f, width + 10f, height + 10f, new Vector4f(7, 7, 7, 7), colors);
        DisplayUtils.drawRoundedRect(x, y, width, height, radius - 0.5f, ColorUtils.rgba(21, 21, 21, 255));
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> {
            // Рассчитываем координаты и размеры кнопки
            float x = b.getX();
            float y = b.getY();
            float width = b.getWidth();
            float height = b.getHeight();
            float radius = 10; // Радиус скругления углов

            // Отрисовываем стилизованную кнопку
            drawStyledRect(stack, x, y, width, height + 3, radius + 0);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();

            // Отрисовываем тень
            int shadowColor = ColorUtils.rgba(0, 0, 0, 150);
            DisplayUtils.drawShadow(x + 15, y + 15, width, height, 10, shadowColor, shadowColor);

            // Отрисовываем текст на кнопке
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mX, mY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, b.getText(), x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
        });
    }

    public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

    private class Particle {

        private final float x;
        private float y;
        private float size;

        public Particle() {
            x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
            y = 0;
            size = 0;
        }

        public void update() {
            y += 1f;
        }

        public void render(MatrixStack stack) {
            //update();
            size += 0.1f;
            GlStateManager.pushMatrix();
            GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
            GlStateManager.rotatef(size * 20, 0, 0, 1);
            GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
            float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
            y += 1;
            Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 4, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }

    }

    @AllArgsConstructor
    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public String getText() {
            return text;
        }

        @Subscribe
        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 5, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            KawaseBlur.blur.BLURRED.draw();
            Stencil.uninitStencilBuffer();

            DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);

            // Рисование тени
            int posX = Math.round(x);
            int posY = Math.round(y);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();
            DisplayUtils.drawShadow(posX, posY, width, height, 30, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
мои глаза...
 
Начинающий
Статус
Оффлайн
Регистрация
29 Сен 2021
Сообщения
80
Реакции[?]
0
Поинты[?]
0
Хуево, я знаю, первая работа, так получилось
Я пидор:
package im.furious.ui.mainmenu;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.furious.Furious;
import im.furious.functions.impl.render.HUD;
import im.furious.ui.styles.Style;
import im.furious.utils.client.ClientUtil;
import im.furious.utils.client.IMinecraft;
import im.furious.utils.client.Vec2i;
import im.furious.utils.math.MathUtil;
import im.furious.utils.math.StopWatch;
import im.furious.utils.math.Vector4i;
import im.furious.utils.render.ColorUtils;
import im.furious.utils.render.DisplayUtils;
import im.furious.utils.render.KawaseBlur;
import im.furious.utils.render.Stencil;
import im.furious.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;


public class MainScreen extends Screen implements IMinecraft {
    public MainScreen() {
        super(ITextComponent.getTextComponentOrEmpty(""));

    }

    private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        float widthButton = 225 / 2f;


        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float x = ClientUtil.calc(width) / 1f - widthButton / 1f;
        float y = Math.round(ClientUtil.calc(height) / 2.50f + 1);
        buttons.clear();

        buttons.add(new Button(x, y, widthButton, 34 / 2f, "одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "сетевая игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "настройки", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "выход", mc::shutdownMinecraftApplet));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
        Furious.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
        return super.mouseScrolled(mouseX, mouseY, delta);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        if (stopWatch.isReached(100)) {
            particles.add(new Particle());
            stopWatch.reset();
        }
        MainWindow mainWindow = mc.getMainWindow();
        int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
        int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());

        int logoWidth = 1920 / 2;
        int logoHeight = 1080 / 2;

        // Расчет координат для рисования логотипа по центру
        int xLogo = (windowWidth - logoWidth) / 2;
        int yLogo = (windowHeight - logoHeight) / 2 + 50;
        boolean small = mainWindow.getWidth() < 900 && mainWindow.getHeight() < 900;
        if (small) {
            yLogo += 50;
        }
        // Рисование логотипа по центру
        DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
        mc.gameRenderer.setupOverlayRendering(2);

        KawaseBlur.blur.updateBlur(3, 4);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);

        Furious.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
        mc.gameRenderer.setupOverlayRendering();

    }

    @Override
    public boolean charTyped(char codePoint, int modifiers) {
        Furious.getInstance().getAltWidget().onChar(codePoint);
        return super.charTyped(codePoint, modifiers);
    }

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        Furious.getInstance().getAltWidget().onKey(keyCode);
        return false;
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
        buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
        Furious.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawStyledRect(MatrixStack stack, float x, float y, float width, float height, float radius) {
        Vector4i colors = new Vector4i(HUD.getColor(0, 1), HUD.getColor(90, 1), HUD.getColor(180, 1), HUD.getColor(270, 1));
        DisplayUtils.drawRoundedRect(x - 1.5f, y - 1.5f, width + 10f, height + 10f, new Vector4f(7, 7, 7, 7), colors);
        DisplayUtils.drawRoundedRect(x, y, width, height, radius - 0.5f, ColorUtils.rgba(21, 21, 21, 255));
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> {
            // Рассчитываем координаты и размеры кнопки
            float x = b.getX();
            float y = b.getY();
            float width = b.getWidth();
            float height = b.getHeight();
            float radius = 10; // Радиус скругления углов

            // Отрисовываем стилизованную кнопку
            drawStyledRect(stack, x, y, width, height + 3, radius + 0);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();

            // Отрисовываем тень
            int shadowColor = ColorUtils.rgba(0, 0, 0, 150);
            DisplayUtils.drawShadow(x + 15, y + 15, width, height, 10, shadowColor, shadowColor);

            // Отрисовываем текст на кнопке
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mX, mY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, b.getText(), x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
        });
    }

    public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

    private class Particle {

        private final float x;
        private float y;
        private float size;

        public Particle() {
            x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
            y = 0;
            size = 0;
        }

        public void update() {
            y += 1f;
        }

        public void render(MatrixStack stack) {
            //update();
            size += 0.1f;
            GlStateManager.pushMatrix();
            GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
            GlStateManager.rotatef(size * 20, 0, 0, 1);
            GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
            float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
            y += 1;
            Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 4, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }

    }

    @AllArgsConstructor
    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public String getText() {
            return text;
        }

        @Subscribe
        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 5, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            KawaseBlur.blur.BLURRED.draw();
            Stencil.uninitStencilBuffer();

            DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);

            // Рисование тени
            int posX = Math.round(x);
            int posY = Math.round(y);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();
            DisplayUtils.drawShadow(posX, posY, width, height, 30, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
ЧТО ЕТО ГАХУЙ???? ТЫ ЧЕ НАХУЙ СЕЛАЛ С МЕЙН МЕНЮ У МЕ Я ГЛАЗНЫЕ ЯБЛКИ ВЫППАИЛ???
 
Read Only
Статус
Оффлайн
Регистрация
31 Июл 2023
Сообщения
227
Реакции[?]
1
Поинты[?]
1K
убейся, это хуета полнейшая
Хуево, я знаю, первая работа, так получилось
Я пидор:
package im.furious.ui.mainmenu;

import com.google.common.eventbus.Subscribe;
import com.mojang.blaze3d.matrix.MatrixStack;
import com.mojang.blaze3d.platform.GlStateManager;
import im.furious.Furious;
import im.furious.functions.impl.render.HUD;
import im.furious.ui.styles.Style;
import im.furious.utils.client.ClientUtil;
import im.furious.utils.client.IMinecraft;
import im.furious.utils.client.Vec2i;
import im.furious.utils.math.MathUtil;
import im.furious.utils.math.StopWatch;
import im.furious.utils.math.Vector4i;
import im.furious.utils.render.ColorUtils;
import im.furious.utils.render.DisplayUtils;
import im.furious.utils.render.KawaseBlur;
import im.furious.utils.render.Stencil;
import im.furious.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.MainWindow;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.MultiplayerScreen;
import net.minecraft.client.gui.screen.OptionsScreen;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.WorldSelectionScreen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.MathHelper;
import net.minecraft.util.math.vector.Vector4f;
import net.minecraft.util.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.concurrent.ThreadLocalRandom;


public class MainScreen extends Screen implements IMinecraft {
    public MainScreen() {
        super(ITextComponent.getTextComponentOrEmpty(""));

    }

    private final ResourceLocation backmenu = new ResourceLocation("expensive/images/backmenu.png");
    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        float widthButton = 225 / 2f;


        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float x = ClientUtil.calc(width) / 1f - widthButton / 1f;
        float y = Math.round(ClientUtil.calc(height) / 2.50f + 1);
        buttons.clear();

        buttons.add(new Button(x, y, widthButton, 34 / 2f, "одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "сетевая игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "настройки", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f + 7;
        buttons.add(new Button(x, y, widthButton, 34 / 2f, "выход", mc::shutdownMinecraftApplet));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();

    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double delta) {
        Furious.getInstance().getAltWidget().updateScroll((int) mouseX, (int) mouseY, (float) delta);
        return super.mouseScrolled(mouseX, mouseY, delta);
    }

    @Override
    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        super.render(matrixStack, mouseX, mouseY, partialTicks);
        if (stopWatch.isReached(100)) {
            particles.add(new Particle());
            stopWatch.reset();
        }
        MainWindow mainWindow = mc.getMainWindow();
        int windowWidth = ClientUtil.calc(mainWindow.getScaledWidth());
        int windowHeight = ClientUtil.calc(mainWindow.getScaledHeight());

        int logoWidth = 1920 / 2;
        int logoHeight = 1080 / 2;

        // Расчет координат для рисования логотипа по центру
        int xLogo = (windowWidth - logoWidth) / 2;
        int yLogo = (windowHeight - logoHeight) / 2 + 50;
        boolean small = mainWindow.getWidth() < 900 && mainWindow.getHeight() < 900;
        if (small) {
            yLogo += 50;
        }
        // Рисование логотипа по центру
        DisplayUtils.drawImage(backmenu, 0, 0, width, height, -1);
        mc.gameRenderer.setupOverlayRendering(2);

        KawaseBlur.blur.updateBlur(3, 4);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);

        Furious.getInstance().getAltWidget().render(matrixStack, mouseX, mouseY);
        mc.gameRenderer.setupOverlayRendering();

    }

    @Override
    public boolean charTyped(char codePoint, int modifiers) {
        Furious.getInstance().getAltWidget().onChar(codePoint);
        return super.charTyped(codePoint, modifiers);
    }

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        Furious.getInstance().getAltWidget().onKey(keyCode);
        return false;
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
        buttons.forEach(b -> b.click(fixed.getX(), fixed.getY(), button));
        Furious.getInstance().getAltWidget().click(fixed.getX(), fixed.getY(), button);
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawStyledRect(MatrixStack stack, float x, float y, float width, float height, float radius) {
        Vector4i colors = new Vector4i(HUD.getColor(0, 1), HUD.getColor(90, 1), HUD.getColor(180, 1), HUD.getColor(270, 1));
        DisplayUtils.drawRoundedRect(x - 1.5f, y - 1.5f, width + 10f, height + 10f, new Vector4f(7, 7, 7, 7), colors);
        DisplayUtils.drawRoundedRect(x, y, width, height, radius - 0.5f, ColorUtils.rgba(21, 21, 21, 255));
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> {
            // Рассчитываем координаты и размеры кнопки
            float x = b.getX();
            float y = b.getY();
            float width = b.getWidth();
            float height = b.getHeight();
            float radius = 10; // Радиус скругления углов

            // Отрисовываем стилизованную кнопку
            drawStyledRect(stack, x, y, width, height + 3, radius + 0);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();

            // Отрисовываем тень
            int shadowColor = ColorUtils.rgba(0, 0, 0, 150);
            DisplayUtils.drawShadow(x + 15, y + 15, width, height, 10, shadowColor, shadowColor);

            // Отрисовываем текст на кнопке
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mX, mY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, b.getText(), x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);
        });
    }

    public static final ResourceLocation button = new ResourceLocation("expensive/images/button.png");

    private class Particle {

        private final float x;
        private float y;
        private float size;

        public Particle() {
            x = ThreadLocalRandom.current().nextInt(0, mc.getMainWindow().getScaledWidth());
            y = 0;
            size = 0;
        }

        public void update() {
            y += 1f;
        }

        public void render(MatrixStack stack) {
            //update();
            size += 0.1f;
            GlStateManager.pushMatrix();
            GlStateManager.translated((x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 0);
            GlStateManager.rotatef(size * 20, 0, 0, 1);
            GlStateManager.translated(-(x + Math.sin((System.nanoTime() / 1000000000f)) * 5), -y, 0);
            float multi = 1 - MathHelper.clamp((y / mc.getMainWindow().getScaledHeight()), 0, 1);
            y += 1;
            Fonts.damage.drawText(stack, "A", (float) (x + Math.sin((System.nanoTime() / 1000000000f)) * 5), y, 4, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }

    }

    @AllArgsConstructor
    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public String getText() {
            return text;
        }

        @Subscribe
        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 5, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            KawaseBlur.blur.BLURRED.draw();
            Stencil.uninitStencilBuffer();

            DisplayUtils.drawImage(button, x, y + 2, width, height, ColorUtils.rgb(50, 53, 77));
            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 10f);

            // Рисование тени
            int posX = Math.round(x);
            int posY = Math.round(y);
            Style style = Furious.getInstance().getStyleManager().getCurrentStyle();
            DisplayUtils.drawShadow(posX, posY, width, height, 30, style.getFirstColor().getRGB(), style.getSecondColor().getRGB());
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
/del хуета полная
 
Начинающий
Статус
Оффлайн
Регистрация
25 Май 2021
Сообщения
28
Реакции[?]
1
Поинты[?]
1K
Начинающий
Статус
Оффлайн
Регистрация
13 Авг 2024
Сообщения
17
Реакции[?]
0
Поинты[?]
0
бро пж сделай такоже мейн меню ток кнопки прозрачные и добавь картинку слева как в нурике
 
Сверху Снизу