I messing around with a "Dream" dimension where players get teleported when they go to bed. To detect sleeping time, I am subscribing to the SleepingTimeCheckEvent, and after the player's sleep tick reaches 100, I call entity.changeDimension() passing in my custom dimension as a parameter. After I go to bed and wait a couple seconds, the game switches over to the usual loading screen that says "Loading terrain...", but then it hangs there with no error messages or exceptions on the console (it just says "Saving and pausing game..."). As I understand, this sleep time event is server-sided, so this probably isn't a networking issue, and the teleportation itself should be handled automatically by Minecraft.
I know that the dimension itself works, because I can teleport there with the following command, and it loads in with no issues:
/execute in lunareclipse:sleep_dim run tp Dev ~ 120 ~
The weirdest thig is that the first time I tested this, the bed teleported me to my dimension successfully without freezing, or any other issues. I haven't changed anything in the teleportation code since, so I don't understand what's going on.
I've uploaded all the relevant files on pastebin:
data/lunareclipse/dimension/sleep_dim.json -> https://pastebin.com/TNiYpbhJ
data/lunareclipse/dimension_type/sleep_dim.json -> https://pastebin.com/6y0th33Z
DimensionsInit.java -> https://pastebin.com/hwnpLxSi
onPlayerSleepInBed -> https://pastebin.com/uhhU1ZaQ
The last few lines of debug output right before the player is supposed to teleport -> https://pastebin.com/cezPq7mz (there's nothing else after that, the game still shows "Loading terrain..." as I'm writing this)
I figured there is no point uploading a full debug.log, because as I mentioned, there are no error messages whatsoever, and the dimension itself works with vanilla teleport commands.