Jump to content
View in the app

A better way to browse. Learn more.

Forge Forums

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Featured Replies

Posted

Hello

so I've been interested in creating custom Minecraft main menu but I don't have much experience with mod programming. So I started with custom buttons and so far I've almost managed to do what I wanted and I created button with white background and transparency and added colored text. My problem is that when I try to position the button no matter where it is, it's "hitbox" stays where the original button was. I did it on singleplayer button like this: First I disabled the original button and made it invisible (pretty sure it's enough to make it invisible but I also disabled it just to be sure you can't click it) then I added my button using buttonList.add() and to change it's color, shape, etc. I made my own drawButton() method and used drawRect() and drawCentredString() inside this method. Here's my code:

    @SubscribeEvent
    public void onInitGui(final GuiScreenEvent.InitGuiEvent e) {
        if (e.gui instanceof GuiMainMenu) {
            for (Object b : e.buttonList) {
                if (((GuiButton) b).id == 14 || ((GuiButton) b).id == 1) {
                    ((GuiButton) b).enabled = false;
                    ((GuiButton) b).visible = false;
                }
            }

            int i = e.gui.height / 4 + 48;
            e.buttonList.add(new GuiButton(1, e.gui.width / 2 - 100, e.gui.height / 2 - 12, "Test") {
                @Override
                public void drawButton(Minecraft mc, int mouseX, int mouseY) {
                    final Color color = new Color(255, 255, 255, 127);
                    final FontRenderer font = mc.fontRendererObj;
                    Gui.drawRect(e.gui.width / 4, 500, e.gui.width / 2, 100, color.getRGB());
                    drawCenteredString(font, "Singleplayer", this.yPosition, this.yPosition, 0x0145D5);
                }
            });
    }
}

In this code I disabled Singleplayer and Realms button. Of course events are registered and I see every change I make. I just have that one problem I described above.

Guest
This topic is now closed to further replies.

Important Information

By using this site, you agree to our Terms of Use.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.