Jump to content

[1.18] how to get player Statistics variables


Ladymorepork

Recommended Posts

I am trying to make a mod that you can trade time you have played from the time played stats for loot bags or in game currency. This will be for a server.

I am struggling to get the a players Statistics for minecraft:play_time or PLAY_TIME or stat.playOneMinute. I am just so confused and I have been looking for hours of what code to use.

 

i tried to use this :

playertime = ((EntityPlayer)entity).func_147099_x().writeStat(StatList.minutesPlayedStat);

func_147099_x(). is a deprecated API I think. 

I also tried importing and using the net.minecraft.entity.player.ServerPlayerEntity class getStats() but that results in an error saying that it cant find it.

 

i know i would also need a way to update the player's time played stats but just a command might work.

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.