Визуальная часть ChangeLog For Exp 3.1

  • Автор темы Автор темы im_kit
  • Дата начала Дата начала
мне страшно, это в каком году вообще чейжлоги попудярны были :roflanPominki:
Я сделал потому что это удобно взял по нажатии кнопки увидел все изменения пастерам сойдет
 
крутой ChangeLog по нажатии кнопки
ss-
Пожалуйста, авторизуйтесь для просмотра ссылки.

У тебя вопросы тогда пиши их в ответах или в лс
Кодик Для моих котиков:
Expand Collapse Copy
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.text.ITextComponent;

import java.awt.*;
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 logo = new ResourceLocation("Паста/images/лого.png");
    private final ResourceLocation fone = new ResourceLocation("Паста/images/фон.jpg");
    private final ResourceLocation changelogIcon = new ResourceLocation("Паста/images/changelog.png");
    private final List<Button> buttons = new ArrayList<>();
    private boolean showChangelog = false;
    private final StopWatch changelogAnimation = new StopWatch();
    private float changelogAlpha = 0f;
    private float panelY;

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

        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float heightButton = 20.0F;
        float x = (float) ClientUtil.calc(width) / 2.0F - widthButton / 2.0F;
        float y = (float)Math.round(5.0F + (float)ClientUtil.calc(height) / 2.0F - heightButton * 6.0F / 2.0F);

        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "Одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Онлайн игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Настройки игры", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Аккаунты", () -> {
            mc.displayGuiScreen(new AltManager());
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Выход", mc::shutdownMinecraftApplet));


        buttons.add(new Button(width - 40, 10, 30, 30, "", () -> {
            showChangelog = !showChangelog;
            changelogAnimation.reset();
        }));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();
    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

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

        float parallaxOffsetX = (mouseX - windowWidth / 2f) * 0.02f;
        float parallaxOffsetY = (mouseY - windowHeight / 2f) * 0.02f;

        float extendedWidth = windowWidth * 1.1f;
        float extendedHeight = windowHeight * 1.1f;

        float offsetX = parallaxOffsetX - (extendedWidth - windowWidth) / 2f;
        float offsetY = parallaxOffsetY - (extendedHeight - windowHeight) / 2f;

        mc.gameRenderer.setupOverlayRendering();
        DisplayUtils.drawImage(fone, offsetX, offsetY, (int) extendedWidth, (int) extendedHeight, -1);

        int logoWidth = 70;
        int logoHeight = 70;

        float buttonStartX = buttons.get(0).getX();
        float buttonStartY = buttons.get(0).getY();
        float buttonEndX = buttonStartX + buttons.get(0).getWidth();
        float buttonEndY = buttons.get(buttons.size() - 2).getY() + buttons.get(0).getHeight();
        float centerX = buttonStartX + (buttonEndX - buttonStartX) / 2f;
        float logoX = centerX - logoWidth / 2f;
        float logoY = buttonStartY - 90;

        DisplayUtils.drawImage(logo, logoX, logoY, logoWidth, logoHeight, -1);
        DisplayUtils.drawRoundedRect(
                buttonStartX - 10,
                buttonStartY - 10,
                buttonEndX - buttonStartX + 20,
                buttonEndY - buttonStartY + 20,
                5,
                new Color(50, 50, 50, 120).getRGB()
        );

        String greeting = getGreeting();
        Fonts.sfbold.drawCenteredText(matrixStack, "Paster Client", buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonStartY - 30,
                ColorUtils.rgb(255, 255, 255), 13, 0.1f);
        Fonts.sfMedium.drawCenteredText(matrixStack, greeting,
                buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonEndY + 20,
                new Color(255, 255, 255).getRGB(), 10f);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);


        renderChangelogButton(matrixStack, mouseX, mouseY);


        if (showChangelog) {
            renderChangelog(matrixStack, mouseX, mouseY, partialTicks);
        }
    }

    private void renderChangelogButton(MatrixStack stack, int mouseX, int mouseY) {
        Button changelogBtn = buttons.get(buttons.size() - 1);
        int color = MathUtil.isHovered(mouseX, mouseY, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight()) ?
                ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(200, 200, 200);

        DisplayUtils.drawImage(changelogIcon, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight(), color);
    }

    private void renderChangelog(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        // Анимация появления - исправление NPE
        long elapsedTime = changelogAnimation.getElapsedTimeSafe();
        if (changelogAnimation.isReached(200)) {
            changelogAlpha = Math.min(1f, changelogAlpha + 0.05f);
        } else {
            changelogAlpha = MathHelper.clamp((float) elapsedTime / 200f, 0f, 1f);
        }

        int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
        int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

        float panelWidth = 300;
        float panelHeight = 400;
        float panelX = (windowWidth - panelWidth) / 2f;
        panelY = (windowHeight - panelHeight) / 2f;


        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10,
                new Color(30, 30, 35, (int)(220 * changelogAlpha)).getRGB());


        Fonts.sfbold.drawCenteredText(stack, "Changelog build???", panelX + panelWidth / 2f,
                panelY + 15, new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 14f);


        float textY = panelY + 40;
        float textX = panelX + 15;

        String[] changes = {
                "§1• Обход АнтиОткида",
                "§2• Улучшена стабильность клиента",
                "§3• Русский Язык",
                "§4• Добавлен ChangeLog",
                "§5• Оптимизирована производительность",
                "§6• ",
                "§7• "
        };

        for (String change : changes) {
            Fonts.sfMedium.drawText(stack, change, textX, textY,
                    new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 10f);
            textY += 20;
        }


        float closeBtnSize = 20;
        float closeBtnX = panelX + panelWidth - closeBtnSize - 10;
        float closeBtnY = panelY + 10;

        boolean closeHovered = MathUtil.isHovered(mouseX, mouseY, closeBtnX, closeBtnY, closeBtnSize, closeBtnSize);
        DisplayUtils.drawRoundedRect(closeBtnX, closeBtnY, closeBtnSize, closeBtnSize, 5,
                new Color(closeHovered ? 255 : 200, 50, 50, (int)(200 * changelogAlpha)).getRGB());

        Fonts.sfMedium.drawCenteredText(stack, "X", closeBtnX + closeBtnSize / 2f,
                closeBtnY + closeBtnSize / 2f - 4,
                new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 12f);
    }

    private String getGreeting() {
        int hour = java.time.LocalTime.now().getHour();
        if (hour >= 6 && hour < 12) {
            return "Доброе утро!  <3";
        } else if (hour >= 12 && hour < 16) {
            return "Добрый день! :>";
        } else if (hour >= 16 && hour < 19) {
            return "Добрый вечер! <3";
        } else {
            return "Доброй ночи! >_<";
        }
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);


        if (showChangelog) {
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
            int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

            float panelWidth = 300;
            float panelX = (windowWidth - panelWidth) / 2f;

            float closeBtnSize = 20;
            float closeBtnX = panelX + panelWidth - closeBtnSize - 10;

            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), closeBtnX, panelY + 10, closeBtnSize, closeBtnSize)) {
                showChangelog = false;
                changelogAnimation.reset();
                return true;
            }
        }


        for (Button btn : buttons) {
            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), btn.getX(), btn.getY(), btn.getWidth(), btn.getHeight())) {
                btn.click(fixed.getX(), fixed.getY(), button);
                return true;
            }
        }

        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {

        for (int i = 0; i < buttons.size() - 1; i++) {
            buttons.get(i).render(stack, mX, mY, pt);
        }
    }

    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) {
            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, -1, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }
    }

    @AllArgsConstructor
    private class Button {
        @Getter
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        private final ResourceLocation singleplayer = new ResourceLocation("пастер/images/singleplayer.png");

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            float widthButton = 80;
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            Stencil.uninitStencilBuffer();
            int colors = new Color(0, 0, 0).getRGB();
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                colors = ColorUtils.rgb(161, 164, 177);
            }

            DisplayUtils.drawShadow(x, y, width, height + 1, 6, new Color(21, 25, 40, 170).getRGB());

            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }

            if (!text.isEmpty()) {
                Fonts.sfMedium.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 9f);
            }
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
БЛЯТЬ СУКА ЖЕНЬГИ ГОНИ У МЕНЯ ГЛАЗА ВЫПАЛИ
 
крутой ChangeLog по нажатии кнопки
ss-
Пожалуйста, авторизуйтесь для просмотра ссылки.

У тебя вопросы тогда пиши их в ответах или в лс
Кодик Для моих котиков:
Expand Collapse Copy
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.text.ITextComponent;

import java.awt.*;
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 logo = new ResourceLocation("Паста/images/лого.png");
    private final ResourceLocation fone = new ResourceLocation("Паста/images/фон.jpg");
    private final ResourceLocation changelogIcon = new ResourceLocation("Паста/images/changelog.png");
    private final List<Button> buttons = new ArrayList<>();
    private boolean showChangelog = false;
    private final StopWatch changelogAnimation = new StopWatch();
    private float changelogAlpha = 0f;
    private float panelY;

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

        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float heightButton = 20.0F;
        float x = (float) ClientUtil.calc(width) / 2.0F - widthButton / 2.0F;
        float y = (float)Math.round(5.0F + (float)ClientUtil.calc(height) / 2.0F - heightButton * 6.0F / 2.0F);

        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "Одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Онлайн игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Настройки игры", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Аккаунты", () -> {
            mc.displayGuiScreen(new AltManager());
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Выход", mc::shutdownMinecraftApplet));


        buttons.add(new Button(width - 40, 10, 30, 30, "", () -> {
            showChangelog = !showChangelog;
            changelogAnimation.reset();
        }));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();
    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

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

        float parallaxOffsetX = (mouseX - windowWidth / 2f) * 0.02f;
        float parallaxOffsetY = (mouseY - windowHeight / 2f) * 0.02f;

        float extendedWidth = windowWidth * 1.1f;
        float extendedHeight = windowHeight * 1.1f;

        float offsetX = parallaxOffsetX - (extendedWidth - windowWidth) / 2f;
        float offsetY = parallaxOffsetY - (extendedHeight - windowHeight) / 2f;

        mc.gameRenderer.setupOverlayRendering();
        DisplayUtils.drawImage(fone, offsetX, offsetY, (int) extendedWidth, (int) extendedHeight, -1);

        int logoWidth = 70;
        int logoHeight = 70;

        float buttonStartX = buttons.get(0).getX();
        float buttonStartY = buttons.get(0).getY();
        float buttonEndX = buttonStartX + buttons.get(0).getWidth();
        float buttonEndY = buttons.get(buttons.size() - 2).getY() + buttons.get(0).getHeight();
        float centerX = buttonStartX + (buttonEndX - buttonStartX) / 2f;
        float logoX = centerX - logoWidth / 2f;
        float logoY = buttonStartY - 90;

        DisplayUtils.drawImage(logo, logoX, logoY, logoWidth, logoHeight, -1);
        DisplayUtils.drawRoundedRect(
                buttonStartX - 10,
                buttonStartY - 10,
                buttonEndX - buttonStartX + 20,
                buttonEndY - buttonStartY + 20,
                5,
                new Color(50, 50, 50, 120).getRGB()
        );

        String greeting = getGreeting();
        Fonts.sfbold.drawCenteredText(matrixStack, "Paster Client", buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonStartY - 30,
                ColorUtils.rgb(255, 255, 255), 13, 0.1f);
        Fonts.sfMedium.drawCenteredText(matrixStack, greeting,
                buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonEndY + 20,
                new Color(255, 255, 255).getRGB(), 10f);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);


        renderChangelogButton(matrixStack, mouseX, mouseY);


        if (showChangelog) {
            renderChangelog(matrixStack, mouseX, mouseY, partialTicks);
        }
    }

    private void renderChangelogButton(MatrixStack stack, int mouseX, int mouseY) {
        Button changelogBtn = buttons.get(buttons.size() - 1);
        int color = MathUtil.isHovered(mouseX, mouseY, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight()) ?
                ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(200, 200, 200);

        DisplayUtils.drawImage(changelogIcon, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight(), color);
    }

    private void renderChangelog(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        // Анимация появления - исправление NPE
        long elapsedTime = changelogAnimation.getElapsedTimeSafe();
        if (changelogAnimation.isReached(200)) {
            changelogAlpha = Math.min(1f, changelogAlpha + 0.05f);
        } else {
            changelogAlpha = MathHelper.clamp((float) elapsedTime / 200f, 0f, 1f);
        }

        int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
        int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

        float panelWidth = 300;
        float panelHeight = 400;
        float panelX = (windowWidth - panelWidth) / 2f;
        panelY = (windowHeight - panelHeight) / 2f;


        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10,
                new Color(30, 30, 35, (int)(220 * changelogAlpha)).getRGB());


        Fonts.sfbold.drawCenteredText(stack, "Changelog build???", panelX + panelWidth / 2f,
                panelY + 15, new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 14f);


        float textY = panelY + 40;
        float textX = panelX + 15;

        String[] changes = {
                "§1• Обход АнтиОткида",
                "§2• Улучшена стабильность клиента",
                "§3• Русский Язык",
                "§4• Добавлен ChangeLog",
                "§5• Оптимизирована производительность",
                "§6• ",
                "§7• "
        };

        for (String change : changes) {
            Fonts.sfMedium.drawText(stack, change, textX, textY,
                    new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 10f);
            textY += 20;
        }


        float closeBtnSize = 20;
        float closeBtnX = panelX + panelWidth - closeBtnSize - 10;
        float closeBtnY = panelY + 10;

        boolean closeHovered = MathUtil.isHovered(mouseX, mouseY, closeBtnX, closeBtnY, closeBtnSize, closeBtnSize);
        DisplayUtils.drawRoundedRect(closeBtnX, closeBtnY, closeBtnSize, closeBtnSize, 5,
                new Color(closeHovered ? 255 : 200, 50, 50, (int)(200 * changelogAlpha)).getRGB());

        Fonts.sfMedium.drawCenteredText(stack, "X", closeBtnX + closeBtnSize / 2f,
                closeBtnY + closeBtnSize / 2f - 4,
                new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 12f);
    }

    private String getGreeting() {
        int hour = java.time.LocalTime.now().getHour();
        if (hour >= 6 && hour < 12) {
            return "Доброе утро!  <3";
        } else if (hour >= 12 && hour < 16) {
            return "Добрый день! :>";
        } else if (hour >= 16 && hour < 19) {
            return "Добрый вечер! <3";
        } else {
            return "Доброй ночи! >_<";
        }
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);


        if (showChangelog) {
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
            int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

            float panelWidth = 300;
            float panelX = (windowWidth - panelWidth) / 2f;

            float closeBtnSize = 20;
            float closeBtnX = panelX + panelWidth - closeBtnSize - 10;

            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), closeBtnX, panelY + 10, closeBtnSize, closeBtnSize)) {
                showChangelog = false;
                changelogAnimation.reset();
                return true;
            }
        }


        for (Button btn : buttons) {
            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), btn.getX(), btn.getY(), btn.getWidth(), btn.getHeight())) {
                btn.click(fixed.getX(), fixed.getY(), button);
                return true;
            }
        }

        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {

        for (int i = 0; i < buttons.size() - 1; i++) {
            buttons.get(i).render(stack, mX, mY, pt);
        }
    }

    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) {
            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, -1, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }
    }

    @AllArgsConstructor
    private class Button {
        @Getter
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        private final ResourceLocation singleplayer = new ResourceLocation("пастер/images/singleplayer.png");

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            float widthButton = 80;
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            Stencil.uninitStencilBuffer();
            int colors = new Color(0, 0, 0).getRGB();
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                colors = ColorUtils.rgb(161, 164, 177);
            }

            DisplayUtils.drawShadow(x, y, width, height + 1, 6, new Color(21, 25, 40, 170).getRGB());

            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }

            if (!text.isEmpty()) {
                Fonts.sfMedium.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 9f);
            }
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
чувак спасибо огромное спастил для своего YouGameClient и вдруг ко мне пришел яростный отчим спросил что я пашу я ответил что я пашу чейндж лог с югейма он сказал чтобы я быстро ложился спать и мне пришлось выключать компьютер но ночью он пришел и начал стягивать с меня трусы и птом вставил свой член я конечно сопротивляся но потом я перестал ведь почувстовал тепло в моем анальном отверстии спасибо за такой крутой чендж лог.
 
крутой ChangeLog по нажатии кнопки
ss-
Пожалуйста, авторизуйтесь для просмотра ссылки.

У тебя вопросы тогда пиши их в ответах или в лс
Кодик Для моих котиков:
Expand Collapse Copy
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.text.ITextComponent;

import java.awt.*;
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 logo = new ResourceLocation("Паста/images/лого.png");
    private final ResourceLocation fone = new ResourceLocation("Паста/images/фон.jpg");
    private final ResourceLocation changelogIcon = new ResourceLocation("Паста/images/changelog.png");
    private final List<Button> buttons = new ArrayList<>();
    private boolean showChangelog = false;
    private final StopWatch changelogAnimation = new StopWatch();
    private float changelogAlpha = 0f;
    private float panelY;

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

        for (Particle particle : particles) {
            particle.y = ThreadLocalRandom.current().nextInt(-5, height);
        }
        float heightButton = 20.0F;
        float x = (float) ClientUtil.calc(width) / 2.0F - widthButton / 2.0F;
        float y = (float)Math.round(5.0F + (float)ClientUtil.calc(height) / 2.0F - heightButton * 6.0F / 2.0F);

        buttons.clear();
        buttons.add(new Button(x, y, widthButton, heightButton, "Одиночная игра", () -> {
            mc.displayGuiScreen(new WorldSelectionScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Онлайн игра", () -> {
            mc.displayGuiScreen(new MultiplayerScreen(this));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Настройки игры", () -> {
            mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Аккаунты", () -> {
            mc.displayGuiScreen(new AltManager());
        }));
        y += 68 / 2f - 10;
        buttons.add(new Button(x, y, widthButton, heightButton, "Выход", mc::shutdownMinecraftApplet));


        buttons.add(new Button(width - 40, 10, 30, 30, "", () -> {
            showChangelog = !showChangelog;
            changelogAnimation.reset();
        }));
    }

    private static final CopyOnWriteArrayList<Particle> particles = new CopyOnWriteArrayList<>();
    private final StopWatch stopWatch = new StopWatch();
    static boolean start = false;

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

        float parallaxOffsetX = (mouseX - windowWidth / 2f) * 0.02f;
        float parallaxOffsetY = (mouseY - windowHeight / 2f) * 0.02f;

        float extendedWidth = windowWidth * 1.1f;
        float extendedHeight = windowHeight * 1.1f;

        float offsetX = parallaxOffsetX - (extendedWidth - windowWidth) / 2f;
        float offsetY = parallaxOffsetY - (extendedHeight - windowHeight) / 2f;

        mc.gameRenderer.setupOverlayRendering();
        DisplayUtils.drawImage(fone, offsetX, offsetY, (int) extendedWidth, (int) extendedHeight, -1);

        int logoWidth = 70;
        int logoHeight = 70;

        float buttonStartX = buttons.get(0).getX();
        float buttonStartY = buttons.get(0).getY();
        float buttonEndX = buttonStartX + buttons.get(0).getWidth();
        float buttonEndY = buttons.get(buttons.size() - 2).getY() + buttons.get(0).getHeight();
        float centerX = buttonStartX + (buttonEndX - buttonStartX) / 2f;
        float logoX = centerX - logoWidth / 2f;
        float logoY = buttonStartY - 90;

        DisplayUtils.drawImage(logo, logoX, logoY, logoWidth, logoHeight, -1);
        DisplayUtils.drawRoundedRect(
                buttonStartX - 10,
                buttonStartY - 10,
                buttonEndX - buttonStartX + 20,
                buttonEndY - buttonStartY + 20,
                5,
                new Color(50, 50, 50, 120).getRGB()
        );

        String greeting = getGreeting();
        Fonts.sfbold.drawCenteredText(matrixStack, "Paster Client", buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonStartY - 30,
                ColorUtils.rgb(255, 255, 255), 13, 0.1f);
        Fonts.sfMedium.drawCenteredText(matrixStack, greeting,
                buttonStartX + (buttonEndX - buttonStartX) / 2f,
                buttonEndY + 20,
                new Color(255, 255, 255).getRGB(), 10f);

        drawButtons(matrixStack, mouseX, mouseY, partialTicks);


        renderChangelogButton(matrixStack, mouseX, mouseY);


        if (showChangelog) {
            renderChangelog(matrixStack, mouseX, mouseY, partialTicks);
        }
    }

    private void renderChangelogButton(MatrixStack stack, int mouseX, int mouseY) {
        Button changelogBtn = buttons.get(buttons.size() - 1);
        int color = MathUtil.isHovered(mouseX, mouseY, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight()) ?
                ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(200, 200, 200);

        DisplayUtils.drawImage(changelogIcon, changelogBtn.getX(), changelogBtn.getY(),
                changelogBtn.getWidth(), changelogBtn.getHeight(), color);
    }

    private void renderChangelog(MatrixStack stack, int mouseX, int mouseY, float partialTicks) {
        // Анимация появления - исправление NPE
        long elapsedTime = changelogAnimation.getElapsedTimeSafe();
        if (changelogAnimation.isReached(200)) {
            changelogAlpha = Math.min(1f, changelogAlpha + 0.05f);
        } else {
            changelogAlpha = MathHelper.clamp((float) elapsedTime / 200f, 0f, 1f);
        }

        int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
        int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

        float panelWidth = 300;
        float panelHeight = 400;
        float panelX = (windowWidth - panelWidth) / 2f;
        panelY = (windowHeight - panelHeight) / 2f;


        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10,
                new Color(30, 30, 35, (int)(220 * changelogAlpha)).getRGB());


        Fonts.sfbold.drawCenteredText(stack, "Changelog build???", panelX + panelWidth / 2f,
                panelY + 15, new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 14f);


        float textY = panelY + 40;
        float textX = panelX + 15;

        String[] changes = {
                "§1• Обход АнтиОткида",
                "§2• Улучшена стабильность клиента",
                "§3• Русский Язык",
                "§4• Добавлен ChangeLog",
                "§5• Оптимизирована производительность",
                "§6• ",
                "§7• "
        };

        for (String change : changes) {
            Fonts.sfMedium.drawText(stack, change, textX, textY,
                    new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 10f);
            textY += 20;
        }


        float closeBtnSize = 20;
        float closeBtnX = panelX + panelWidth - closeBtnSize - 10;
        float closeBtnY = panelY + 10;

        boolean closeHovered = MathUtil.isHovered(mouseX, mouseY, closeBtnX, closeBtnY, closeBtnSize, closeBtnSize);
        DisplayUtils.drawRoundedRect(closeBtnX, closeBtnY, closeBtnSize, closeBtnSize, 5,
                new Color(closeHovered ? 255 : 200, 50, 50, (int)(200 * changelogAlpha)).getRGB());

        Fonts.sfMedium.drawCenteredText(stack, "X", closeBtnX + closeBtnSize / 2f,
                closeBtnY + closeBtnSize / 2f - 4,
                new Color(255, 255, 255, (int)(255 * changelogAlpha)).getRGB(), 12f);
    }

    private String getGreeting() {
        int hour = java.time.LocalTime.now().getHour();
        if (hour >= 6 && hour < 12) {
            return "Доброе утро!  <3";
        } else if (hour >= 12 && hour < 16) {
            return "Добрый день! :>";
        } else if (hour >= 16 && hour < 19) {
            return "Добрый вечер! <3";
        } else {
            return "Доброй ночи! >_<";
        }
    }

    @Override
    public boolean mouseClicked(double mouseX, double mouseY, int button) {
        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);


        if (showChangelog) {
            int windowWidth = ClientUtil.calc(mc.getMainWindow().getScaledWidth());
            int windowHeight = ClientUtil.calc(mc.getMainWindow().getScaledHeight());

            float panelWidth = 300;
            float panelX = (windowWidth - panelWidth) / 2f;

            float closeBtnSize = 20;
            float closeBtnX = panelX + panelWidth - closeBtnSize - 10;

            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), closeBtnX, panelY + 10, closeBtnSize, closeBtnSize)) {
                showChangelog = false;
                changelogAnimation.reset();
                return true;
            }
        }


        for (Button btn : buttons) {
            if (MathUtil.isHovered(fixed.getX(), fixed.getY(), btn.getX(), btn.getY(), btn.getWidth(), btn.getHeight())) {
                btn.click(fixed.getX(), fixed.getY(), button);
                return true;
            }
        }

        return super.mouseClicked(mouseX, mouseY, button);
    }

    private void drawButtons(MatrixStack stack, int mX, int mY, float pt) {

        for (int i = 0; i < buttons.size() - 1; i++) {
            buttons.get(i).render(stack, mX, mY, pt);
        }
    }

    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) {
            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, -1, MathHelper.clamp(size * multi, 0, 9));
            GlStateManager.popMatrix();
            if (y >= mc.getMainWindow().getScaledHeight()) {
                particles.remove(this);
            }
        }
    }

    @AllArgsConstructor
    private class Button {
        @Getter
        private final float x, y, width, height;
        private String text;
        private Runnable action;
        private final ResourceLocation singleplayer = new ResourceLocation("пастер/images/singleplayer.png");

        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
            float widthButton = 80;
            Stencil.initStencilToWrite();
            DisplayUtils.drawRoundedRect(x, y + 2, width, height, 5, -1);
            Stencil.readStencilBuffer(1);
            Stencil.uninitStencilBuffer();
            int colors = new Color(0, 0, 0).getRGB();
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                colors = ColorUtils.rgb(161, 164, 177);
            }

            DisplayUtils.drawShadow(x, y, width, height + 1, 6, new Color(21, 25, 40, 170).getRGB());

            int color = ColorUtils.rgb(161, 164, 177);
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                color = ColorUtils.rgb(255, 255, 255);
            }

            if (!text.isEmpty()) {
                Fonts.sfMedium.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 5.5f + 2, color, 9f);
            }
        }

        public void click(int mouseX, int mouseY, int button) {
            if (MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
                action.run();
            }
        }
    }
}
норм, ток глаза режет
 

Похожие темы

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