Исходник Добавляем кастомные кнопки | MCP 1.16.5 && Expensive 3.1

Начинающий
Статус
Оффлайн
Регистрация
8 Май 2023
Сообщения
438
Реакции[?]
5
Поинты[?]
6K
Короче, заходим в класс Widget (net/minecraft/client/gui/widget/Widget.java) и переходим к методу renderButton, туда мы вставляем это:


селфкод?:
    public void renderButton(MatrixStack matrixStack, int mouseX, int mouseY, float partialTicks) {
        Minecraft minecraft = Minecraft.getInstance();
        FontRenderer fontrenderer = minecraft.fontRenderer;
        minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
        int i = this.getYImage(this.isHovered());
        RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
        RenderSystem.enableBlend();
        RenderSystem.defaultBlendFunc();
        RenderSystem.enableDepthTest();
        int j = this.active ? 16777215 : 10526880;
        this.renderBg(matrixStack, minecraft, mouseX, mouseY);
        DisplayUtils.drawStyledRect( this.x, this.y, this.width, this.height , 4);
        Fonts.sfbold2.drawCenteredText(matrixStack, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, 8);

        /**
         * [USER=804731]@param[/USER] Цикл я добавил чтобы не занимало слишком много места
         * [USER=804731]@param[/USER] Кстати, к сожалению я о isHovered узнал только сегодня :(
         * */
       
        if (MathUtil.isHovered(mouseX, mouseY, x,y,width,height)) {
            for (int xd = 0; xd < 2; xd++) {
                DisplayUtils.drawShadow(this.x, this.y, this.width + 0.7f, this.height + 3f, 20, ColorUtils.setAlpha(HUD.getColor(1), 55));
            }
            DisplayUtils.drawRoundedRect( this.x, this.y, this.width, this.height , 4, ColorUtils.setAlpha(HUD.getColor(1), 55));

        }

        else if (SelfDestruct.unhooked) {
            minecraft.getTextureManager().bindTexture(WIDGETS_LOCATION);
            RenderSystem.color4f(1.0F, 1.0F, 1.0F, this.alpha);
            RenderSystem.enableBlend();
            RenderSystem.defaultBlendFunc();
            RenderSystem.enableDepthTest();
            this.blit(matrixStack, this.x, this.y, 0, 46 + i * 20, this.width / 2, this.height);
            this.blit(matrixStack, this.x + this.width / 2, this.y, 200 - this.width / 2, 46 + i * 20, this.width / 2, this.height);
            this.renderBg(matrixStack, minecraft, mouseX, mouseY);
            drawCenteredString(matrixStack, fontrenderer, this.getMessage(), this.x + this.width / 2, this.y + (this.height - 8) / 2, j | MathHelper.ceil(this.alpha * 255.0F) << 24);
        }
        this.renderBg(matrixStack, minecraft, mouseX, mouseY);
    }
Дальше запускаем софт и наслаждаемся кнопочками :)

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