Jump to content

(Solved)[1.15.2]Why do I get 2 different values from player.distanceWalkedModified?


Recommended Posts

Posted (edited)

This cord gets 2 different values of player.distanceWalkedModified from Render Thread and Server Thread.

How do I get only one of these?

@SubscribeEvent
  public static void getDistanceWalked(TickEvent.PlayerTickEvent event) {
    float walkDistance = (float)(event.player.distanceWalkedModified / 0.6);
    LOGGER.debug("now: " + event.player.distanceWalkedModified / 0.6 + "blocks");
  }

 

Edited by kyazuki
Posted

Can you get a world object to check if your world isRemote?

 

I would imagine that the render thread doesn't run on the server and/or is not the one you're looking for.

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.