How to make a already existing minecraft button open a screen that's different from what it usually opens #5200
-
Beta Was this translation helpful? Give feedback.
Answered by
shushi93
Feb 25, 2026
Replies: 1 comment
-
|
So I found a solution to this, this.openScreenButton(RESOURCEPACK, ?)then, use ModifyArg with index of 1 to change the supplier value to your own screen @Definition(id = "openScreenButton", method = "Lnet/minecraft/client/gui/screens/options/OptionsScreen;openScreenButton(Lnet/minecraft/network/chat/Component;Ljava/util/function/Supplier;)Lnet/minecraft/client/gui/components/Button;")
@Definition(id = "RESOURCEPACK", field = "Lnet/minecraft/client/gui/screens/options/OptionsScreen;RESOURCEPACK:Lnet/minecraft/network/chat/Component;")
@Expression("this.openScreenButton(RESOURCEPACK, ?)")
@ModifyArg(method = "init", at = @At("MIXINEXTRAS:EXPRESSION"), index = 1)
private Supplier<Screen> redirectButton(Supplier supplier){
supplier = () -> new ExampleScreen(new ExampleGui());
return supplier;
}(I believe this is the correct and working code) this.minecraft.getResourcePackRepository(), ...But for now, this works |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
shushi93
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment

So I found a solution to this,
by following this: https://github.com/LlamaLad7/MixinExtras/wiki/Expressions
you can make an expression to hook onto,
then, use ModifyArg with index of 1 to change the supplier value to your own screen
full code: