Jump to content

get player name on multiplayer


Recommended Posts

Okay so basically some design stuff:


There is server that saves/loads/holds ALL entities.


There are some client that connect to server (dedicated or integrated SP) and ask for Entities that are in their range.

Client only has one World (the one you are in) - Minecraft#theWorld, same for Minecraft#thePlayer which is your-client-side you.


Now - the entities you see (in range) are "mirrors" of server ones so if you see them on client your client-side entities will most likely hold data same or close-to server's.


So if you are asking about getting some player's name - if you see him, you can ask your client to return name: Entity#getName().


If you don't see an entity (on client) then you can't know anything about it (you don't have it, only server does). To get that data you MUST send separate custom packet with data you need and hold it somewhere on client.


Now - the rule above is a little expanded for EntityPlayers - on client you don't always have all players that are on server (you only have those you see), BUT you do have their profiles which allow you to get some data about them, even if you don't see them..


That data can be pulled from.... (I don't remember, someone can finish my sentence).

If you want to find it on your own - there is a tab feature in-game that shows you all logged in players - track down (in vanilla code) where that is rendered and check what it calls (I can't, no IDE).

1.7.10 is no longer supported by forge, you are on your own.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...

Important Information

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