Dplaysgame game
📎 1 file 1,007 chars
📄
pasted-code-1793312552430.txt
txt 22 lines
▶
Create a client-side Fabric mod for Minecraft Java Edition 26.3 that modifies the vanilla title screen and pause menu layouts.

Feature 1 — Remove Realms Button
Remove the Minecraft Realms button from the title screen and move the smaller utility buttons upward to eliminate the empty space.

Feature 2 — Reposition Utility Buttons
Move the smaller utility buttons below the main action buttons on both screens:

    Title screen: below Options and Quit Game.

    Pause menu: below the last main action button, including Disconnect or Save and Quit to Title.

Configuration
Add two independent toggles to an in-game mod configuration screen:

    Remove Realms Button (enabled by default).

    Reposition Utility Buttons (enabled by default).

Both settings must work independently and persist after restarting the game. Disabling both must restore the vanilla layouts.

Preserve all original button functionality, icons, tooltips, and vanilla styling. Support different screen resolutions and GUI scales.
Kodari AI
KodariOct 29 at 10:31 pm 2
TitleScreenOverhaul
A client-side Fabric mod for Minecraft 26.3 that modifies the vanilla title screen and pause menu. Removes the Realms button and repositions utility buttons below main action buttons on both screens. Features two independent toggles in an in-game configuration screen, both enabled by default and persisting across restarts. Preserves all original button functionality, icons, tooltips, and vanilla styling while supporting various screen resolutions and GUI scales. Disabling both settings restores vanilla layouts completely.
  1. Inspect 26.3 title/pause screen and widget APIs so the layout changes preserve vanilla buttons.

  2. Read YACL and ModMenu integration docs for persistent, in-game toggles.

  3. Create the Fabric client mod, mixins, config screen, and required project metadata.

Created the client-side Fabric 26.3 mod. It removes the title-screen Realms button and moves the existing utility buttons below the main actions on both screens, preserving their vanilla behavior and appearance.

The two independent, enabled-by-default settings are available through Mods → Configure and persist in config/titlelayout.json. Changes apply when the relevant screen is initialized again.

Dplaysgame game
📎 1 file 2,520 chars
📄
pasted-code-1793314662780.txt
txt 49 lines
▶
working, so do not rewrite the mod from scratch or change behavior that is already correct.

I've attached screenshots showing the current results.

1. Fix the Pause Menu Spacing

In the pause menu, there is a large, unnecessary vertical gap between the upper buttons (Back to Game, Advancements, and Statistics) and the lower buttons (Options, World Options/Open to LAN, and Disconnect).

Fix: Reduce this gap so the button groups are closer together, producing a compact, visually balanced layout.

Preserve the existing button sizes, horizontal alignment, spacing within each row, and the utility buttons' current position below Disconnect.

The layout should resemble the original vanilla pause menu, with the utility buttons moved to the bottom and the main buttons arranged naturally without a large empty space in the middle.

2. Remove the Realms News Icon

The Realms button has successfully disappeared from the title screen, but the separate Realms news icon is still visible.

Fix: Remove the Realms news icon and its associated clickable widget from the title screen whenever the "Remove Realms Button" setting is enabled.

Do not merely hide its texture. Remove or disable the associated widget so it cannot be clicked and does not leave an unnecessary clickable area.

When the setting is disabled, restore the original Realms news icon and its normal functionality.

Do not affect unrelated title-screen elements or other news features.

3. Fix the Title Screen Utility Button Position

The Realms button is successfully removed, but the smaller utility buttons have not moved upward to fill the available space.

Fix: When "Remove Realms Button" is enabled, move the smaller utility buttons upward to eliminate the gap left by the removed Realms button.

Keep them centered horizontally and maintain consistent spacing between icons.

When "Remove Realms Button" is disabled, preserve the appropriate vanilla positioning unless the separate "Reposition Utility Buttons" setting requires a different layout.

Important Requirements

Preserve both existing configuration options and their independent behavior.

Keep all previously working features intact.

Ensure all layout changes work across different screen resolutions and GUI scales.

Avoid hardcoded coordinates that only work at one resolution.

Prevent duplicate widgets, overlapping buttons, and accumulated position offsets when screens are reopened or resized.

Use the existing project and modify only the code necessary to fix these issues.
Kodari AI
KodariOct 29 at 11:04 pm 2
  1. Trace the current menu layout and mixin logic to identify why the pause gap and title positioning persist.

  2. Verify the exact 26.3 screen/widget methods and Realms news widget behavior from source.

  3. Patch only the existing layout/config integration needed to fix these cases.

Updated the existing layout logic:

  • Pause-menu utility buttons now move below Disconnect while the action rows shift up to close the vacated utility-row gap.

  • Removing Realms compacts the title-screen rows below its button, moving the utility row up with them.

  • The Realms news icon is suppressed only when Remove Realms Button is enabled; disabling it restores the original icon. The icon is rendered as a sprite, not a clickable widget, so it has no separate hitbox to remove.

Both settings and their persistence remain unchanged. The layouts are recalculated from each screen’s vanilla positions, avoiding accumulated offsets on reopen or resize.

Kodari can make mistakes. Review important code before using.
Files
src
build.gradle
gradle.properties
manifest.kod
settings.gradle
Code
14 419
src/client/java/com/kodari/titlelayout/client/MenuLayout.java
package com.kodari.titlelayout.client;

import com.kodari.titlelayout.mixin.client.ScreenAccessor;
import net.minecraft.client.gui.components.AbstractWidget;
import net.minecraft.client.gui.screens.PauseScreen;
import net.minecraft.client.gui.screens.Screen;
import net.minecraft.client.gui.screens.TitleScreen;
import net.minecraft.network.chat.contents.TranslatableContents;
import net.minecraft.client.gui.components.events.GuiEventListener;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public final class MenuLayout {
    private static final int UTILITY_BUTTON_SIZE = 20;
    private static final int BUTTON_HEIGHT = 20;

    static {
        MenuLayoutConfig.load();
    }

    private MenuLayout() {
    }

    public static void applyTitleScreen(TitleScreen screen) {
        if (MenuLayoutConfig.get().removeRealmsButton) {
            AbstractWidget realmsButton = null;
            for (GuiEventListener child : screen.children()) {
                if (child instanceof AbstractWidget widget
                        && widget.getMessage().getContents() instanceof TranslatableContents contents
                        && contents.getKey().equals("menu.online")) {
                    realmsButton = widget;
                    break;
                }
            }

            if (realmsButton != null) {
                int realmsY = realmsButton.getY();
                int rowSpacing = findNextActionRowSpacing(screen, realmsButton);
                ((ScreenAccessor) (Object) screen).titlelayout$invokeRemoveWidget(realmsButton);
                if (rowSpacing > 0) {
                    shiftWidgetsBelow(screen, realmsY, rowSpacing);
                }
            }
        }

        if (MenuLayoutConfig.get().repositionUtilityButtons) {
            moveUtilityRowBelowActions(screen);
        }
    }

    public static void applyPauseScreen(PauseScreen screen) {
        if (MenuLayoutConfig.get().repositionUtilityButtons) {
            compactPauseActions(screen);
            moveUtilityRowBelowActions(screen);
        }
    }

    private static int findNextActionRowSpacing(Screen screen, AbstractWidget button) {
        int nextActionY = Integer.MAX_VALUE;
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget != button
                    && widget.getWidth() > UTILITY_BUTTON_SIZE
                    && widget.getHeight() == BUTTON_HEIGHT
                    && widget.getY() > button.getY()) {
                nextActionY = Math.min(nextActionY, widget.getY());
            }
        }
        return nextActionY == Integer.MAX_VALUE ? 0 : nextActionY - button.getY();
    }

    private static void shiftWidgetsBelow(Screen screen, int y, int amount) {
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget.getHeight() == BUTTON_HEIGHT
                    && widget.getY() > y) {
                widget.setY(widget.getY() - amount);
            }
        }
    }

    private static void compactPauseActions(Screen screen) {
        List<AbstractWidget> utilityRow = findUtilityRow(screen);
        if (utilityRow.isEmpty()) {
            return;
        }

        int utilityRowY = utilityRow.getFirst().getY();
        int firstLowerActionY = Integer.MAX_VALUE;
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget.getWidth() > UTILITY_BUTTON_SIZE
                    && widget.getHeight() == BUTTON_HEIGHT
                    && widget.getY() > utilityRowY) {
                firstLowerActionY = Math.min(firstLowerActionY, widget.getY());
            }
        }
        if (firstLowerActionY == Integer.MAX_VALUE) {
            return;
        }

        int shift = firstLowerActionY - utilityRowY;
        shiftWidgetsAtOrBelow(screen, firstLowerActionY, shift);
    }

    private static void shiftWidgetsAtOrBelow(Screen screen, int y, int amount) {
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget.getWidth() > UTILITY_BUTTON_SIZE
                    && widget.getHeight() == BUTTON_HEIGHT
                    && widget.getY() >= y) {
                widget.setY(widget.getY() - amount);
            }
        }
    }

    private static void moveUtilityRowBelowActions(Screen screen) {
        List<AbstractWidget> utilityRow = findUtilityRow(screen);
        int actionBottom = findLastActionBottom(screen);
        if (utilityRow.isEmpty() || actionBottom < 0) {
            return;
        }

        int targetY = actionBottom + 4;
        for (AbstractWidget widget : utilityRow) {
            widget.setY(targetY);
        }
    }

    private static List<AbstractWidget> findUtilityRow(Screen screen) {
        Map<Integer, List<AbstractWidget>> rows = new HashMap<>();
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget.getWidth() == UTILITY_BUTTON_SIZE
                    && widget.getHeight() == BUTTON_HEIGHT) {
                rows.computeIfAbsent(widget.getY(), ignored -> new ArrayList<>()).add(widget);
            }
        }

        List<AbstractWidget> largestRow = List.of();
        for (List<AbstractWidget> row : rows.values()) {
            if (row.size() > largestRow.size()) {
                largestRow = row;
            }
        }
        return largestRow.size() >= 2 ? largestRow : List.of();
    }

    private static int findLastActionBottom(Screen screen) {
        int bottom = -1;
        for (GuiEventListener child : screen.children()) {
            if (child instanceof AbstractWidget widget
                    && widget.getWidth() > UTILITY_BUTTON_SIZE
                    && widget.getHeight() == BUTTON_HEIGHT) {
                bottom = Math.max(bottom, widget.getY() + widget.getHeight());
            }
        }
        return bottom;
    }
}