Визуальная часть MainMenu | Похожий на Нурсултан | EXP 3.1

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
25 Сен 2024
Сообщения
12
Реакции
0
Выберите загрузчик игры
  1. OptiFine
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
 

Вложения

  • 1760100338257.png
    1760100338257.png
    68.5 KB · Просмотры: 420
Вообще не похоже, так ещё и кнопки ужасно сделаны :roflanPominki:
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
крашсистем спастит в 1.21.4
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
10 skidЖостка из 10
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
кстати, очень похоже! 9/10 не хватает тянки в меню, как говорилось в новостях этого клиента.
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
а где собственно похоже?
 
/del
переделал гуи с югейма
 
стой подожди что это за хуйня
 
/del полнейшая залупа, могу вам такое слить если хотите

1760117630279.png
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
Пздц
 
SS - приклеплен ниже
MainMenu:
Expand Collapse Copy
package im.expensive.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.expensive.Expensive;
import im.expensive.utils.client.ClientUtil;
import im.expensive.utils.client.IMinecraft;
import im.expensive.utils.client.Vec2i;
import im.expensive.utils.math.MathUtil;
import im.expensive.utils.render.ColorUtils;
import im.expensive.utils.render.DisplayUtils;
import im.expensive.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
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(""));
    }

    private final ResourceLocation background = new ResourceLocation("expensive/images/dark_gradient.png");
    private final ResourceLocation logo = new ResourceLocation("expensive/images/n_logo.png");

    private final List<Button> buttons = new ArrayList<>();

    @Override
    public void init(Minecraft minecraft, int width, int height) {
        super.init(minecraft, width, height);
        buttons.clear();

        float buttonWidth = 120;
        float buttonHeight = 20;
        float startY = height / 2f - 40;
        float x = width - buttonWidth - 50;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Одиночная игра", () ->
                mc.displayGuiScreen(new WorldSelectionScreen(this))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Сетевая игра", () ->
                mc.displayGuiScreen(new MultiplayerScreen(this))));
        startY += buttonHeight + 5;

        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Аккаунты", () -> {
            // пастеры здесь вместо  System.out.println("Alt menu clicked"); ставим ваш мейнаккунты
            System.out.println("Alt menu clicked");
        }));

        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Настройки", () ->
                mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings))));
        startY += buttonHeight + 5;
        buttons.add(new Button(x, startY, buttonWidth, buttonHeight, "Выйти", mc::shutdownMinecraftApplet));
    }

    @Override
    public void render(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        super.render(stack, mouseX, mouseY, partialTicks);


        renderBackgroundGradient(stack);


        int logoSize = Math.min(width, height) / 3;
        int logoX = width / 2 - logoSize / 2;
        int logoY = height / 2 - logoSize / 2 - 40;
        DisplayUtils.drawImage(logo, logoX, logoY, logoSize, logoSize, -1);


        Fonts.montserrat.drawCenteredText(stack, "Nursultan", width / 2f, logoY + logoSize + 30, ColorUtils.rgb(90, 150, 255), 20f);
        Fonts.montserrat.drawCenteredText(stack, "SkidЖоска", width / 2f, logoY + logoSize + 50, ColorUtils.rgb(180, 200, 255), 14f);

        for (Button b : buttons) {
            b.render(stack, mouseX, mouseY);
        }
    }

    private void renderBackgroundGradient(MatrixStack stack) {

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.rgb(5, 10, 25));

        DisplayUtils.drawRect(0, 0, width, height, ColorUtils.setAlpha(ColorUtils.rgb(0, 0, 0), 120));
    }

    @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);
    }

    @AllArgsConstructor
    private static class Button {
        @Getter private final float x, y, width, height;
        private final String text;
        private final Runnable action;

        public void render(MatrixStack stack, int mouseX, int mouseY) {
            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);
            int bgColor = hovered ? ColorUtils.rgb(30, 50, 120) : ColorUtils.rgb(15, 20, 40);
            int textColor = hovered ? ColorUtils.rgb(120, 170, 255) : ColorUtils.rgb(200, 200, 200);

            DisplayUtils.drawRoundedRect(x, y, width, height, 4, bgColor);
            Fonts.montserrat.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 9f);
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
думаю крассиво делалась 5 минут | помог гпт
Ты думаешь что это похоже на майнменю нурика xd
 
10/10 когда скид гуишки нурика?
 
сорян ну это только /del
 

Похожие темы

Назад
Сверху Снизу