How to teleport player to block?

Started by Professor Blue on

Topic category: Help with Minecraft modding (Java Edition)

Active 3 years ago
Joined Jul 2021
Points:
595

User statistics:

  • Modifications: 1
  • Forum topics: 5
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 32
How to teleport player to block?

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

Active 2 weeks ago
Joined Aug 2018
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 124
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.

Active 3 years ago
Joined Jul 2021
Points:
595

User statistics:

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

Could you send an image maybe?

I'm struggling to understand

Active 2 weeks ago
Joined Aug 2018
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 124
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.

Active 3 years ago
Joined Jul 2021
Points:
595

User statistics:

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

Is there any global trigger I should use?

Active 2 weeks ago
Joined Aug 2018
Points:
781

User statistics:

  • Modifications: 0
  • Forum topics: 8
  • Wiki pages: 0
  • MCreator plugins: 0
  • Comments: 124
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.

Active 3 years ago
Joined Jul 2021
Points:
595

User statistics:

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

I did everything and it didn't work

Any other suggestions?