[1.20.1-1.0.5] Server - Player unable to connect if they are asleep
Opened this issue · 0 comments
Describe the Bug
Duplicate of #66 but it was closed.
Player will be unable to connect to a server if their player data indicates that they are sleeping. This can happen if the server is stopped while a player is asleep.
The server will report an Loading entity NBT
error and the client will disconnect with Invalid player data.
This happens because the player is spawned into the world before the player is fully connected. If it is daytime, the player is woken and this triggers the SaveHomeLocationEventHandler
. This event handler tries to send the player entity data to the client but then errors because the connection isn't complete. This breaks the client connection.
Reproduction Steps
- Join a server
- Sleep
- Stop server while asleep
- Start the server
- Attempt to join server
Expected Result
Join the server
Screenshots and Videos
No response
Crash Report or Log
https://gist.github.com/TigerWalts/0fe17cc711188c52211ccd58758aeff2
Operating System
Windows 10 Client/Ubuntu 22 Server
Mod Version
1.0.5_beta (And many previous)
Minecraft Version
1.20.1
Forge Version
47.3.10
Other Mods
Mystic Horizons 1.05-patch
https://www.curseforge.com/minecraft/modpacks/mystic-horizons-rpg
Additional Context
java.lang.NullPointerException: Cannot read field "f_9742_" because "java.util.function.Supplier.get().f_8906_" is null
at TRANSFORMER/forge@47.3.10/net.minecraftforge.network.PacketDistributor.lambda$playerConsumer$1(PacketDistributor.java:203)
at TRANSFORMER/forge@47.3.10/net.minecraftforge.network.PacketDistributor$PacketTarget.send(PacketDistributor.java:165)
at TRANSFORMER/forge@47.3.10/net.minecraftforge.network.simple.SimpleChannel.send(SimpleChannel.java:107)
at TRANSFORMER/theabyss@1.0.0/net.yezon.theabyss.network.TheabyssModVariables$PlayerVariables.syncPlayerVariables(TheabyssModVariables.java:445)
at TRANSFORMER/theabyss@1.0.0/net.yezon.theabyss.events.SaveHomeLocationEvents.lambda$execute$0(SaveHomeLocationEvents.java:32)
f_8906_
is the connection
/networkHandler
field on the ServerPlayer
. It is an instance of ServerGamePacketListenerImpl
.
It is likely still null
at this point in the player connection sequence.
Workarounds:
-
Wait until night
Untested, but the player may remain asleep if they connect while it is night time in game and avoid triggering the event -
Edit the player save file
- Delete the
SleepingX
tag - Delete the
SleepingY
tag - Delete the
SleepingZ
tag - Set the
SleepTimer
tag to0
- Delete the