Jump to content

[1.7.10] Playtime Tracker


mrkirby153

Recommended Posts

IExtendedEntityProperties is your friend.

PlayerTickEvent is another.

SimpleNetworkWrapper (packets) is 3rd (if you want client-side to be able to view his data).

 

How to:

Implement IExtendedEntityProperties to EntityPlayer in EntityConstructingEvent.

Put time in there.

In PlayerTickEvent get his IEEP and increment time by one.

 

Tutorials:

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and

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

Link to comment
Share on other sites

IExtendedEntityProperties is your friend.

PlayerTickEvent is another.

SimpleNetworkWrapper (packets) is 3rd (if you want client-side to be able to view his data).

 

How to:

Implement IExtendedEntityProperties to EntityPlayer in EntityConstructingEvent.

Put time in there.

In PlayerTickEvent get his IEEP and increment time by one.

 

Tutorials:

http://www.minecraftforum.net/forums/mapping-and-modding/mapping-and-modding-tutorials/1571567-1-7-2-1-6-4-eventhandler-and

 

Okay. And PlayerTickEvent is called once a tick right? (20x a second)

Link to comment
Share on other sites

Yuup, also - IEEP is added (should be) on EntityConstructingEvent, which is server AND client. (You can have it only on server if you want)

Same goes for PlayerTickEvent (yes, 20 per 1sec). Remember to check side.

 

If you would like to actually update client with server data (packets) - don't waste one packet per tick per player.

Rather send initial time and then increment this initial time on client side and maybe resynchronize once in a while.

 

See http://www.minecraftforge.net/forum/index.php/topic,27401.0.html (this long (my) post) about more stuff regarding synchronization.

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

Link to comment
Share on other sites

Yuup, also - IEEP is added (should be) on EntityConstructingEvent, which is server AND client. (You can have it only on server if you want)

Same goes for PlayerTickEvent (yes, 20 per 1sec). Remember to check side.

 

If you would like to actually update client with server data (packets) - don't waste one packet per tick per player.

Rather send initial time and then increment this initial time on client side and maybe resynchronize once in a while.

 

See http://www.minecraftforge.net/forum/index.php/topic,27401.0.html (this long (my) post) about more stuff regarding synchronization.

 

Nope. I don't need stuff on the client. I was just planning on interfacing through commands. Now, how does one get the IExtendedEntityProperties of an offline player?

 

I also have this issue when the player logs out, apparently there's two of them?

 

Code: http://pastebin.com/zSUBWnYa and http://pastebin.com/wPui5vKv

Link to comment
Share on other sites

"Nope. I don't need stuff on the client."

You can add your PlayTimeData only for server-side PlayerEntities (!world.isRemote).

But watch out - make sure you won't be getting this IEEP on client (null).

 

"get the IExtendedEntityProperties of an offline player"

Impossible, IEEP is loaded with EntityPlayer's NBT, you would need a custom loader (copy vanilla code) that would load offline data.

You will need to translate nick to UUID (quite hard one, you can use cache file maybe for logged in player - similar to one Dedicated server has). Then get UUID.dat and read it using (de)compression tools.

 

"issue when the player logs out"

Yeah, if you register IEEP for client and server there will be 2, one for each. Client one is never saved to NBT, only virtual stuff to store data received from server.

 

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.

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

Announcements



×
×
  • Create New...

Important Information

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