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

Вопрос Свой рендер в MainMenu

Начинающий
Начинающий
Статус
Оффлайн
Регистрация
16 Фев 2026
Сообщения
17
Реакции
4
салам, у меня есть заготовка(?) для кастомного mainmenu на Fabric 1.21.11, но вот у меня появился вопрос, как всунуть туда свой рендер? (чат лгбт ничего внятного сказать не смог)

вот код для маинменю

MainMenuScreen:
Expand Collapse Copy
package lol.Stellar.ui;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;

public class MainMenuScreen extends Screen {

    public MainMenuScreen() {
        super(Text.literal("MainMenu"));
    }

    @Override
    protected void init() {
        super.init();
        this.addDrawableChild(ButtonWidget.builder(Text.literal("Singleplayer"), button -> {
            if (this.client != null) {
                this.client.setScreen(new SelectWorldScreen(this));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 24, 200, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Multiplayer"), button -> {
            if (this.client != null) {
                this.client.setScreen(new MultiplayerScreen(this));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 48, 200, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Options..."), button -> {
            if (this.client != null) {
                this.client.setScreen(new OptionsScreen(this, this.client.options));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 72, 98, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Quit Game"), button -> {
            if (this.client != null) {
                this.client.scheduleStop();
            }
        }).dimensions(this.width / 2 + 2, this.height / 4 + 72, 98, 20).build());
    }

    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
}

а вот код ректа который я хочу всунуть в меню

Рект:
Expand Collapse Copy
public static void drawRoundedRect(Matrix4f matrix, float x, float y, float width, float height, float radius,
    boolean overrideContext, int... colors) {
    drawRoundedRect(matrix, x, y, width, height, radius, radius, radius, radius, overrideContext, colors);
}

помогите пж я ток учу джаву
 
салам, у меня есть заготовка(?) для кастомного mainmenu на Fabric 1.21.11, но вот у меня появился вопрос, как всунуть туда свой рендер? (чат лгбт ничего внятного сказать не смог)

вот код для маинменю

MainMenuScreen:
Expand Collapse Copy
package lol.Stellar.ui;

import net.minecraft.client.gui.screen.Screen;
import net.minecraft.client.gui.screen.multiplayer.MultiplayerScreen;
import net.minecraft.client.gui.screen.option.OptionsScreen;
import net.minecraft.client.gui.screen.world.SelectWorldScreen;
import net.minecraft.client.gui.widget.ButtonWidget;
import net.minecraft.text.Text;

public class MainMenuScreen extends Screen {

    public MainMenuScreen() {
        super(Text.literal("MainMenu"));
    }

    @Override
    protected void init() {
        super.init();
        this.addDrawableChild(ButtonWidget.builder(Text.literal("Singleplayer"), button -> {
            if (this.client != null) {
                this.client.setScreen(new SelectWorldScreen(this));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 24, 200, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Multiplayer"), button -> {
            if (this.client != null) {
                this.client.setScreen(new MultiplayerScreen(this));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 48, 200, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Options..."), button -> {
            if (this.client != null) {
                this.client.setScreen(new OptionsScreen(this, this.client.options));
            }
        }).dimensions(this.width / 2 - 100, this.height / 4 + 72, 98, 20).build());

        this.addDrawableChild(ButtonWidget.builder(Text.literal("Quit Game"), button -> {
            if (this.client != null) {
                this.client.scheduleStop();
            }
        }).dimensions(this.width / 2 + 2, this.height / 4 + 72, 98, 20).build());
    }

    @Override
    public boolean shouldCloseOnEsc() {
        return false;
    }
}

а вот код ректа который я хочу всунуть в меню

Рект:
Expand Collapse Copy
public static void drawRoundedRect(Matrix4f matrix, float x, float y, float width, float height, float radius,
    boolean overrideContext, int... colors) {
    drawRoundedRect(matrix, x, y, width, height, radius, radius, radius, radius, overrideContext, colors);
}

помогите пж я ток учу джаву
просто в рендере им рисуешь через context.getMatricies()
 
Назад
Сверху Снизу