Skip to content

command to open screen failed #2004

Answered by warjort
Enaium asked this question in Mod Dev Support
Discussion options

You must be logged in to vote

The error says your TestScreen class is not doing the init() correctly.

java.lang.IllegalStateException: [fabric-screen-api-v1] The current screen (net.minecraft.client.gui.screen.Screen) has not been correctly 
initialised, please send this crash log to the mod author. This is usually caused by the screen not calling
super.init(Lnet/minecraft/client/MinecraftClient;II)V

But your overall approach is wrong.

The commands run on the server, you cannot use the client api directly from them.

If you want to change the screen from a command running on the server,
you will need to send a network message to the player telling their client to do the open.
https://fabricmc.net/wiki/tutorial:networking

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected by Enaium
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants