Thank you mates for help.
What I do was to remove graphics drivers (processor is 3400G with integrated graphics) using AMD Cleanup utility in safe mode, then, installed the latest WHQL graphics drivers, and Minecraft started with forge mod without error code 1.
My little grandson is happy Let us see if works well.
Thank you again.
1.16 is no longer supported in these forums.
In supported versions of minecraft you would do something like:
server.getPlayerList().getPlayerByName(name)
Where the server object can be accessed from Level.getServer() if you don't already have a reference.
The above only works if the player is logged into the game and the world is loaded locally. You cannot for example do that client side in multiplayer.
In general, it is a bad idea to use player names in code.
Internally minecraft identifies players using a UUID for each player.
The name is only used for display purposes or commands. It is not any form of unique identifier.
The UUID can also be used when a player is offline.
You can see these UUIDs in the save's playerdata sub folder.
Tags don't exist until the datapacks are loaded.
i.e. when you load a save or join a multiplayer game (the server sends you the tags).
They are world specific.