How to check if the player is more than 64 blocks away from the position

Started by sansdw on

Topic category: Help with Minecraft modding (Java Edition)

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to check if the player is more than 64 blocks away from the position

I need help with that, it does teleport the player, yes it does. But even if i am 64 blocks away from the position i can still teleport ( which is not meant ) 

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
i cant send the image so…
Wed, 08/10/2022 - 16:24

i cant send the image so yeah, but its basically a tool that teleports you if you are 64 blocks nearby the position you set to teleport.

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
hi, if you upload the…
Wed, 08/10/2022 - 18:06

hi, if you upload the screenshot to something like imgur it would be alot easier. or you could view the code and send that instead.

but it sounds like what you want to do, is something like this.

(event)

get entity x, y and z
get origin x, y and z
if entity x,y&z is < 64 blocks away from origin xyz:
    teleport entity to origin

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
https://imgur.com/a/vpie4f0…
Wed, 08/10/2022 - 20:06

https://imgur.com/a/vpie4f0

Sorry for late response, i don't know why but i can't upload images so heres the link

and yes, thats what i want to do

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
can i ask when you are…
Wed, 08/10/2022 - 20:51

can i ask when you are calling this procedure? is it only on right click of an item?

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
yeah, to set the position…
Wed, 08/10/2022 - 21:46

yeah, to set the position you shift + right click and to teleport you just right click

Joined Feb 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
seem your issue is your…
Fri, 08/12/2022 - 16:37

seem your issue is your checking if any entity exists within 64 blocks of the player and then teleporting rather then if your within 64 blocks of the location

Joined Apr 2020
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
sorry im late lol. so how…
Sat, 08/13/2022 - 22:36

sorry im late lol. so how would i do it? im still learning mcreator