Making an item, which teleport you to block you are looking at, but only for set distance

Started by Frumptle on

Topic category: Help with Minecraft modding (Java Edition)

Joined Oct 2025
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Making an item, which teleport you to block you are looking at, but only for set distance

Hello, I am trying to make an interesting item - Warper. If you look at a block, you teleport to it, but the block must be solid, you cannot teleport through walls and most importantly - block should be 20 or less blocks away from you, otherwise it won't work.

I tried to make raytracing stuff, but i can't compare a distance - it is only available as an integer.

I am using MCreator 2025.1.

Any suggestions?