Исходник MainMenu | Exp 3.1

Начинающий
Статус
Оффлайн
Регистрация
18 Авг 2023
Сообщения
216
Реакции[?]
0
Поинты[?]
0

Перед прочтением основного контента ниже, пожалуйста, обратите внимание на обновление внутри секции Майна на нашем форуме. У нас появились:

  • бесплатные читы для Майнкрафт — любое использование на свой страх и риск;
  • маркетплейс Майнкрафт — абсолютно любая коммерция, связанная с игрой, за исключением продажи читов (аккаунты, предоставления услуг, поиск кодеров читов и так далее);
  • приватные читы для Minecraft — в этом разделе только платные хаки для игры, покупайте группу "Продавец" и выставляйте на продажу свой софт;
  • обсуждения и гайды — всё тот же раздел с вопросами, но теперь модернизированный: поиск нужных хаков, пати с игроками-читерами и другая полезная информация.

Спасибо!

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

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


code:
package eva.ware.ui.mainmenu;

import eva.ware.utils.client.SoundUtil;
import eva.ware.utils.math.animation.Animation;
import eva.ware.utils.math.animation.util.Easing;
import eva.ware.utils.math.animation.util.Easings;
import eva.ware.utils.shader.ShaderUtil;
import com.mojang.blaze3d.matrix.MatrixStack;

import com.mojang.blaze3d.platform.GlStateManager;
import eva.ware.Evaware;
import eva.ware.utils.client.ClientUtil;
import eva.ware.utils.client.IMinecraft;
import eva.ware.utils.math.Vec2i;
import eva.ware.utils.math.MathUtil;
import eva.ware.utils.math.StopWatch;
import eva.ware.utils.render.color.ColorUtils;
import eva.ware.utils.render.rect.DisplayUtils;
import eva.ware.utils.render.font.Fonts;
import eva.ware.utils.text.BetterText;
import eva.ware.utils.text.font.ClientFonts;
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.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;


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

    }

    public final StopWatch timer = new StopWatch();
    public static float o = 0;

    private final ResourceLocation backmenu = new ResourceLocation("eva/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 = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton / 2);
        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "single", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "multy", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "altmgr", () -> {
            mc.displayGuiScreen(Evaware.getInst().getAltScreen());
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "settings", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "quit", mc::shutdownMinecraftApplet));
//        SoundUtil.playSound("mainmenu", 60, true);
    }


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

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double 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);

        MainWindow mainWindow = mc.getMainWindow();
        DisplayUtils.drawRoundedRect(0,0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 0, ColorUtils.rgb(15, 15, 15));

        mc.gameRenderer.setupOverlayRendering(2);

        for (float i=0;i<1337;i++) {
            if(timer.isReached(10)){
                o++;
                i=0;
                timer.reset();
            }
        }

        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.MainMenu2Shader.attach();
        ShaderUtil.MainMenu2Shader.setUniform("time", o/20);
        ShaderUtil.MainMenu2Shader.setUniform("width", (float)mainWindow.getWidth());
        ShaderUtil.MainMenu2Shader.setUniform("height", (float)mainWindow.getHeight());

        DisplayUtils.drawQuads(0, 0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 7);

        ShaderUtil.MainMenu2Shader.detach();

        GlStateManager.disableBlend();
        GlStateManager.popMatrix();

        float widthButton = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton * 2 / 2);

        float widthRect = widthButton * 6;
        float xRect = x - widthButton / 2;
        float heightRect = heightButton * 2;

        DisplayUtils.drawShadow(mainWindow.getScaledWidth() / 2 - 4 - (ClientFonts.msSemiBold[22].getWidth("EvaWare") / 2), y, ClientFonts.msSemiBold[22].getWidth("EvaWare") + 8, ClientFonts.msSemiBold[22].getFontHeight(), 12, ColorUtils.rgba(255, 255, 255, 40));
        DisplayUtils.drawShadow(xRect, y - 5, widthRect, heightRect, 12, ColorUtils.rgba(40, 40, 40, 60));
        DisplayUtils.drawRoundedRect(xRect, y - 5, widthRect, heightRect, 8, ColorUtils.rgba(40, 40, 40, 60));

        ClientFonts.msSemiBold[22].drawCenteredString(matrixStack, "EvaWare", mainWindow.getScaledWidth() / 2, y + 2, -1);
        ClientFonts.msSemiBold[14].drawString(matrixStack, setMessage(), 3, mainWindow.getScaledHeight() - ClientFonts.msSemiBold[14].getFontHeight() + 1, -1);
        drawButtons(matrixStack, mouseX, mouseY, partialTicks);
        mc.gameRenderer.setupOverlayRendering();

    }

    private final BetterText gavno = new BetterText(List.of(
            " <3", " >_<", " UwU", " O_O", " OwO", " :>", " <3", " >w<", "~~"
    ), 2000);

    private String setMessage() {
        gavno.update();
        String emoji = gavno.getOutput().toString();
        String userName = ClientUtil.getUsername() + emoji;

        return ClientUtil.getGreetingMessage() + ", " + userName;
    }

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

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        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));
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> b.render(stack, mX, mY, pt));
    }

    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        public Animation animation = new Animation();
        boolean hovered;

        public Button(float x, float y, float width, float height, String text, Runnable action) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.text = text;
            this.action = action;
        }

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            animation.update();
            animation.run(hovered ? 1 : 0, hovered ? 0.25f : 0.5, Easings.BACK_OUT);
            hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            float hoverSize = (float) (2.5f * animation.getValue());
            float textY = (float) (y + height - 1 + 3 * animation.getValue());
            int interColor = ColorUtils.interpolateColor(-1, ColorUtils.rgb(160, 160, 160), (float) animation.getValue());

            DisplayUtils.drawShadow(x, y, width, height, 10, ColorUtils.rgba(90, 90, 90, 70));
            DisplayUtils.drawRoundedRect(x, y, width, height, 6, ColorUtils.rgba(90, 90, 90, 70));
            ClientFonts.tenacity[18].drawCenteredString(stack, text, x + width / 2f, textY, ColorUtils.setAlpha(interColor, (int) (255 * animation.getValue())));
            DisplayUtils.drawImage(new ResourceLocation("eva/images/mainmenu/" + text + ".png"), x + 5 - hoverSize, y + 5 - hoverSize, width - 10 + hoverSize * 2, height - 10 + hoverSize * 2, interColor);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
                SoundUtil.playSound("buttonclick.wav", .1f);
            }
        }

    }

}
 
Начинающий
Статус
Оффлайн
Регистрация
1 Авг 2024
Сообщения
38
Реакции[?]
0
Поинты[?]
0
Пожалуйста, авторизуйтесь для просмотра ссылки.

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


code:
package eva.ware.ui.mainmenu;

import eva.ware.utils.client.SoundUtil;
import eva.ware.utils.math.animation.Animation;
import eva.ware.utils.math.animation.util.Easing;
import eva.ware.utils.math.animation.util.Easings;
import eva.ware.utils.shader.ShaderUtil;
import com.mojang.blaze3d.matrix.MatrixStack;

import com.mojang.blaze3d.platform.GlStateManager;
import eva.ware.Evaware;
import eva.ware.utils.client.ClientUtil;
import eva.ware.utils.client.IMinecraft;
import eva.ware.utils.math.Vec2i;
import eva.ware.utils.math.MathUtil;
import eva.ware.utils.math.StopWatch;
import eva.ware.utils.render.color.ColorUtils;
import eva.ware.utils.render.rect.DisplayUtils;
import eva.ware.utils.render.font.Fonts;
import eva.ware.utils.text.BetterText;
import eva.ware.utils.text.font.ClientFonts;
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.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;


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

    }

    public final StopWatch timer = new StopWatch();
    public static float o = 0;

    private final ResourceLocation backmenu = new ResourceLocation("eva/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 = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton / 2);
        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "single", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "multy", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "altmgr", () -> {
            mc.displayGuiScreen(Evaware.getInst().getAltScreen());
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "settings", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "quit", mc::shutdownMinecraftApplet));
//        SoundUtil.playSound("mainmenu", 60, true);
    }


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

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double 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);

        MainWindow mainWindow = mc.getMainWindow();
        DisplayUtils.drawRoundedRect(0,0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 0, ColorUtils.rgb(15, 15, 15));

        mc.gameRenderer.setupOverlayRendering(2);

        for (float i=0;i<1337;i++) {
            if(timer.isReached(10)){
                o++;
                i=0;
                timer.reset();
            }
        }

        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.MainMenu2Shader.attach();
        ShaderUtil.MainMenu2Shader.setUniform("time", o/20);
        ShaderUtil.MainMenu2Shader.setUniform("width", (float)mainWindow.getWidth());
        ShaderUtil.MainMenu2Shader.setUniform("height", (float)mainWindow.getHeight());

        DisplayUtils.drawQuads(0, 0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 7);

        ShaderUtil.MainMenu2Shader.detach();

        GlStateManager.disableBlend();
        GlStateManager.popMatrix();

        float widthButton = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton * 2 / 2);

        float widthRect = widthButton * 6;
        float xRect = x - widthButton / 2;
        float heightRect = heightButton * 2;

        DisplayUtils.drawShadow(mainWindow.getScaledWidth() / 2 - 4 - (ClientFonts.msSemiBold[22].getWidth("EvaWare") / 2), y, ClientFonts.msSemiBold[22].getWidth("EvaWare") + 8, ClientFonts.msSemiBold[22].getFontHeight(), 12, ColorUtils.rgba(255, 255, 255, 40));
        DisplayUtils.drawShadow(xRect, y - 5, widthRect, heightRect, 12, ColorUtils.rgba(40, 40, 40, 60));
        DisplayUtils.drawRoundedRect(xRect, y - 5, widthRect, heightRect, 8, ColorUtils.rgba(40, 40, 40, 60));

        ClientFonts.msSemiBold[22].drawCenteredString(matrixStack, "EvaWare", mainWindow.getScaledWidth() / 2, y + 2, -1);
        ClientFonts.msSemiBold[14].drawString(matrixStack, setMessage(), 3, mainWindow.getScaledHeight() - ClientFonts.msSemiBold[14].getFontHeight() + 1, -1);
        drawButtons(matrixStack, mouseX, mouseY, partialTicks);
        mc.gameRenderer.setupOverlayRendering();

    }

    private final BetterText gavno = new BetterText(List.of(
            " <3", " >_<", " UwU", " O_O", " OwO", " :>", " <3", " >w<", "~~"
    ), 2000);

    private String setMessage() {
        gavno.update();
        String emoji = gavno.getOutput().toString();
        String userName = ClientUtil.getUsername() + emoji;

        return ClientUtil.getGreetingMessage() + ", " + userName;
    }

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

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        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));
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> b.render(stack, mX, mY, pt));
    }

    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        public Animation animation = new Animation();
        boolean hovered;

        public Button(float x, float y, float width, float height, String text, Runnable action) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.text = text;
            this.action = action;
        }

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            animation.update();
            animation.run(hovered ? 1 : 0, hovered ? 0.25f : 0.5, Easings.BACK_OUT);
            hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            float hoverSize = (float) (2.5f * animation.getValue());
            float textY = (float) (y + height - 1 + 3 * animation.getValue());
            int interColor = ColorUtils.interpolateColor(-1, ColorUtils.rgb(160, 160, 160), (float) animation.getValue());

            DisplayUtils.drawShadow(x, y, width, height, 10, ColorUtils.rgba(90, 90, 90, 70));
            DisplayUtils.drawRoundedRect(x, y, width, height, 6, ColorUtils.rgba(90, 90, 90, 70));
            ClientFonts.tenacity[18].drawCenteredString(stack, text, x + width / 2f, textY, ColorUtils.setAlpha(interColor, (int) (255 * animation.getValue())));
            DisplayUtils.drawImage(new ResourceLocation("eva/images/mainmenu/" + text + ".png"), x + 5 - hoverSize, y + 5 - hoverSize, width - 10 + hoverSize * 2, height - 10 + hoverSize * 2, interColor);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
                SoundUtil.playSound("buttonclick.wav", .1f);
            }
        }

    }

}
помню читикс с таким мейн меню, забыл название, вспомню напишу
 
Забаненный
Статус
Оффлайн
Регистрация
10 Май 2023
Сообщения
829
Реакции[?]
9
Поинты[?]
3K
Обратите внимание, пользователь заблокирован на форуме. Не рекомендуется проводить сделки.
Начинающий
Статус
Оффлайн
Регистрация
8 Июн 2024
Сообщения
107
Реакции[?]
0
Поинты[?]
0
Начинающий
Статус
Оффлайн
Регистрация
26 Авг 2024
Сообщения
569
Реакции[?]
0
Поинты[?]
1K
Пожалуйста, авторизуйтесь для просмотра ссылки.

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


code:
package eva.ware.ui.mainmenu;

import eva.ware.utils.client.SoundUtil;
import eva.ware.utils.math.animation.Animation;
import eva.ware.utils.math.animation.util.Easing;
import eva.ware.utils.math.animation.util.Easings;
import eva.ware.utils.shader.ShaderUtil;
import com.mojang.blaze3d.matrix.MatrixStack;

import com.mojang.blaze3d.platform.GlStateManager;
import eva.ware.Evaware;
import eva.ware.utils.client.ClientUtil;
import eva.ware.utils.client.IMinecraft;
import eva.ware.utils.math.Vec2i;
import eva.ware.utils.math.MathUtil;
import eva.ware.utils.math.StopWatch;
import eva.ware.utils.render.color.ColorUtils;
import eva.ware.utils.render.rect.DisplayUtils;
import eva.ware.utils.render.font.Fonts;
import eva.ware.utils.text.BetterText;
import eva.ware.utils.text.font.ClientFonts;
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.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;


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

    }

    public final StopWatch timer = new StopWatch();
    public static float o = 0;

    private final ResourceLocation backmenu = new ResourceLocation("eva/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 = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton / 2);
        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "single", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "multy", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "altmgr", () -> {
            mc.displayGuiScreen(Evaware.getInst().getAltScreen());
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "settings", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "quit", mc::shutdownMinecraftApplet));
//        SoundUtil.playSound("mainmenu", 60, true);
    }


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

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double 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);

        MainWindow mainWindow = mc.getMainWindow();
        DisplayUtils.drawRoundedRect(0,0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 0, ColorUtils.rgb(15, 15, 15));

        mc.gameRenderer.setupOverlayRendering(2);

        for (float i=0;i<1337;i++) {
            if(timer.isReached(10)){
                o++;
                i=0;
                timer.reset();
            }
        }

        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.MainMenu2Shader.attach();
        ShaderUtil.MainMenu2Shader.setUniform("time", o/20);
        ShaderUtil.MainMenu2Shader.setUniform("width", (float)mainWindow.getWidth());
        ShaderUtil.MainMenu2Shader.setUniform("height", (float)mainWindow.getHeight());

        DisplayUtils.drawQuads(0, 0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 7);

        ShaderUtil.MainMenu2Shader.detach();

        GlStateManager.disableBlend();
        GlStateManager.popMatrix();

        float widthButton = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton * 2 / 2);

        float widthRect = widthButton * 6;
        float xRect = x - widthButton / 2;
        float heightRect = heightButton * 2;

        DisplayUtils.drawShadow(mainWindow.getScaledWidth() / 2 - 4 - (ClientFonts.msSemiBold[22].getWidth("EvaWare") / 2), y, ClientFonts.msSemiBold[22].getWidth("EvaWare") + 8, ClientFonts.msSemiBold[22].getFontHeight(), 12, ColorUtils.rgba(255, 255, 255, 40));
        DisplayUtils.drawShadow(xRect, y - 5, widthRect, heightRect, 12, ColorUtils.rgba(40, 40, 40, 60));
        DisplayUtils.drawRoundedRect(xRect, y - 5, widthRect, heightRect, 8, ColorUtils.rgba(40, 40, 40, 60));

        ClientFonts.msSemiBold[22].drawCenteredString(matrixStack, "EvaWare", mainWindow.getScaledWidth() / 2, y + 2, -1);
        ClientFonts.msSemiBold[14].drawString(matrixStack, setMessage(), 3, mainWindow.getScaledHeight() - ClientFonts.msSemiBold[14].getFontHeight() + 1, -1);
        drawButtons(matrixStack, mouseX, mouseY, partialTicks);
        mc.gameRenderer.setupOverlayRendering();

    }

    private final BetterText gavno = new BetterText(List.of(
            " <3", " >_<", " UwU", " O_O", " OwO", " :>", " <3", " >w<", "~~"
    ), 2000);

    private String setMessage() {
        gavno.update();
        String emoji = gavno.getOutput().toString();
        String userName = ClientUtil.getUsername() + emoji;

        return ClientUtil.getGreetingMessage() + ", " + userName;
    }

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

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        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));
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> b.render(stack, mX, mY, pt));
    }

    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        public Animation animation = new Animation();
        boolean hovered;

        public Button(float x, float y, float width, float height, String text, Runnable action) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.text = text;
            this.action = action;
        }

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            animation.update();
            animation.run(hovered ? 1 : 0, hovered ? 0.25f : 0.5, Easings.BACK_OUT);
            hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            float hoverSize = (float) (2.5f * animation.getValue());
            float textY = (float) (y + height - 1 + 3 * animation.getValue());
            int interColor = ColorUtils.interpolateColor(-1, ColorUtils.rgb(160, 160, 160), (float) animation.getValue());

            DisplayUtils.drawShadow(x, y, width, height, 10, ColorUtils.rgba(90, 90, 90, 70));
            DisplayUtils.drawRoundedRect(x, y, width, height, 6, ColorUtils.rgba(90, 90, 90, 70));
            ClientFonts.tenacity[18].drawCenteredString(stack, text, x + width / 2f, textY, ColorUtils.setAlpha(interColor, (int) (255 * animation.getValue())));
            DisplayUtils.drawImage(new ResourceLocation("eva/images/mainmenu/" + text + ".png"), x + 5 - hoverSize, y + 5 - hoverSize, width - 10 + hoverSize * 2, height - 10 + hoverSize * 2, interColor);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
                SoundUtil.playSound("buttonclick.wav", .1f);
            }
        }

    }

}
omggg relake and vegaline moment
 
Начинающий
Статус
Оффлайн
Регистрация
30 Июл 2023
Сообщения
338
Реакции[?]
2
Поинты[?]
1K
Пожалуйста, авторизуйтесь для просмотра ссылки.

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


code:
package eva.ware.ui.mainmenu;

import eva.ware.utils.client.SoundUtil;
import eva.ware.utils.math.animation.Animation;
import eva.ware.utils.math.animation.util.Easing;
import eva.ware.utils.math.animation.util.Easings;
import eva.ware.utils.shader.ShaderUtil;
import com.mojang.blaze3d.matrix.MatrixStack;

import com.mojang.blaze3d.platform.GlStateManager;
import eva.ware.Evaware;
import eva.ware.utils.client.ClientUtil;
import eva.ware.utils.client.IMinecraft;
import eva.ware.utils.math.Vec2i;
import eva.ware.utils.math.MathUtil;
import eva.ware.utils.math.StopWatch;
import eva.ware.utils.render.color.ColorUtils;
import eva.ware.utils.render.rect.DisplayUtils;
import eva.ware.utils.render.font.Fonts;
import eva.ware.utils.text.BetterText;
import eva.ware.utils.text.font.ClientFonts;
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.text.ITextComponent;

import java.util.ArrayList;
import java.util.List;


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

    }

    public final StopWatch timer = new StopWatch();
    public static float o = 0;

    private final ResourceLocation backmenu = new ResourceLocation("eva/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 = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton / 2);
        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "single", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "multy", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "altmgr", () -> {
            mc.displayGuiScreen(Evaware.getInst().getAltScreen());
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "settings", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        x += widthButton;
        buttons.add(new Button(x, y, widthButton, heightButton, "quit", mc::shutdownMinecraftApplet));
//        SoundUtil.playSound("mainmenu", 60, true);
    }


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

    @Override
    public boolean mouseScrolled(double mouseX, double mouseY, double 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);

        MainWindow mainWindow = mc.getMainWindow();
        DisplayUtils.drawRoundedRect(0,0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 0, ColorUtils.rgb(15, 15, 15));

        mc.gameRenderer.setupOverlayRendering(2);

        for (float i=0;i<1337;i++) {
            if(timer.isReached(10)){
                o++;
                i=0;
                timer.reset();
            }
        }

        GlStateManager.pushMatrix();
        GlStateManager.enableBlend();

        ShaderUtil.MainMenu2Shader.attach();
        ShaderUtil.MainMenu2Shader.setUniform("time", o/20);
        ShaderUtil.MainMenu2Shader.setUniform("width", (float)mainWindow.getWidth());
        ShaderUtil.MainMenu2Shader.setUniform("height", (float)mainWindow.getHeight());

        DisplayUtils.drawQuads(0, 0, mainWindow.getScaledWidth(), mainWindow.getScaledHeight(), 7);

        ShaderUtil.MainMenu2Shader.detach();

        GlStateManager.disableBlend();
        GlStateManager.popMatrix();

        float widthButton = 80 / 2f;
        float heightButton = 80 / 2f;
        float x = ClientUtil.calc(width) / 2f - (widthButton * 5 / 2);
        float y = Math.round(ClientUtil.calc(height) / 2f - heightButton * 2 / 2);

        float widthRect = widthButton * 6;
        float xRect = x - widthButton / 2;
        float heightRect = heightButton * 2;

        DisplayUtils.drawShadow(mainWindow.getScaledWidth() / 2 - 4 - (ClientFonts.msSemiBold[22].getWidth("EvaWare") / 2), y, ClientFonts.msSemiBold[22].getWidth("EvaWare") + 8, ClientFonts.msSemiBold[22].getFontHeight(), 12, ColorUtils.rgba(255, 255, 255, 40));
        DisplayUtils.drawShadow(xRect, y - 5, widthRect, heightRect, 12, ColorUtils.rgba(40, 40, 40, 60));
        DisplayUtils.drawRoundedRect(xRect, y - 5, widthRect, heightRect, 8, ColorUtils.rgba(40, 40, 40, 60));

        ClientFonts.msSemiBold[22].drawCenteredString(matrixStack, "EvaWare", mainWindow.getScaledWidth() / 2, y + 2, -1);
        ClientFonts.msSemiBold[14].drawString(matrixStack, setMessage(), 3, mainWindow.getScaledHeight() - ClientFonts.msSemiBold[14].getFontHeight() + 1, -1);
        drawButtons(matrixStack, mouseX, mouseY, partialTicks);
        mc.gameRenderer.setupOverlayRendering();

    }

    private final BetterText gavno = new BetterText(List.of(
            " <3", " >_<", " UwU", " O_O", " OwO", " :>", " <3", " >w<", "~~"
    ), 2000);

    private String setMessage() {
        gavno.update();
        String emoji = gavno.getOutput().toString();
        String userName = ClientUtil.getUsername() + emoji;

        return ClientUtil.getGreetingMessage() + ", " + userName;
    }

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

    @Override
    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
        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));
        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {
        buttons.forEach(b -> b.render(stack, mX, mY, pt));
    }

    private class Button {
        [USER=270918]@Getter[/USER]
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        public Animation animation = new Animation();
        boolean hovered;

        public Button(float x, float y, float width, float height, String text, Runnable action) {
            this.x = x;
            this.y = y;
            this.width = width;
            this.height = height;
            this.text = text;
            this.action = action;
        }

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            animation.update();
            animation.run(hovered ? 1 : 0, hovered ? 0.25f : 0.5, Easings.BACK_OUT);
            hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            float hoverSize = (float) (2.5f * animation.getValue());
            float textY = (float) (y + height - 1 + 3 * animation.getValue());
            int interColor = ColorUtils.interpolateColor(-1, ColorUtils.rgb(160, 160, 160), (float) animation.getValue());

            DisplayUtils.drawShadow(x, y, width, height, 10, ColorUtils.rgba(90, 90, 90, 70));
            DisplayUtils.drawRoundedRect(x, y, width, height, 6, ColorUtils.rgba(90, 90, 90, 70));
            ClientFonts.tenacity[18].drawCenteredString(stack, text, x + width / 2f, textY, ColorUtils.setAlpha(interColor, (int) (255 * animation.getValue())));
            DisplayUtils.drawImage(new ResourceLocation("eva/images/mainmenu/" + text + ".png"), x + 5 - hoverSize, y + 5 - hoverSize, width - 10 + hoverSize * 2, height - 10 + hoverSize * 2, interColor);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
                SoundUtil.playSound("buttonclick.wav", .1f);
            }
        }

    }

}
Ахуенно
 
Сверху Снизу