How to make a sword that teleports you where you are looking but stops if you hit a block (Like AOTE)

Started by DuckyGK on

Topic category: Help with Minecraft modding (Java Edition)

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
How to make a sword that teleports you where you are looking but stops if you hit a block (Like AOTE)

So basicly the title says it all, I want a sword that teleports you 8 blocks or until you reach a block that you cant pass through. I know there is probably a very simple way to do this but I just started coding so need some help. Thanks! (Also I am using the fabric generator mod if that matters)

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Thank you so much but one…
Fri, 10/25/2024 - 21:28

Thank you so much but one question, was does the purple block mean/do?

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
it's a custom code block, I…
Fri, 10/25/2024 - 21:50

it's a custom code block, I like using guard clauses. You can nest it instead if you want.

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
so basically the purple…
Fri, 10/25/2024 - 21:51

so basically the purple block does literally anything

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Hey, I started making it but…
Mon, 10/28/2024 - 02:25

Hey, I started making it but for the variables like direction would i just use a direction variable because there were a couple options like block state and such. Also what should i use for the x y z variables? Thank you so much for your help so far!

Joined Dec 2014
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
download and import the…
Mon, 10/28/2024 - 02:32

download and import the procedure from the link i sent instead of remaking it 

Joined Sep 2024
Points:

User statistics:

  • Modifications:
  • Forum topics:
  • Wiki pages:
  • MCreator plugins:
  • Comments:
Oh didn’t know you could do…
Mon, 10/28/2024 - 11:51

Oh didn’t know you could do that, Thanks!