Alpha: this compiler is under active development and updates will break your projects. Not recommended for real use yet.
Skip to content

spool / RaycastOptions

Interface: RaycastOptions โ€‹

Defined in: plugins/raycast/index.ts:17

Options for a block raycast that marches ^ through air and runs onHit at the first block.

No entities or macros. You decide what a hit does; hitOn filters which blocks count.

Properties โ€‹

hitOn? โ€‹

readonly optional hitOn?: Block

Defined in: plugins/raycast/index.ts:28

Blocks that count as a hit (id or Block.tag(...)). Default: any non-air block. The ray still stops at the first non-air block; a non-match is a miss.


maxSteps โ€‹

readonly maxSteps: number

Defined in: plugins/raycast/index.ts:21

Maximum reach, in steps of stepBlocks.


name โ€‹

readonly name: string

Defined in: plugins/raycast/index.ts:19

Function path suffix and step-slot name (raycast/<name>). Must be unique per pack.


stepBlocks? โ€‹

readonly optional stepBlocks?: number

Defined in: plugins/raycast/index.ts:23

Stride per step along the line of sight, in blocks. Default 0.5.


stopAt? โ€‹

readonly optional stopAt?: Selector

Defined in: plugins/raycast/index.ts:38

Entities that end the ray early and run onReach instead of onHit.

Turns the ray into a line-of-sight check. Give it distance slack, since the ray samples every stepBlocks and distance measures to feet.


through? โ€‹

readonly optional through?: Block

Defined in: plugins/raycast/index.ts:30

Blocks the ray passes through. Default: air.

Methods โ€‹

onHit()? โ€‹

optional onHit(ctx): void

Defined in: plugins/raycast/index.ts:49

Runs at the hit block (only matching blocks with hitOn). Optional for pure line-of-sight rays.

Parameters โ€‹

ctx โ€‹

FunctionContext

Returns โ€‹

void


onReach()? โ€‹

optional onReach(ctx): void

Defined in: plugins/raycast/index.ts:44

Runs where stopAt matched. Ending it with ctx.return_(1) makes the whole ray return 1, so execute if function <ref>.cast is a line-of-sight test.

Parameters โ€‹

ctx โ€‹

FunctionContext

Returns โ€‹

void

Released under the MIT License ยท Credits
These docs were written with AI; the layout and every page have been reviewed by a human.