Jump to content
Search In
  • More options...
Find results that contain...
Find results in...

Getting PING to a Server


Recommended Posts

15 hours ago, diesieben07 said:

NetHandlerPlayClient::getPlayerInfo(Minecraft.getMinecraft().player.getGameProfile().getId()) will give you a NetworkPlayerInfo instance, which has getResponseTime.

 

Is there an example code I can see somewhere?

Link to post
Share on other sites
23 hours ago, MCenderdragon said:

NetHandlerPlayClient::getPlayerInfo , you get the netHandler from the EntityPlayerSP (this is inside Minecraft.class) and then you call the getPlayerInfo() methode

 

Can't find it.

Screenshot_2.png

Link to post
Share on other sites

NetHandlerPlayClient  != EntityPlayerSP you wont find getPlayerInfo inside the wrong class. also just look at the fields in the EntityPlayer and check what is a NetHandler

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Link to post
Share on other sites
14 minutes ago, MCenderdragon said:

NetHandlerPlayClient  != EntityPlayerSP you wont find getPlayerInfo inside the wrong class. also just look at the fields in the EntityPlayer and check what is a NetHandler

 

Still can't find it

Screenshot_3.png

Link to post
Share on other sites

just look at the fields in side the playerSP class there IS somewhere the net handler. if the field is not public there IS somewhere a getter.

Edited by MCenderdragon

catch(Exception e)

{

 

}

Yay, Pokémon exception handling, gotta catch 'em all (and then do nothing with 'em).

Link to post
Share on other sites
2 hours ago, diesieben07 said:

It is via Minecraft::player.

 

Sorry, what does the :: mean? is it like the Minecraft.getMinecraft(); thing?

 

2 hours ago, MCenderdragon said:

just look at the fields in side the playerSP class there IS somewhere the net handler. if the field is not public there IS somewhere a getter.

 

Is there a playerSP class? could find only the playercontrollerMP class but not this one.

Link to post
Share on other sites
13 hours ago, diesieben07 said:

EntityPlayerSP player = Minecraft.getMinecraft().player;
NetworkPlayerInfo npi = player.connection.getPlayerInfo(player.getGameProfile().getId());

 

And now you need to go learn Java. Seriously.

 

Oh so this is what you mean, yeah I used that before in my code.

I just did not under stand what the :: and # stuff means xD 

Thank you!

Link to post
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.

Guest
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 Privacy Policy.