#MinecraftClient.setScreen() causes a crash...

1 messages · Page 1 of 1 (latest)

vocal hedge
#

Hi, I have issues when opening my custom screen using .setScreen() from MinecraftClient...
I wonder if this is the intended way of opening screen, because whenever I look at the vanilla code, they did the same, yet I my screen cause it to crash...

here's the screen code:

class TestScreen : Screen(Text.translatable("screen.fabrictestmod.portal")) {
  /* nothing else, I just have a blank screen */
}

and here's the .setScreen code:

client.setScreen(TestScreen())

I can get the client by using MinecraftClient.getInstance() or getting it from some event arguments.

My question is, how do I make it not to crash? or, is this not the intended way of opening a screen and there must be another valid way to do it, please tell me...

Thank you

old whale
#

You sure you're running it on the right side? Sharing the crash would help.

vocal hedge
vocal hedge
placid sigil
#

We can believe you or we can help you.