Jump to content

[1.8.9] Modify the playerlist for the client.


boomboompower

Recommended Posts

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

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

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
Link to comment
Share on other sites

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.

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.

Announcements



  • Recently Browsing

    • No registered users viewing this page.
  • Posts

    • So, I am trying to create and add tags to my custom damage type, but looks like I made something wrong, since it crashing with error that "cannot register" damage type. Im trying to register it, and in datagen add tags, but it everytime crashing due to not register "grimtales:entropy". Full code there - https://github.com/undertakerJ/Grim-Tales-Forge ModDamageTypes class public class ModDamageTypes { public static final DeferredRegister<DamageType> DAMAGE_TYPES = DeferredRegister.create(Registries.DAMAGE_TYPE, GrimTales.MOD_ID); public static final ResourceKey<DamageType> ENTROPY_KEY = ResourceKey.create(Registries.DAMAGE_TYPE, new ResourceLocation(GrimTales.MOD_ID, "entropy")); public static final RegistryObject<DamageType> ENTROPY = DAMAGE_TYPES.register( "entropy", () -> new DamageType("entropy_effect", DamageScaling.ALWAYS, 1f, DamageEffects.HURT)); // // public static final DamageSource ENTROPY_SOURCE = new DamageSource(Holder.direct(ENTROPY.get())); public static void register(IEventBus eventBus) { DAMAGE_TYPES.register(eventBus); } } Datagen for damageTags public class ModDamageTagsProvider extends DamageTypeTagsProvider { public ModDamageTagsProvider( PackOutput p_270719_, CompletableFuture<HolderLookup.Provider> p_270256_, @Nullable ExistingFileHelper existingFileHelper) { super(p_270719_, p_270256_, GrimTales.MOD_ID, existingFileHelper); } @Override protected void addTags(HolderLookup.Provider pProvider) { this.tag(DamageTypeTags.BYPASSES_INVULNERABILITY).add(ModDamageTypes.ENTROPY_KEY); } } Datagen class it self   @Mod.EventBusSubscriber(modid = GrimTales.MOD_ID, bus = Mod.EventBusSubscriber.Bus.MOD) public class DataGenerators { @SubscribeEvent public static void gatherData(GatherDataEvent event){ DataGenerator generator = event.getGenerator(); PackOutput packOutput = generator.getPackOutput(); ExistingFileHelper helper = event.getExistingFileHelper(); CompletableFuture<HolderLookup.Provider> lookupProvider = event.getLookupProvider(); generator.addProvider(event.includeServer(), new ModDamageTagsProvider(packOutput, lookupProvider, helper)); } } And register class in main class public GrimTales() { IEventBus modEventBus = FMLJavaModLoadingContext.get().getModEventBus(); ModDamageTypes.register(modEventBus); modEventBus.addListener(this::commonSetup); MinecraftForge.EVENT_BUS.register(this); modEventBus.addListener(this::addCreative); }  
    • Looking for a semi-vanilla Minecraft server? Maybe one with keep inventory and land claims? I have one for you! Let me introduce you to Safe Survival! Come on and join us at mc.safesurvival.net. It is bedrock supported too!
    • Hi. I'm trying to play RLCraft with Optifine but my game keeps crashing on startup with Exit Code 1. The modpack was working fine yesterday, not sure what changed to make it not wanna work anymore. I was hoping someone here could help me figure out what's going wrong. If I remove Optifine, nothing changes, I still get the same errors. Thanks in advance. Crash Report (I only included the errors+fatal, I’m not sure if more is needed, please let me know): https://pastebin.ai/66ivknz0f4  
    • I am trying to port my mod from 1.20.2 to 1.21, but I am encountering difficulties regarding the classes for rendering the GUI and related events. What are the equivalents of the following classes? net.minecraftforge.client.event.RenderGuiOverlayEvent net.minecraftforge.client.gui.overlay.NamedGuiOverlay net.minecraftforge.client.gui.overlay.ForgeGui net.minecraftforge.client.gui.overlay.GuiOverlayManager net.minecraftforge.client.gui.overlay.IGuiOverlay   thx
    • Hi all! Love the Custom npc mod, it is my favorite mod! That said, I have been using this mod since finding it a few years ago (I only play on 1.12.2) and instantly loved that I caould reskin all of the npc's I created. That worked great until recently. I got locked out of my outlook account, which is what I was logged into windows with at the time, and they locked me out of Windows 10. So, I had to reinstall, and since I have digital entitlements to Windows 10 ( I am part of the insider program) on all three of my outlook accounts, I ust swapped to the one I bought Minecraft for. Reinstalled everything, started MC, crerated my favorite fighter (set to kill everything) to clear an area) set up the stats, went back to the main screen, clicked skin so I can give him the grim reaper skin and crash . . . wtf? Thought it was another mod, so, over the course of the last 2 days, I removed every single mod, reinstalled forge 2860 and then 2859, replaced optifine G5 with G6 and vice versa, all with the same result. So, I created a new world, with only the two mods, and same thing. https://pastebin.com/8raJVHq1 That is the log, I have been through the visual settings and all sorts of stuff and can not figure this out, and being that I only just started a bachelors in software engineer / computer programming, I have no idea what I am looking at, so please, and thank you!  If any one of you know what is causing this, I will be forever grateful for the help! Mor9heus
  • Topics

×
×
  • Create New...

Important Information

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