Game Crashes When Using On-Tick Procedure in Custom GUI

Started by NisamVikki on

Topic category: Troubleshooting, bugs, and solutions

Joined Sep 2017
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Game Crashes When Using On-Tick Procedure in Custom GUI
Sun, 06/09/2024 - 00:50 (edited)

Hi everyone,

I'm working on a Minecraft mod using MCreator and NeoForge 1.20.4. I've created a custom GUI and implemented an on-tick procedure to check the inputs and enable or disable buttons accordingly.

The issue arises when I press a button in the GUI. The game crashes, and the error message indicates a ClassCastException. Removing the on-tick procedure seems to fix the crash, but I need this procedure to function correctly. Here is the relevant error message:

[02:32:12] [Netty Server IO #1/ERROR] [minecraft/Connection]: Received class net.minecraft.network.protocol.common.ServerboundCustomPayloadPacket that couldn't be processed 
java.lang.ClassCastException: class ....network.OverviewGUIButtonMessage cannot be cast to class ....world.inventory.OverviewGUIMenu$OverviewGUIOtherMessage (....network.OverviewGUIButtonMessage and ....world.inventory.OverviewGUIMenu$OverviewGUIOtherMessage are in module testmod@1.0.0 of loader 'TRANSFORMER' @4f8d86e4)
...
[02:32:12] [Server thread/INFO] [minecraft/ServerGamePacketListenerImpl]: Dev lost connection: Server sent an invalid packet

I want to note that this is not due to the button press procedure as even if its empty it still crashes, this happened to me with also another mod where I had an on effect active tick procedure but when I cleared the effect it crashed, however just letting it expire naturally doesnt crash it, just like closing this gui with esc also doesnt crash it.

Edited by NisamVikki on Sun, 06/09/2024 - 00:50