Keksuccino / FancyMenu

Source code for FancyMenu.
Other
164 stars 21 forks source link

[FABRIC] Crash when using a Ticker to join a server too early (Screen cannot be NULL) #941

Closed NextRaven10 closed 1 week ago

NextRaven10 commented 1 month ago

Describe the bug When I add a Ticker to my main menu that checks if a variable is true and if my server is online and then joins the server using my serverip variable

To Reproduce I will use the $ sign to indicate a variable Steps to reproduce the behavior (e.g.):

  1. Create a new Instance of Minecraft 1.20.1 with the following mods: Cloth Config API; Drippy Loading Screen; Entity Culling; Fabric API; FancyMenu; FerriteCore; ImmediatelyFast; Indium; Iris Shaders; Konkrete; Lithium; Melody; Mod Menu; ModernFix; Sodium; Sodium Extra; (I am not sure if you need these mods to reproduce the bug, its just the mods I have installed when it crashes)
  2. Add the Variables: $autojoinserver:false & $serverip:modpack.nextraven.de
  3. In the main menu: Open the Editor of the Layout and add a new ticker that checks if the $autojoinserver variable is true and that checks if the server with the ip of $serverip is online. If both true it joins the server with the ip of $serverip
  4. Add a Button to toggle the $autojoinserver variable
  5. Crash when you leave the Editor or when you press the button (seems to be random)

Expected behavior That when I start the game, $autojoinserver is true and my server is online that I would automatically join the server but instead it crashes :(

Game Log Here is the link: https://mclo.gs/NtYfgHM

Screenshots If screenshots would help to explain the issue, please include these.

Basic Informations (please complete the following information):

Keksuccino commented 1 month ago

Lautsprecher (High Definition Audio Device)

Good old Lautsprecher of the fellow Deutsche Kartoffel :D


The issue seems to be related to Fabric's API, but that error shouldn't happen anymore. I thought I fixed that. Could be related to another mod OR the way you try to join the server is somehow bugged. Can you join the server with a normal button or does that also causes the game to crash?

//Edit: Oh I think I know what's happening. Your Ticker element joins the server the moment the Title screen opens, right? Yeah well, I think at that point the Fabric API has not finished doing its thing yet, so it thinks the screen is NULL instead of the Title screen. I don't know if I can fix that tbh.

NextRaven10 commented 1 month ago

Yes, the good old Deutsche Kartoffel xD


So it just isn´t possible? Or is there another way I can make the user join a server when a variable is true?

NextRaven10 commented 1 month ago

The issue seems to be related to Fabric's API, but that error shouldn't happen anymore. I thought I fixed that. Could be related to another mod OR the way you try to join the server is somehow bugged. Can you join the server with a normal button or does that also causes the game to crash?

Yes, I can join a server when I just press a button that joins it

Shivter14 commented 2 weeks ago

Yes, the good old Deutsche Kartoffel xD

So it just isn´t possible? Or is there another way I can make the user join a server when a variable is true?

You could possibly do it by making a timer that makes the client join to the server slightly later.

NextRaven10 commented 1 week ago

You could possibly do it by making a timer that makes the client join to the server slightly later. Thx :D This worked and now I just need to figure out the exact timing :]