Jump to content

Player's position listener


ColdFox

Recommended Posts

I'm doing a block that is supposed to track the player's position. I'm using randomDisplayTick(...) but I noticed that soon as I am far away from the block it stops tracking. I think that there must a better solution instead randomDisplayTick but I don't know what. Can anybody help me here?  :-\

Link to comment
Share on other sites

I'm doing a block that is supposed to track the player's position. I'm using randomDisplayTick(...) but I noticed that soon as I am far away from the block it stops tracking. I think that there must a better solution instead randomDisplayTick but I don't know what. Can anybody help me here?  :-\

 

I would assume that the block get's unloaded since the player is far away and the whole chunk get's unloaded?

If you guys dont get it.. then well ya.. try harder...

Link to comment
Share on other sites

I'm doing a block that is supposed to track the player's position. I'm using randomDisplayTick(...) but I noticed that soon as I am far away from the block it stops tracking. I think that there must a better solution instead randomDisplayTick but I don't know what. Can anybody help me here?  :-\

 

I would assume that the block get's unloaded since the player is far away and the whole chunk get's unloaded?

 

The chunk doesn't unload, because I only get like 30 or 40 blocks away from the block. But it may unload if I go farther, that way what can I do?

Link to comment
Share on other sites

Note that randomDisplayTick is a Client-side only function. If you use it for anything that modifies the world (e.g. spawning entities, setting blocks) it will not work.

It is intended for stuff like torches spawning their particles. So it makes sense that it stops getting called when you go away, since the particles wouldn't be visible anyways.

Depending on what you want to do, you probably want a TileEntity.

 

That did the trick ;)

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.