Minecraft Data Packs / Other

Raycasting Engine/Framework

  • check_circle Functions
  • 2,886 views, 9 today
  • 306 downloads, 1 today
  • 9
  • 5
itskegnh's Avatar itskegnh
Level 10 : Journeyman Miner
0
Raycasting Framework.



Inside each function file comments are shown to help you edit and understand the basics of raycasting.

The function file ray:ray_hit will be run if a block is detected/hit.

Inside the ray:loop_ray function, you can edit the maximum range of the ray, the length between points of the ray (default 0.2).



Everything in this datapack is made to be used by others.



You could for example make a custom lightning wand, where when you click with a specific item it raycasts and summons lightning.

Lightning Wand - (inside the ray_hit function)
execute if entity @s[nbt={SelectedItem:{id:"minecraft:carrot_on_a_stick", Count:1b, tag:{lightning_wand:1b}}}] run summon lightning_bolt ~ ~ ~

because the ray_hit function is run as the player, at the ray collision location we can summon lightning if ourselves are holding a specific item.
CompatibilityMinecraft 1.16
Tags

Create an account or sign in to comment.

Planet Minecraft

Website

© 2010 - 2024
www.planetminecraft.com

Welcome