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

Исходник 3.1 exp ready|гпт, но норм альтменеджер под мейнскрин скида нурика (ссылка на сам мейнскрин ниже)

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
27 Июл 2025
Сообщения
26
Реакции
0
мейнскрин - https://yougame.biz/threads/362331/

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



altmanager::
Expand Collapse Copy
package im.bloodnight.ui.mainmenu;



import com.mojang.blaze3d.matrix.MatrixStack;

import im.bloodnight.utils.client.ClientUtil;

import im.bloodnight.utils.client.IMinecraft;

import im.bloodnight.utils.client.Vec2i;

import im.bloodnight.utils.math.MathUtil;

import im.bloodnight.utils.render.ColorUtils;

import im.bloodnight.utils.render.DisplayUtils;

import im.bloodnight.utils.render.font.Fonts;

import lombok.AllArgsConstructor;

import lombok.Getter;

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.screen.Screen;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.Session;

import net.minecraft.util.text.ITextComponent;

import org.lwjgl.glfw.GLFW;



import java.awt.*;

import java.awt.datatransfer.DataFlavor;

import java.lang.reflect.Field;

import java.util.ArrayList;

import java.util.List;

import java.util.UUID;



public class AltManagerScreen extends Screen implements IMinecraft {



    private final Screen parent;

    private final ResourceLocation background = new ResourceLocation("expensive/images/mainmenu/background.png");

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

 

    // Поле ввода ника

    private String inputText = "";

    private boolean inputFocused = false;

    private float inputX, inputY, inputWidth, inputHeight;

 

    // Статус

    private String statusMessage = "";

    private int statusColor = -1;

    private long statusTime = 0;

 

    // Позиция статуса

    private float statusY;



    public AltManagerScreen(Screen parent) {

        super(ITextComponent.getTextComponentOrEmpty("Alt Manager"));

        this.parent = parent;

    }



    [USER=1367676]@override[/USER]

    public void init(Minecraft minecraft, int width, int height) {

        super.init(minecraft, width, height);

     

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

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

     

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

     

        float buttonWidth = 120;

        float buttonHeight = 25;

     

        // Позиция поля ввода

        inputWidth = 200;

        inputHeight = 30;

        inputX = centerX - inputWidth / 2f;

        inputY = centerY - 40;

     

        buttons.clear();

     

        float buttonX = centerX - buttonWidth / 2f;

        float currentY = inputY + inputHeight + 20;

     

        // Кнопка "Применить"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Применить",

            this::applyNickname

        ));

     

        currentY += buttonHeight + 10;

     

        // Кнопка "Случайный ник"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Случайный ник",

            this::generateRandomNick

        ));

     

        currentY += buttonHeight + 10;

     

        // Кнопка "Назад"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Назад",

            () -> mc.displayGuiScreen(parent)

        ));

     

        // Позиция статуса - под всеми кнопками

        statusY = currentY + buttonHeight + 20;

    }



    [USER=1367676]@override[/USER]

    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {

        // Фон

        DisplayUtils.drawImage(background, 0, 0, width, height, -1);

     

        mc.gameRenderer.setupOverlayRendering(2);

     

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

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

     

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

     

        // Панель

        float panelWidth = 300;

        float panelHeight = 320;

        float panelX = centerX - panelWidth / 2f;

        float panelY = centerY - panelHeight / 2f;

     

        // Фон панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10, ColorUtils.rgba(15, 15, 20, 230));

     

        // Заголовок панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, 35, 10, ColorUtils.rgba(25, 25, 35, 255));

        Fonts.sfbold.drawCenteredText(matrixStack, "Alt Manager", centerX, panelY + 12, ColorUtils.rgb(17, 89, 235), 14);

     

        // Текущий ник

        String currentNick = mc.session.getUsername();

        Fonts.sfMedium.drawCenteredText(matrixStack, "Текущий ник: " + currentNick, centerX, inputY - 25, ColorUtils.rgb(180, 180, 180), 10);

     

        // Рамка поля ввода

        int inputBorderColor = inputFocused ? ColorUtils.rgb(17, 89, 235) : ColorUtils.rgba(60, 60, 70, 255);

        DisplayUtils.drawRoundedRect(inputX - 1, inputY - 1, inputWidth + 2, inputHeight + 2, 6, inputBorderColor);

     

        // Фон поля ввода

        DisplayUtils.drawRoundedRect(inputX, inputY, inputWidth, inputHeight, 5, ColorUtils.rgba(25, 25, 35, 255));

     

        // Текст в поле ввода

        String displayText = inputText;

        if (inputFocused && System.currentTimeMillis() % 1000 < 500) {

            displayText += "|";

        }

     

        if (inputText.isEmpty() && !inputFocused) {

            Fonts.sfMedium.drawText(matrixStack, "Введите ник...", inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgba(100, 100, 100, 255), 10);

        } else {

            Fonts.sfMedium.drawText(matrixStack, displayText, inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgb(255, 255, 255), 10);

        }

     

        // Кнопки

        buttons.forEach(b -> b.render(matrixStack, mouseX, mouseY, partialTicks));

     

        // Статус сообщение - под всеми кнопками

        if (!statusMessage.isEmpty() && System.currentTimeMillis() - statusTime < 3000) {

            Fonts.sfMedium.drawCenteredText(matrixStack, statusMessage, centerX, statusY, statusColor, 9);

        }

     

        super.render(matrixStack, mouseX, mouseY, partialTicks);

    }



    private void applyNickname() {

        if (inputText.isEmpty()) {

            setStatus("Введите ник!", ColorUtils.rgb(255, 80, 80));

            return;

        }

     

        if (inputText.length() < 3) {

            setStatus("Ник слишком короткий! (мин. 3 символа)", ColorUtils.rgb(255, 80, 80));

            return;

        }

     

        if (inputText.length() > 16) {

            setStatus("Ник слишком длинный! (макс. 16 символов)", ColorUtils.rgb(255, 80, 80));

            return;

        }

     

        if (!inputText.matches("^[a-zA-Z0-9_]+$")) {

            setStatus("Ник содержит недопустимые символы!", ColorUtils.rgb(255, 80, 80));

            return;

        }

     

        try {

            setSession(inputText);

            setStatus("Ник успешно изменён на: " + inputText, ColorUtils.rgb(80, 255, 80));

            inputText = "";

        } catch (Exception e) {

            setStatus("Ошибка: " + e.getMessage(), ColorUtils.rgb(255, 80, 80));

            e.printStackTrace();

        }

    }



    private void setSession(String username) throws Exception {

        // Создаём новую сессию

        Session newSession = new Session(

            username,

            UUID.randomUUID().toString().replace("-", ""),

            "0",

            "legacy"

        );

     

        // Получаем поле session через рефлексию

        Field sessionField = null;

        for (Field field : Minecraft.class.getDeclaredFields()) {

            if (field.getType() == Session.class) {

                sessionField = field;

                break;

            }

        }

     

        if (sessionField == null) {

            throw new Exception("Не удалось найти поле session");

        }

     

        sessionField.setAccessible(true);

        sessionField.set(mc, newSession);

    }



    private void generateRandomNick() {

        String[] prefixes = {"Dark", "Pro", "Cool", "Epic", "Fire", "Ice", "Shadow", "Light", "Storm", "Thunder", "Pixel", "Cyber", "Neo", "Max", "Ultra"};

        String[] suffixes = {"Player", "Gamer", "Master", "King", "Lord", "Ninja", "Warrior", "Hunter", "Beast", "Wolf", "Dragon", "Phoenix", "Tiger", "Hawk", "Viper"};

     

        String prefix = prefixes[(int) (Math.random() * prefixes.length)];

        String suffix = suffixes[(int) (Math.random() * suffixes.length)];

        int number = (int) (Math.random() * 1000);

     

        inputText = prefix + suffix + number;

        setStatus("Сгенерирован ник: " + inputText, ColorUtils.rgb(100, 180, 255));

    }



    private void setStatus(String message, int color) {

        this.statusMessage = message;

        this.statusColor = color;

        this.statusTime = System.currentTimeMillis();

    }



    [USER=1367676]@override[/USER]

    public boolean mouseClicked(double mouseX, double mouseY, int button) {

        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);

        int mX = fixed.getX();

        int mY = fixed.getY();

     

        // Проверяем клик по полю ввода

        inputFocused = MathUtil.isHovered(mX, mY, inputX, inputY, inputWidth, inputHeight);

     

        // Обрабатываем клики по кнопкам

        buttons.forEach(b -> b.click(mX, mY, button));

     

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

    }



    [USER=1367676]@override[/USER]

    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

        if (keyCode == GLFW.GLFW_KEY_ESCAPE) {

            mc.displayGuiScreen(parent);

            return true;

        }

     

        if (inputFocused) {

            // Backspace - удаление символа

            if (keyCode == GLFW.GLFW_KEY_BACKSPACE && !inputText.isEmpty()) {

                inputText = inputText.substring(0, inputText.length() - 1);

                return true;

            }

         

            // Enter - применение ника

            if (keyCode == GLFW.GLFW_KEY_ENTER) {

                applyNickname();

                return true;

            }

         

            // Ctrl+V - вставка из буфера

            if (keyCode == GLFW.GLFW_KEY_V && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                try {

                    String clipboard = (String) Toolkit.getDefaultToolkit()

                            .getSystemClipboard()

                            .getData(DataFlavor.stringFlavor);

                    if (clipboard != null) {

                        // Фильтруем только допустимые символы

                        clipboard = clipboard.replaceAll("[^a-zA-Z0-9_]", "");

                        if (inputText.length() + clipboard.length() <= 16) {

                            inputText += clipboard;

                        }

                    }

                } catch (Exception ignored) {}

                return true;

            }

         

            // Ctrl+A - выделить всё (очистка)

            if (keyCode == GLFW.GLFW_KEY_A && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                inputText = "";

                return true;

            }

        }

     

        return super.keyPressed(keyCode, scanCode, modifiers);

    }



    [USER=1367676]@override[/USER]

    public boolean charTyped(char codePoint, int modifiers) {

        if (inputFocused) {

            // Проверяем допустимые символы для ника

            if (Character.isLetterOrDigit(codePoint) || codePoint == '_') {

                if (inputText.length() < 16) {

                    inputText += codePoint;

                }

                return true;

            }

        }

        return super.charTyped(codePoint, modifiers);

    }



    [USER=1484803]@AllArgsConstructor[/USER]

    private class Button {

        [USER=270918]@Getter[/USER]

        private final float x, y, width, height;

        private String text;

        private Runnable action;



        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {

            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);

         

            int bgColor = hovered ? ColorUtils.rgba(17, 89, 235, 200) : ColorUtils.rgba(35, 35, 45, 255);

            int textColor = hovered ? ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(180, 180, 180);

         

            DisplayUtils.drawRoundedRect(x, y, width, height, 5, bgColor);

            Fonts.sfbold.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 10f);

        }



        public void click(int mouseX, int mouseY, int button) {

            if (button == 0 && MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {

                action.run();

            }

        }

    }

}




в мейнскрине смени buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));}));// На buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new AltManagerScreen(this));​

 
Последнее редактирование:
мейнскрин - https://yougame.biz/threads/362331/


package im.bloodnight.ui.mainmenu;

import com.mojang.blaze3d.matrix.MatrixStack;
import im.bloodnight.utils.client.ClientUtil;
import im.bloodnight.utils.client.IMinecraft;
import im.bloodnight.utils.client.Vec2i;
import im.bloodnight.utils.math.MathUtil;
import im.bloodnight.utils.render.ColorUtils;
import im.bloodnight.utils.render.DisplayUtils;
import im.bloodnight.utils.render.font.Fonts;
import lombok.AllArgsConstructor;
import lombok.Getter;
import net.minecraft.client.Minecraft;
import net.minecraft.client.gui.screen.Screen;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.Session;
import net.minecraft.util.text.ITextComponent;
import org.lwjgl.glfw.GLFW;

import java.awt.*;
import java.awt.datatransfer.DataFlavor;
import java.lang.reflect.Field;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;

public class AltManagerScreen extends Screen implements IMinecraft {

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

// Поле ввода ника
private String inputText = "";
private boolean inputFocused = false;
private float inputX, inputY, inputWidth, inputHeight;

// Статус
private String statusMessage = "";
private int statusColor = -1;
private long statusTime = 0;

// Позиция статуса
private float statusY;

public AltManagerScreen(Screen parent) {
super(ITextComponent.getTextComponentOrEmpty("Alt Manager"));
this.parent = parent;
}

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

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

float centerX = windowWidth / 2f;
float centerY = windowHeight / 2f;

float buttonWidth = 120;
float buttonHeight = 25;

// Позиция поля ввода
inputWidth = 200;
inputHeight = 30;
inputX = centerX - inputWidth / 2f;
inputY = centerY - 40;

buttons.clear();

float buttonX = centerX - buttonWidth / 2f;
float currentY = inputY + inputHeight + 20;

// Кнопка "Применить"
buttons.add(new Button(
buttonX,
currentY,
buttonWidth,
buttonHeight,
"Применить",
this::applyNickname
));

currentY += buttonHeight + 10;

// Кнопка "Случайный ник"
buttons.add(new Button(
buttonX,
currentY,
buttonWidth,
buttonHeight,
"Случайный ник",
this::generateRandomNick
));

currentY += buttonHeight + 10;

// Кнопка "Назад"
buttons.add(new Button(
buttonX,
currentY,
buttonWidth,
buttonHeight,
"Назад",
() -> mc.displayGuiScreen(parent)
));

// Позиция статуса - под всеми кнопками
statusY = currentY + buttonHeight + 20;
}

@override
public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
// Фон
DisplayUtils.drawImage(background, 0, 0, width, height, -1);

mc.gameRenderer.setupOverlayRendering(2);

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

float centerX = windowWidth / 2f;
float centerY = windowHeight / 2f;

// Панель
float panelWidth = 300;
float panelHeight = 320;
float panelX = centerX - panelWidth / 2f;
float panelY = centerY - panelHeight / 2f;

// Фон панели
DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10, ColorUtils.rgba(15, 15, 20, 230));

// Заголовок панели
DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, 35, 10, ColorUtils.rgba(25, 25, 35, 255));
Fonts.sfbold.drawCenteredText(matrixStack, "Alt Manager", centerX, panelY + 12, ColorUtils.rgb(17, 89, 235), 14);

// Текущий ник
String currentNick = mc.session.getUsername();
Fonts.sfMedium.drawCenteredText(matrixStack, "Текущий ник: " + currentNick, centerX, inputY - 25, ColorUtils.rgb(180, 180, 180), 10);

// Рамка поля ввода
int inputBorderColor = inputFocused ? ColorUtils.rgb(17, 89, 235) : ColorUtils.rgba(60, 60, 70, 255);
DisplayUtils.drawRoundedRect(inputX - 1, inputY - 1, inputWidth + 2, inputHeight + 2, 6, inputBorderColor);

// Фон поля ввода
DisplayUtils.drawRoundedRect(inputX, inputY, inputWidth, inputHeight, 5, ColorUtils.rgba(25, 25, 35, 255));

// Текст в поле ввода
String displayText = inputText;
if (inputFocused && System.currentTimeMillis() % 1000 < 500) {
displayText += "|";
}

if (inputText.isEmpty() && !inputFocused) {
Fonts.sfMedium.drawText(matrixStack, "Введите ник...", inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgba(100, 100, 100, 255), 10);
} else {
Fonts.sfMedium.drawText(matrixStack, displayText, inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgb(255, 255, 255), 10);
}

// Кнопки
buttons.forEach(b -> b.render(matrixStack, mouseX, mouseY, partialTicks));

// Статус сообщение - под всеми кнопками
if (!statusMessage.isEmpty() && System.currentTimeMillis() - statusTime < 3000) {
Fonts.sfMedium.drawCenteredText(matrixStack, statusMessage, centerX, statusY, statusColor, 9);
}

super.render(matrixStack, mouseX, mouseY, partialTicks);
}

private void applyNickname() {
if (inputText.isEmpty()) {
setStatus("Введите ник!", ColorUtils.rgb(255, 80, 80));
return;
}

if (inputText.length() < 3) {
setStatus("Ник слишком короткий! (мин. 3 символа)", ColorUtils.rgb(255, 80, 80));
return;
}

if (inputText.length() > 16) {
setStatus("Ник слишком длинный! (макс. 16 символов)", ColorUtils.rgb(255, 80, 80));
return;
}

if (!inputText.matches("^[a-zA-Z0-9_]+$")) {
setStatus("Ник содержит недопустимые символы!", ColorUtils.rgb(255, 80, 80));
return;
}

try {
setSession(inputText);
setStatus("Ник успешно изменён на: " + inputText, ColorUtils.rgb(80, 255, 80));
inputText = "";
} catch (Exception e) {
setStatus("Ошибка: " + e.getMessage(), ColorUtils.rgb(255, 80, 80));
e.printStackTrace();
}
}

private void setSession(String username) throws Exception {
// Создаём новую сессию
Session newSession = new Session(
username,
UUID.randomUUID().toString().replace("-", ""),
"0",
"legacy"
);

// Получаем поле session через рефлексию
Field sessionField = null;
for (Field field : Minecraft.class.getDeclaredFields()) {
if (field.getType() == Session.class) {
sessionField = field;
break;
}
}

if (sessionField == null) {
throw new Exception("Не удалось найти поле session");
}

sessionField.setAccessible(true);
sessionField.set(mc, newSession);
}

private void generateRandomNick() {
String[] prefixes = {"Dark", "Pro", "Cool", "Epic", "Fire", "Ice", "Shadow", "Light", "Storm", "Thunder", "Pixel", "Cyber", "Neo", "Max", "Ultra"};
String[] suffixes = {"Player", "Gamer", "Master", "King", "Lord", "Ninja", "Warrior", "Hunter", "Beast", "Wolf", "Dragon", "Phoenix", "Tiger", "Hawk", "Viper"};

String prefix = prefixes[(int) (Math.random() * prefixes.length)];
String suffix = suffixes[(int) (Math.random() * suffixes.length)];
int number = (int) (Math.random() * 1000);

inputText = prefix + suffix + number;
setStatus("Сгенерирован ник: " + inputText, ColorUtils.rgb(100, 180, 255));
}

private void setStatus(String message, int color) {
this.statusMessage = message;
this.statusColor = color;
this.statusTime = System.currentTimeMillis();
}

@override
public boolean mouseClicked(double mouseX, double mouseY, int button) {
Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);
int mX = fixed.getX();
int mY = fixed.getY();

// Проверяем клик по полю ввода
inputFocused = MathUtil.isHovered(mX, mY, inputX, inputY, inputWidth, inputHeight);

// Обрабатываем клики по кнопкам
buttons.forEach(b -> b.click(mX, mY, button));

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

@override
public boolean keyPressed(int keyCode, int scanCode, int modifiers) {
if (keyCode == GLFW.GLFW_KEY_ESCAPE) {
mc.displayGuiScreen(parent);
return true;
}

if (inputFocused) {
// Backspace - удаление символа
if (keyCode == GLFW.GLFW_KEY_BACKSPACE && !inputText.isEmpty()) {
inputText = inputText.substring(0, inputText.length() - 1);
return true;
}

// Enter - применение ника
if (keyCode == GLFW.GLFW_KEY_ENTER) {
applyNickname();
return true;
}

// Ctrl+V - вставка из буфера
if (keyCode == GLFW.GLFW_KEY_V && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {
try {
String clipboard = (String) Toolkit.getDefaultToolkit()
.getSystemClipboard()
.getData(DataFlavor.stringFlavor);
if (clipboard != null) {
// Фильтруем только допустимые символы
clipboard = clipboard.replaceAll("[^a-zA-Z0-9_]", "");
if (inputText.length() + clipboard.length() <= 16) {
inputText += clipboard;
}
}
} catch (Exception ignored) {}
return true;
}

// Ctrl+A - выделить всё (очистка)
if (keyCode == GLFW.GLFW_KEY_A && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {
inputText = "";
return true;
}
}

return super.keyPressed(keyCode, scanCode, modifiers);
}

@override
public boolean charTyped(char codePoint, int modifiers) {
if (inputFocused) {
// Проверяем допустимые символы для ника
if (Character.isLetterOrDigit(codePoint) || codePoint == '_') {
if (inputText.length() < 16) {
inputText += codePoint;
}
return true;
}
}
return super.charTyped(codePoint, modifiers);
}

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

public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {
boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);

int bgColor = hovered ? ColorUtils.rgba(17, 89, 235, 200) : ColorUtils.rgba(35, 35, 45, 255);
int textColor = hovered ? ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(180, 180, 180);

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

public void click(int mouseX, int mouseY, int button) {
if (button == 0 && MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {
action.run();
}
}
}
}




в мейнскрине смени buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));}));// На buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new AltManagerScreen(this));​

1770294350796.png
ну ес че
 
мейнскрин - https://yougame.biz/threads/362331/

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



altmanager::
Expand Collapse Copy
package im.bloodnight.ui.mainmenu;



import com.mojang.blaze3d.matrix.MatrixStack;

import im.bloodnight.utils.client.ClientUtil;

import im.bloodnight.utils.client.IMinecraft;

import im.bloodnight.utils.client.Vec2i;

import im.bloodnight.utils.math.MathUtil;

import im.bloodnight.utils.render.ColorUtils;

import im.bloodnight.utils.render.DisplayUtils;

import im.bloodnight.utils.render.font.Fonts;

import lombok.AllArgsConstructor;

import lombok.Getter;

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.screen.Screen;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.Session;

import net.minecraft.util.text.ITextComponent;

import org.lwjgl.glfw.GLFW;



import java.awt.*;

import java.awt.datatransfer.DataFlavor;

import java.lang.reflect.Field;

import java.util.ArrayList;

import java.util.List;

import java.util.UUID;



public class AltManagerScreen extends Screen implements IMinecraft {



    private final Screen parent;

    private final ResourceLocation background = new ResourceLocation("expensive/images/mainmenu/background.png");

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

 

    // Поле ввода ника

    private String inputText = "";

    private boolean inputFocused = false;

    private float inputX, inputY, inputWidth, inputHeight;

 

    // Статус

    private String statusMessage = "";

    private int statusColor = -1;

    private long statusTime = 0;

 

    // Позиция статуса

    private float statusY;



    public AltManagerScreen(Screen parent) {

        super(ITextComponent.getTextComponentOrEmpty("Alt Manager"));

        this.parent = parent;

    }



    [USER=1367676]@override[/USER]

    public void init(Minecraft minecraft, int width, int height) {

        super.init(minecraft, width, height);

    

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

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

    

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

    

        float buttonWidth = 120;

        float buttonHeight = 25;

    

        // Позиция поля ввода

        inputWidth = 200;

        inputHeight = 30;

        inputX = centerX - inputWidth / 2f;

        inputY = centerY - 40;

    

        buttons.clear();

    

        float buttonX = centerX - buttonWidth / 2f;

        float currentY = inputY + inputHeight + 20;

    

        // Кнопка "Применить"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Применить",

            this::applyNickname

        ));

    

        currentY += buttonHeight + 10;

    

        // Кнопка "Случайный ник"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Случайный ник",

            this::generateRandomNick

        ));

    

        currentY += buttonHeight + 10;

    

        // Кнопка "Назад"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Назад",

            () -> mc.displayGuiScreen(parent)

        ));

    

        // Позиция статуса - под всеми кнопками

        statusY = currentY + buttonHeight + 20;

    }



    [USER=1367676]@override[/USER]

    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {

        // Фон

        DisplayUtils.drawImage(background, 0, 0, width, height, -1);

    

        mc.gameRenderer.setupOverlayRendering(2);

    

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

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

    

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

    

        // Панель

        float panelWidth = 300;

        float panelHeight = 320;

        float panelX = centerX - panelWidth / 2f;

        float panelY = centerY - panelHeight / 2f;

    

        // Фон панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10, ColorUtils.rgba(15, 15, 20, 230));

    

        // Заголовок панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, 35, 10, ColorUtils.rgba(25, 25, 35, 255));

        Fonts.sfbold.drawCenteredText(matrixStack, "Alt Manager", centerX, panelY + 12, ColorUtils.rgb(17, 89, 235), 14);

    

        // Текущий ник

        String currentNick = mc.session.getUsername();

        Fonts.sfMedium.drawCenteredText(matrixStack, "Текущий ник: " + currentNick, centerX, inputY - 25, ColorUtils.rgb(180, 180, 180), 10);

    

        // Рамка поля ввода

        int inputBorderColor = inputFocused ? ColorUtils.rgb(17, 89, 235) : ColorUtils.rgba(60, 60, 70, 255);

        DisplayUtils.drawRoundedRect(inputX - 1, inputY - 1, inputWidth + 2, inputHeight + 2, 6, inputBorderColor);

    

        // Фон поля ввода

        DisplayUtils.drawRoundedRect(inputX, inputY, inputWidth, inputHeight, 5, ColorUtils.rgba(25, 25, 35, 255));

    

        // Текст в поле ввода

        String displayText = inputText;

        if (inputFocused && System.currentTimeMillis() % 1000 < 500) {

            displayText += "|";

        }

    

        if (inputText.isEmpty() && !inputFocused) {

            Fonts.sfMedium.drawText(matrixStack, "Введите ник...", inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgba(100, 100, 100, 255), 10);

        } else {

            Fonts.sfMedium.drawText(matrixStack, displayText, inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgb(255, 255, 255), 10);

        }

    

        // Кнопки

        buttons.forEach(b -> b.render(matrixStack, mouseX, mouseY, partialTicks));

    

        // Статус сообщение - под всеми кнопками

        if (!statusMessage.isEmpty() && System.currentTimeMillis() - statusTime < 3000) {

            Fonts.sfMedium.drawCenteredText(matrixStack, statusMessage, centerX, statusY, statusColor, 9);

        }

    

        super.render(matrixStack, mouseX, mouseY, partialTicks);

    }



    private void applyNickname() {

        if (inputText.isEmpty()) {

            setStatus("Введите ник!", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (inputText.length() < 3) {

            setStatus("Ник слишком короткий! (мин. 3 символа)", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (inputText.length() > 16) {

            setStatus("Ник слишком длинный! (макс. 16 символов)", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (!inputText.matches("^[a-zA-Z0-9_]+$")) {

            setStatus("Ник содержит недопустимые символы!", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        try {

            setSession(inputText);

            setStatus("Ник успешно изменён на: " + inputText, ColorUtils.rgb(80, 255, 80));

            inputText = "";

        } catch (Exception e) {

            setStatus("Ошибка: " + e.getMessage(), ColorUtils.rgb(255, 80, 80));

            e.printStackTrace();

        }

    }



    private void setSession(String username) throws Exception {

        // Создаём новую сессию

        Session newSession = new Session(

            username,

            UUID.randomUUID().toString().replace("-", ""),

            "0",

            "legacy"

        );

    

        // Получаем поле session через рефлексию

        Field sessionField = null;

        for (Field field : Minecraft.class.getDeclaredFields()) {

            if (field.getType() == Session.class) {

                sessionField = field;

                break;

            }

        }

    

        if (sessionField == null) {

            throw new Exception("Не удалось найти поле session");

        }

    

        sessionField.setAccessible(true);

        sessionField.set(mc, newSession);

    }



    private void generateRandomNick() {

        String[] prefixes = {"Dark", "Pro", "Cool", "Epic", "Fire", "Ice", "Shadow", "Light", "Storm", "Thunder", "Pixel", "Cyber", "Neo", "Max", "Ultra"};

        String[] suffixes = {"Player", "Gamer", "Master", "King", "Lord", "Ninja", "Warrior", "Hunter", "Beast", "Wolf", "Dragon", "Phoenix", "Tiger", "Hawk", "Viper"};

    

        String prefix = prefixes[(int) (Math.random() * prefixes.length)];

        String suffix = suffixes[(int) (Math.random() * suffixes.length)];

        int number = (int) (Math.random() * 1000);

    

        inputText = prefix + suffix + number;

        setStatus("Сгенерирован ник: " + inputText, ColorUtils.rgb(100, 180, 255));

    }



    private void setStatus(String message, int color) {

        this.statusMessage = message;

        this.statusColor = color;

        this.statusTime = System.currentTimeMillis();

    }



    [USER=1367676]@override[/USER]

    public boolean mouseClicked(double mouseX, double mouseY, int button) {

        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);

        int mX = fixed.getX();

        int mY = fixed.getY();

    

        // Проверяем клик по полю ввода

        inputFocused = MathUtil.isHovered(mX, mY, inputX, inputY, inputWidth, inputHeight);

    

        // Обрабатываем клики по кнопкам

        buttons.forEach(b -> b.click(mX, mY, button));

    

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

    }



    [USER=1367676]@override[/USER]

    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

        if (keyCode == GLFW.GLFW_KEY_ESCAPE) {

            mc.displayGuiScreen(parent);

            return true;

        }

    

        if (inputFocused) {

            // Backspace - удаление символа

            if (keyCode == GLFW.GLFW_KEY_BACKSPACE && !inputText.isEmpty()) {

                inputText = inputText.substring(0, inputText.length() - 1);

                return true;

            }

        

            // Enter - применение ника

            if (keyCode == GLFW.GLFW_KEY_ENTER) {

                applyNickname();

                return true;

            }

        

            // Ctrl+V - вставка из буфера

            if (keyCode == GLFW.GLFW_KEY_V && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                try {

                    String clipboard = (String) Toolkit.getDefaultToolkit()

                            .getSystemClipboard()

                            .getData(DataFlavor.stringFlavor);

                    if (clipboard != null) {

                        // Фильтруем только допустимые символы

                        clipboard = clipboard.replaceAll("[^a-zA-Z0-9_]", "");

                        if (inputText.length() + clipboard.length() <= 16) {

                            inputText += clipboard;

                        }

                    }

                } catch (Exception ignored) {}

                return true;

            }

        

            // Ctrl+A - выделить всё (очистка)

            if (keyCode == GLFW.GLFW_KEY_A && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                inputText = "";

                return true;

            }

        }

    

        return super.keyPressed(keyCode, scanCode, modifiers);

    }



    [USER=1367676]@override[/USER]

    public boolean charTyped(char codePoint, int modifiers) {

        if (inputFocused) {

            // Проверяем допустимые символы для ника

            if (Character.isLetterOrDigit(codePoint) || codePoint == '_') {

                if (inputText.length() < 16) {

                    inputText += codePoint;

                }

                return true;

            }

        }

        return super.charTyped(codePoint, modifiers);

    }



    [USER=1484803]@AllArgsConstructor[/USER]

    private class Button {

        [USER=270918]@Getter[/USER]

        private final float x, y, width, height;

        private String text;

        private Runnable action;



        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {

            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);

        

            int bgColor = hovered ? ColorUtils.rgba(17, 89, 235, 200) : ColorUtils.rgba(35, 35, 45, 255);

            int textColor = hovered ? ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(180, 180, 180);

        

            DisplayUtils.drawRoundedRect(x, y, width, height, 5, bgColor);

            Fonts.sfbold.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 10f);

        }



        public void click(int mouseX, int mouseY, int button) {

            if (button == 0 && MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {

                action.run();

            }

        }

    }

}




в мейнскрине смени buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));}));// На buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new AltManagerScreen(this));​

вы и сюда добрались
 
мейнскрин - https://yougame.biz/threads/362331/

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



altmanager::
Expand Collapse Copy
package im.bloodnight.ui.mainmenu;



import com.mojang.blaze3d.matrix.MatrixStack;

import im.bloodnight.utils.client.ClientUtil;

import im.bloodnight.utils.client.IMinecraft;

import im.bloodnight.utils.client.Vec2i;

import im.bloodnight.utils.math.MathUtil;

import im.bloodnight.utils.render.ColorUtils;

import im.bloodnight.utils.render.DisplayUtils;

import im.bloodnight.utils.render.font.Fonts;

import lombok.AllArgsConstructor;

import lombok.Getter;

import net.minecraft.client.Minecraft;

import net.minecraft.client.gui.screen.Screen;

import net.minecraft.util.ResourceLocation;

import net.minecraft.util.Session;

import net.minecraft.util.text.ITextComponent;

import org.lwjgl.glfw.GLFW;



import java.awt.*;

import java.awt.datatransfer.DataFlavor;

import java.lang.reflect.Field;

import java.util.ArrayList;

import java.util.List;

import java.util.UUID;



public class AltManagerScreen extends Screen implements IMinecraft {



    private final Screen parent;

    private final ResourceLocation background = new ResourceLocation("expensive/images/mainmenu/background.png");

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

 

    // Поле ввода ника

    private String inputText = "";

    private boolean inputFocused = false;

    private float inputX, inputY, inputWidth, inputHeight;

 

    // Статус

    private String statusMessage = "";

    private int statusColor = -1;

    private long statusTime = 0;

 

    // Позиция статуса

    private float statusY;



    public AltManagerScreen(Screen parent) {

        super(ITextComponent.getTextComponentOrEmpty("Alt Manager"));

        this.parent = parent;

    }



    [USER=1367676]@override[/USER]

    public void init(Minecraft minecraft, int width, int height) {

        super.init(minecraft, width, height);

    

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

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

    

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

    

        float buttonWidth = 120;

        float buttonHeight = 25;

    

        // Позиция поля ввода

        inputWidth = 200;

        inputHeight = 30;

        inputX = centerX - inputWidth / 2f;

        inputY = centerY - 40;

    

        buttons.clear();

    

        float buttonX = centerX - buttonWidth / 2f;

        float currentY = inputY + inputHeight + 20;

    

        // Кнопка "Применить"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Применить",

            this::applyNickname

        ));

    

        currentY += buttonHeight + 10;

    

        // Кнопка "Случайный ник"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Случайный ник",

            this::generateRandomNick

        ));

    

        currentY += buttonHeight + 10;

    

        // Кнопка "Назад"

        buttons.add(new Button(

            buttonX,

            currentY,

            buttonWidth,

            buttonHeight,

            "Назад",

            () -> mc.displayGuiScreen(parent)

        ));

    

        // Позиция статуса - под всеми кнопками

        statusY = currentY + buttonHeight + 20;

    }



    [USER=1367676]@override[/USER]

    public void render(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {

        // Фон

        DisplayUtils.drawImage(background, 0, 0, width, height, -1);

    

        mc.gameRenderer.setupOverlayRendering(2);

    

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

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

    

        float centerX = windowWidth / 2f;

        float centerY = windowHeight / 2f;

    

        // Панель

        float panelWidth = 300;

        float panelHeight = 320;

        float panelX = centerX - panelWidth / 2f;

        float panelY = centerY - panelHeight / 2f;

    

        // Фон панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, panelHeight, 10, ColorUtils.rgba(15, 15, 20, 230));

    

        // Заголовок панели

        DisplayUtils.drawRoundedRect(panelX, panelY, panelWidth, 35, 10, ColorUtils.rgba(25, 25, 35, 255));

        Fonts.sfbold.drawCenteredText(matrixStack, "Alt Manager", centerX, panelY + 12, ColorUtils.rgb(17, 89, 235), 14);

    

        // Текущий ник

        String currentNick = mc.session.getUsername();

        Fonts.sfMedium.drawCenteredText(matrixStack, "Текущий ник: " + currentNick, centerX, inputY - 25, ColorUtils.rgb(180, 180, 180), 10);

    

        // Рамка поля ввода

        int inputBorderColor = inputFocused ? ColorUtils.rgb(17, 89, 235) : ColorUtils.rgba(60, 60, 70, 255);

        DisplayUtils.drawRoundedRect(inputX - 1, inputY - 1, inputWidth + 2, inputHeight + 2, 6, inputBorderColor);

    

        // Фон поля ввода

        DisplayUtils.drawRoundedRect(inputX, inputY, inputWidth, inputHeight, 5, ColorUtils.rgba(25, 25, 35, 255));

    

        // Текст в поле ввода

        String displayText = inputText;

        if (inputFocused && System.currentTimeMillis() % 1000 < 500) {

            displayText += "|";

        }

    

        if (inputText.isEmpty() && !inputFocused) {

            Fonts.sfMedium.drawText(matrixStack, "Введите ник...", inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgba(100, 100, 100, 255), 10);

        } else {

            Fonts.sfMedium.drawText(matrixStack, displayText, inputX + 10, inputY + inputHeight / 2f - 4, ColorUtils.rgb(255, 255, 255), 10);

        }

    

        // Кнопки

        buttons.forEach(b -> b.render(matrixStack, mouseX, mouseY, partialTicks));

    

        // Статус сообщение - под всеми кнопками

        if (!statusMessage.isEmpty() && System.currentTimeMillis() - statusTime < 3000) {

            Fonts.sfMedium.drawCenteredText(matrixStack, statusMessage, centerX, statusY, statusColor, 9);

        }

    

        super.render(matrixStack, mouseX, mouseY, partialTicks);

    }



    private void applyNickname() {

        if (inputText.isEmpty()) {

            setStatus("Введите ник!", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (inputText.length() < 3) {

            setStatus("Ник слишком короткий! (мин. 3 символа)", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (inputText.length() > 16) {

            setStatus("Ник слишком длинный! (макс. 16 символов)", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        if (!inputText.matches("^[a-zA-Z0-9_]+$")) {

            setStatus("Ник содержит недопустимые символы!", ColorUtils.rgb(255, 80, 80));

            return;

        }

    

        try {

            setSession(inputText);

            setStatus("Ник успешно изменён на: " + inputText, ColorUtils.rgb(80, 255, 80));

            inputText = "";

        } catch (Exception e) {

            setStatus("Ошибка: " + e.getMessage(), ColorUtils.rgb(255, 80, 80));

            e.printStackTrace();

        }

    }



    private void setSession(String username) throws Exception {

        // Создаём новую сессию

        Session newSession = new Session(

            username,

            UUID.randomUUID().toString().replace("-", ""),

            "0",

            "legacy"

        );

    

        // Получаем поле session через рефлексию

        Field sessionField = null;

        for (Field field : Minecraft.class.getDeclaredFields()) {

            if (field.getType() == Session.class) {

                sessionField = field;

                break;

            }

        }

    

        if (sessionField == null) {

            throw new Exception("Не удалось найти поле session");

        }

    

        sessionField.setAccessible(true);

        sessionField.set(mc, newSession);

    }



    private void generateRandomNick() {

        String[] prefixes = {"Dark", "Pro", "Cool", "Epic", "Fire", "Ice", "Shadow", "Light", "Storm", "Thunder", "Pixel", "Cyber", "Neo", "Max", "Ultra"};

        String[] suffixes = {"Player", "Gamer", "Master", "King", "Lord", "Ninja", "Warrior", "Hunter", "Beast", "Wolf", "Dragon", "Phoenix", "Tiger", "Hawk", "Viper"};

    

        String prefix = prefixes[(int) (Math.random() * prefixes.length)];

        String suffix = suffixes[(int) (Math.random() * suffixes.length)];

        int number = (int) (Math.random() * 1000);

    

        inputText = prefix + suffix + number;

        setStatus("Сгенерирован ник: " + inputText, ColorUtils.rgb(100, 180, 255));

    }



    private void setStatus(String message, int color) {

        this.statusMessage = message;

        this.statusColor = color;

        this.statusTime = System.currentTimeMillis();

    }



    [USER=1367676]@override[/USER]

    public boolean mouseClicked(double mouseX, double mouseY, int button) {

        Vec2i fixed = ClientUtil.getMouse((int) mouseX, (int) mouseY);

        int mX = fixed.getX();

        int mY = fixed.getY();

    

        // Проверяем клик по полю ввода

        inputFocused = MathUtil.isHovered(mX, mY, inputX, inputY, inputWidth, inputHeight);

    

        // Обрабатываем клики по кнопкам

        buttons.forEach(b -> b.click(mX, mY, button));

    

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

    }



    [USER=1367676]@override[/USER]

    public boolean keyPressed(int keyCode, int scanCode, int modifiers) {

        if (keyCode == GLFW.GLFW_KEY_ESCAPE) {

            mc.displayGuiScreen(parent);

            return true;

        }

    

        if (inputFocused) {

            // Backspace - удаление символа

            if (keyCode == GLFW.GLFW_KEY_BACKSPACE && !inputText.isEmpty()) {

                inputText = inputText.substring(0, inputText.length() - 1);

                return true;

            }

        

            // Enter - применение ника

            if (keyCode == GLFW.GLFW_KEY_ENTER) {

                applyNickname();

                return true;

            }

        

            // Ctrl+V - вставка из буфера

            if (keyCode == GLFW.GLFW_KEY_V && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                try {

                    String clipboard = (String) Toolkit.getDefaultToolkit()

                            .getSystemClipboard()

                            .getData(DataFlavor.stringFlavor);

                    if (clipboard != null) {

                        // Фильтруем только допустимые символы

                        clipboard = clipboard.replaceAll("[^a-zA-Z0-9_]", "");

                        if (inputText.length() + clipboard.length() <= 16) {

                            inputText += clipboard;

                        }

                    }

                } catch (Exception ignored) {}

                return true;

            }

        

            // Ctrl+A - выделить всё (очистка)

            if (keyCode == GLFW.GLFW_KEY_A && (modifiers & GLFW.GLFW_MOD_CONTROL) != 0) {

                inputText = "";

                return true;

            }

        }

    

        return super.keyPressed(keyCode, scanCode, modifiers);

    }



    [USER=1367676]@override[/USER]

    public boolean charTyped(char codePoint, int modifiers) {

        if (inputFocused) {

            // Проверяем допустимые символы для ника

            if (Character.isLetterOrDigit(codePoint) || codePoint == '_') {

                if (inputText.length() < 16) {

                    inputText += codePoint;

                }

                return true;

            }

        }

        return super.charTyped(codePoint, modifiers);

    }



    [USER=1484803]@AllArgsConstructor[/USER]

    private class Button {

        [USER=270918]@Getter[/USER]

        private final float x, y, width, height;

        private String text;

        private Runnable action;



        public void render(MatrixStack stack, int mouseX, int mouseY, float pt) {

            boolean hovered = MathUtil.isHovered(mouseX, mouseY, x, y, width, height);

        

            int bgColor = hovered ? ColorUtils.rgba(17, 89, 235, 200) : ColorUtils.rgba(35, 35, 45, 255);

            int textColor = hovered ? ColorUtils.rgb(255, 255, 255) : ColorUtils.rgb(180, 180, 180);

        

            DisplayUtils.drawRoundedRect(x, y, width, height, 5, bgColor);

            Fonts.sfbold.drawCenteredText(stack, text, x + width / 2f, y + height / 2f - 4, textColor, 10f);

        }



        public void click(int mouseX, int mouseY, int button) {

            if (button == 0 && MathUtil.isHovered(mouseX, mouseY, x, y, width, height)) {

                action.run();

            }

        }

    }

}




в мейнскрине смени buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new OptionsScreen(this, mc.gameSettings));}));// На buttons.add(new Button(x, y, widthButton, 25, "Аккаунты", () -> { mc.displayGuiScreen(new AltManagerScreen(this));​

от скида тут только название
 
от скида тут только название
Я не про альтменеджер, а мейнскрин
от скида тут только название
Я не про альтменеджер, а
какой же ужас...
Я его чуть дороботал, а так согл это ужас
 
Назад
Сверху Снизу