How do I make a player teleport to where's they're looking at with a right click but not to air blocks?

Started by Solaris_21 on

Topic category: Help with Minecraft modding (Java Edition)

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How do I make a player teleport to where's they're looking at with a right click but not to air blocks?

Trying to make a strong teleporting weapon which will teleport you to whatever block you are looking at only with one issue; you can teleport into the sky and infenitely do this, letting you fly. How can I fix this? Is there any way to add a short cooldown to the teleport? How can I make this fail if you aren't facing any blocks?

Joined Jun 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
my solution to this was with…
Sat, 05/27/2023 - 20:26

my solution to this was with a potion effect but hit me up on discord if you want em to drop a screenshot since i hate this website Von#2392

Joined May 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
you could try making a…
Sat, 05/27/2023 - 21:58

you could try making a procedure that shoots a projectile and if the projectile hits something, teleport the player to it, but if it doesn't hit something withing a set amount of time, kill the projectile.

Joined Nov 2021
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
And make that projectile…
Mon, 05/29/2023 - 19:14

And make that projectile invisible

Joined Jun 2023
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Here is a tutorial I made:…
Fri, 07/07/2023 - 19:07

Here is a tutorial I made: link