TeamMidnightDust / MidnightControls

A Minecraft mod adding controller support and enhanced controls overall.
https://midnightdust.eu/midnightcontrols/
MIT License
173 stars 28 forks source link

Crash: Pluging in controller while not in-game #278

Open truemaker opened 1 month ago

truemaker commented 1 month ago

Describe the bug Game crashes when pluging in controller

To Reproduce Steps to reproduce the behavior:

  1. Go to 'Main menu'
  2. Plug in controller
  3. Game crashes

Expected behavior Not crashing

Desktop (please complete the following information):

Additional context java.lang.IllegalStateException: Cannot get payload sender when not in game! at net.fabricmc.fabric.api.client.networking.v1.ClientPlayNetworking.getSender(ClientPlayNetworking.java:230) at eu.midnightdust.midnightcontrols.client.MidnightControlsClient.switchControlsMode(MidnightControlsClient.java:260) at eu.midnightdust.midnightcontrols.client.MidnightControlsClient.lambda$onMcInit$5(MidnightControlsClient.java:172) at org.lwjgl.glfw.GLFWJoystickCallbackI.callback(GLFWJoystickCallbackI.java:43) at org.lwjgl.system.JNI.invokeV(Native Method) at org.lwjgl.glfw.GLFW.glfwPollEvents(GLFW.java:3438) at com.mojang.blaze3d.systems.RenderSystem.pollEvents(RenderSystem.java:200) at com.mojang.blaze3d.systems.RenderSystem.flipFrame(RenderSystem.java:218) at net.minecraft.class_1041.method_15998(class_1041.java:287) at net.minecraft.class_310.method_1523(class_310.java:1342) at net.minecraft.class_310.method_1514(class_310.java:888) at net.minecraft.client.main.Main.main(Main.java:265) at net.fabricmc.loader.impl.game.minecraft.MinecraftGameProvider.launch(MinecraftGameProvider.java:470) at net.fabricmc.loader.impl.launch.knot.Knot.launch(Knot.java:74) at net.fabricmc.loader.impl.launch.knot.KnotClient.main(KnotClient.java:23)

truemaker commented 1 month ago

Proposed solution: Do a check