Search code examples
minecraftminecraft-fabric

FABRIC MC / FABRIC API. Client: How to get player name? It's just a solution


I have tried to find answer in internet - I can't) But reverse engineering helps me.

That method will help you:

var username = MinecraftClient.getInstance().getSession().getUsername();

Solution

  • That method will help you:

    var username = MinecraftClient.getInstance().getSession().getUsername();