-
Bug
-
Resolution: Invalid
-
None
-
1.20.2, 23w46a
-
Plausible
-
Performance
After death, when player respawn. Minecraft run function placeNewPlayer. In this function call other function: this.sendPlayerPermissionLevel(serverPlayer); In this functino calls this.server.getCommands().sendCommands(serverPlayer);
When call sendCommands, all commands collect for player - place all command to packet if permission exists.
Example singleplayer world without cheat.
gamerule command require cheat - ignore.
trigger command not require cheat. Collect arguments (list of arguments u can see at wiki)
Than all collected command parse in constructor of class ClientboundCommandsPacket.
And last - send to client.
What problem? If add some new modded command. Run game. Set gamerule doImmediateRespawn true. Run kill command. Watch video before run command /say second part - item loaded after wait 1-2 second. If add some more command i can walk and server not track any my movement, only result. If i place command block, that kill all player in distance 1..2 around spawn - dont kill on spawn position and far spawn position, i can walk and not death - server think that i stay, than teleport to position.
How to fix?
Solution first. Its increase speed of loading singleplayer world, because packet with commands tree can configured more than 1-2 second. Player can play without command while it configured. And its increase speed of joining to server - same reason - client havent command, because server in configure command tree packet and sent when end.
Run function in new thread Commands#sendCommand
public void sendCommands(ServerPlayer serverPlayer)
to
Executors.newSingleThreadExecutor().execute(() ->
);
Watch video after run command /say second part
Solution second.
Cache command tree or not send when respawn. Commands tree don't change after death and client already have its. Than, send same command tree - spent resource of server side and internet (not lan player), because tree on client is same, that sent in packet.
- relates to
-
MC-165963 Respawning after death causes massive lag spike
- Open