Posted December 23, 20213 yr hello i want to add a button to main menu. Screen myevent = event.getGui(); if (myevent instanceof MainMenuScreen){ myevent.addButton(new Button(20, 20, 20, 20, new StringTextComponent("Text"), (e)->{ System.out.println("Sa"); })); } It says addButton is protected. I tried accesstransformers thing. and i wrote this protected net.minecraft.client.gui.screen.Screen addButton(Lnet/minecraft/client/gui/IGuiEventListener;)Lnet/minecraft/client/gui/IGuiEventListener; protected net.minecraft.client.gui.screen.Screen addListener(Lnet/minecraft/client/gui/IGuiEventListener;)Lnet/minecraft/client/gui/IGuiEventListener; but it is not working. The code of addButton and addListener protected <T extends Widget> T addButton(T button) { this.buttons.add(button); return this.addListener(button); } protected <T extends IGuiEventListener> T addListener(T listener) { this.children.add(listener); return listener; } Please help me
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.