Raycasting Customizer

Generates a data pack using vdvman1's raycasting functions.

An updated version of the generator can be found here:

https://sourceblock.net/beta/en-US/tools/data-packs/raycasting-generator

Use the following command to activate the raycast:

execute as <shooter> at @s anchored eyes positioned ^ ^ ^ anchored feet run function vdv_raycast:start_ray

Raycasting method

Maximum distance in blocks that the raycast will travel.

Customization options

Commands

Tip: use the following command if you want to force a successful raycast to continue: scoreboard players set #hit vdvcasttemp 0
Tip: select the entity that performed the raycast by looking for an entity with the vdvray tag. For example: @a[tag=vdvray,limit=1]

Specify the commands you wish to run when raycasting succeeds.

If detecting an entity, the entity that was found can be targeted with @s while the execution position is at the hit position. The position of the hit entity can be targeted with execute at @s.

Tip: use the following command if you want to force a successful raycast to continue: scoreboard players set #hit vdvcasttemp 0
Tip: select the entity that performed the raycast by looking for an entity with the vdvray tag. For example: @a[tag=vdvray,limit=1]

Specify the commands you wish to run when the entity raycasting succeeds.

The entity that was found can be targeted with @s while the execution position is at the hit position. The position of the hit entity can be targeted with execute at @s.


Specify the commands you wish to run when the block raycasting succeeds.

Tip: select the entity performing the raycast with @s.

Specify the optional commands to run before the selected entity begins the raycast. You can use this to, for example, play a sound to indicate that the raycast has started (such as a sound of a laser being fired).


Specify the optional commands to run after the raycast fully ends for the entity, regardless of whether or not the raycast succeeded. The position will be at the original entity that started the raycast.

Tip: select the entity that performed the raycast by looking for an entity with the vdvray tag. For example: @a[tag=vdvray,limit=1]

Specify the optional commands to run at each step of the raycast. This can be used to, for example, create a line of particles.


Specify the optional commands you wish to run when the raycast finishes without succeeding.

Use the following command to activate the raycast:

execute as <shooter> at @s anchored eyes positioned ^ ^ ^ anchored feet run function vdv_raycast:start_ray