Jump to content

Recommended Posts

Posted

Hey, i'm trying to make a mod that modifies the tablist to change the player's name there to something they have chosen from a command. I'm fairly new to forge modding so I honestly have no clue how to do this.

 

From what I've gathered I will need to use the GuiPlayerTabOverlay class. My only thoughts would be reflection (however I believe this is not the proper solution), can anybody help me with this?

 

Thanks -boomboompower

Posted

Hey, i'm trying to make a mod that modifies the tablist to change the player's name there to something they have chosen from a command. I'm fairly new to forge modding so I honestly have no clue how to do this.

 

From what I've gathered I will need to use the GuiPlayerTabOverlay class. My only thoughts would be reflection (however I believe this is not the proper solution), can anybody help me with this?

 

Thanks -boomboompower

Are you wanting to change the whole name or just add prefixes/suffixes?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Hey, i'm trying to make a mod that modifies the tablist to change the player's name there to something they have chosen from a command. I'm fairly new to forge modding so I honestly have no clue how to do this.

 

From what I've gathered I will need to use the GuiPlayerTabOverlay class. My only thoughts would be reflection (however I believe this is not the proper solution), can anybody help me with this?

 

Thanks -boomboompower

Are you wanting to change the whole name or just add prefixes/suffixes?

 

I want to change the whole name, think of it as a client-side nickname mod

Posted

Something like that, yes. I suggest you read the Javadocs for the event, there is an important thing to note.

NameFormat is fired when a player's display name is retrieved.
This event is fired whenever a player's name is retrieved in EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().

This event is fired via the ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String).

username contains the username of the player. displayname contains the display name of the player. 
This event is not Cancelable. 
This event does not have a result. HasResult 
This event is fired on the MinecraftForge#EVENT_BUS.

 

Tested my code above, kinda breaks the mod functionality. What way (personally) would you usually modify the playerlist?

Posted

Something like that, yes. I suggest you read the Javadocs for the event, there is an important thing to note.

NameFormat is fired when a player's display name is retrieved.
This event is fired whenever a player's name is retrieved in EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().

This event is fired via the ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String).

username contains the username of the player. displayname contains the display name of the player. 
This event is not Cancelable. 
This event does not have a result. HasResult 
This event is fired on the MinecraftForge#EVENT_BUS.

 

Tested my code above, kinda breaks the mod functionality. What way (personally) would you usually modify the playerlist?

What do you mean it breaks the mods functionality?

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Something like that, yes. I suggest you read the Javadocs for the event, there is an important thing to note.

NameFormat is fired when a player's display name is retrieved.
This event is fired whenever a player's name is retrieved in EntityPlayer#getDisplayName() or EntityPlayer#refreshDisplayName().

This event is fired via the ForgeEventFactory#getPlayerDisplayName(EntityPlayer, String).

username contains the username of the player. displayname contains the display name of the player. 
This event is not Cancelable. 
This event does not have a result. HasResult 
This event is fired on the MinecraftForge#EVENT_BUS.

 

Tested my code above, kinda breaks the mod functionality. What way (personally) would you usually modify the playerlist?

What do you mean it breaks the mods functionality?

 

The nickname for chat is simple replacing the name with their desired nickname. When using the NameFormat event, it has already set the name so it doesn't replace it, also after running the command it doesn't change the name.

Posted

Make a map that takes their username to their display name. Then whenever the command is ran change the nickname in the Map. Save the map to the disk, either yourself using a txt, using the forge config, or even to the World using WorldSaveData or even a World Capability. And I didn't understand the first problem...

The nickname for chat is simple replacing the name with their desired nickname. When using the NameFormat event, it has already set the name so it doesn't replace it...

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Make a map that takes their username to their display name. Then whenever the command is ran change the nickname in the Map. Save the map to the disk, either yourself using a txt, using the forge config, or even to the World using WorldSaveData or even a World Capability. And I didn't understand the first problem...

The nickname for chat is simple replacing the name with their desired nickname. When using the NameFormat event, it has already set the name so it doesn't replace it...

The idea behind the mod is for YouTuber's to nickname themselves on servers (when they are on alts) so they can record without targeting.

 

So I have a question, what will happen if I run this on a server whilst I am playing on a server? I doubt that it will change my display name on the server.

 

This is why I wish to avoid this method and just be shown to a Collection or something where the playerlist is stored.

 

 

Posted

Make a map that takes their username to their display name. Then whenever the command is ran change the nickname in the Map. Save the map to the disk, either yourself using a txt, using the forge config, or even to the World using WorldSaveData or even a World Capability. And I didn't understand the first problem...

The nickname for chat is simple replacing the name with their desired nickname. When using the NameFormat event, it has already set the name so it doesn't replace it...

The idea behind the mod is for YouTuber's to nickname themselves on servers (when they are on alts) so they can record without targeting.

 

So I have a question, what will happen if I run this on a server whilst I am playing on a server? I doubt that it will change my display name on the server.

 

This is why I wish to avoid this method and just be shown to a Collection or something where the playerlist is stored.

If the mod is on the server and you run the command it will indeed change your name. But if it is not on the server and you have it and run it, it will not change your name to others, why? Because other players do not have the information. This may be done only server side, but i do not know if that would work.

VANILLA MINECRAFT CLASSES ARE THE BEST RESOURCES WHEN MODDING

I will be posting 1.15.2 modding tutorials on this channel. If you want to be notified of it do the normal YouTube stuff like subscribing, ect.

Forge and vanilla BlockState generator.

Posted

Make a map that takes their username to their display name. Then whenever the command is ran change the nickname in the Map. Save the map to the disk, either yourself using a txt, using the forge config, or even to the World using WorldSaveData or even a World Capability. And I didn't understand the first problem...

The nickname for chat is simple replacing the name with their desired nickname. When using the NameFormat event, it has already set the name so it doesn't replace it...

The idea behind the mod is for YouTuber's to nickname themselves on servers (when they are on alts) so they can record without targeting.

 

So I have a question, what will happen if I run this on a server whilst I am playing on a server? I doubt that it will change my display name on the server.

 

This is why I wish to avoid this method and just be shown to a Collection or something where the playerlist is stored.

If the mod is on the server and you run the command it will indeed change your name. But if it is not on the server and you have it and run it, it will not change your name to others, why? Because other players do not have the information. This may be done only server side, but i do not know if that would work.

I know. All I need is a variable or something that the client has that stores the playerlist. This mod is not meant to be installed on a server. That's why I don't want to use that method
Posted
This mod is not meant to be installed on a server.

 

Then you can't do what you want to do.  Game, set, match.

Apparently I'm a complete and utter jerk and come to this forum just like to make fun of people, be confrontational, and make your personal life miserable.  If you think this is the case, JUST REPORT ME.  Otherwise you're just going to get reported when you reply to my posts and point it out, because odds are, I was trying to be nice.

 

Exception: If you do not understand Java, I WILL NOT HELP YOU and your thread will get locked.

 

DO NOT PM ME WITH PROBLEMS. No help will be given.

Guest
This topic is now closed to further replies.

Announcements



×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.