How to teleport player to block?

Started by Professor Blue on Sat, 07/24/2021 - 13:07

Topic category: Help with modding (Java Edition)

Last seen on 17:02, 16. Sep 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
How to teleport player to block?
Sat, 07/24/2021 - 13:07

I'm trying to make it so when I right click with an item, I teleport to a specific block.

The main thing I'm stuck with is how to teleport to the block (a security camera)

I already know how to make the view zoom in, I only need to make the player teleport.

Any help greatly appreciated

Last seen on 09:08, 18. Sep 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
If the item somehow …
Sat, 07/24/2021 - 15:22

If the item somehow "connects" to the chosen camera, then you can just store the xyz position in 3 variables, or nbt tags.

Last seen on 17:02, 16. Sep 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Could you send an image…
Sat, 07/24/2021 - 15:33

Could you send an image maybe?

I'm struggling to understand

Last seen on 09:08, 18. Sep 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Can't really use MCreator…
Sat, 07/24/2021 - 15:49

Can't really use MCreator currently, sorry.

But the procedures should look somehow like this:

 On Item Right Clicked on block:

 If block at x,y,z = camera

 Set NBT number tag "camera_x" of Item to : x   

 Set NBT number tag "camera_y" of Item to : y

 Set NBT number tag "camera_z" of Item to : z   

This should store the position of right clicked block as an item tag.

 Then for example:

On Item right clicked in air:

 Set player's location to x: [Get NBT number tag "camera_x" of Item]

                                         y: [Get NBT number tag "camera_y" of Item]

                                         z: [Get NBT number tag "camera_z" of Item]

Can't explain any better than that. But if you got any questions I'll look into them.

Last seen on 17:02, 16. Sep 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
Is there any global trigger…
Sun, 07/25/2021 - 10:40

Is there any global trigger I should use?

Last seen on 09:08, 18. Sep 2021
Joined Aug 2018
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
First bolded procedure…
Sun, 07/25/2021 - 12:07

First bolded procedure should be used in "On Item right clicked on block" event, second one in "On item right clicked in air".

No extra triggers should be required.

Last seen on 17:02, 16. Sep 2021
Joined Jul 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • Tracker tickets:
  • MCreator plugins:
  • Comments:
I did everything and it didn…
Sun, 07/25/2021 - 16:53

I did everything and it didn't work

Any other suggestions?