Started by
Silky_Chillz
on
Topic category: Help with Minecraft modding (Java Edition)
Hey, I was wondering if there was a way to change a players name? Like if your real Minecraft username is one thing, you could make it look different in chat?
There is an event PlayerEvent.NameFormat that you can use to this. First you have to have a working and registered event handler class (I have definitely described how to do so many times here on MCreator forum, so you can try to find these posts, however long story short - all you have to do is making a blank GUI overlay element - as it is already a working event handler).
So in the event handler just subscribe to the PlayerEvent.NameFormat event (again - take a look on the old posts or the GUI overlay element).
The event has many fields, including username and displayname. Username is the original name and displayname is the name that will be used for rendering. Depending on your needs just change the value displayname to whatever you want. Before version 1.9 you could do so directly, but as from 1.9 many fields in event classes have become private, you will maybe need to use some setter (and possible also getter) method.
Nuparu00 please show images. I am new in this and I want to change the username but I dont know how. Your message is the only information that I found about this. I was finding for hours. So please show how.
I have the same problem, I can't change my username and it is staying as "Dev". You might have to edit the code to change your playername.
there is a set display name of [entity] to "Name" command