Mod API: game.raycast, the block the player looks at (level 2)
`game.raycast(distance)` returns the first block along the player's view (fluids pass), up to 1024 blocks: through the loaded chunks as the crosshair's ray goes, then across the distant terrain's ground heights (`Lod::ground`, from Stink-O's fork). The game casts it only while a running mod imports the function. It is API level 2, so older Horizons refuse a mod that calls it with "update Horizon". Co-authored-by: Stink-O <180130752+Stink-O@users.noreply.github.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -83,7 +83,7 @@ folder, loads no runtime and plays exactly like vanilla 26.3.
|
||||
| Interface | Capability | Functions |
|
||||
|---|---|---|
|
||||
| `log` | always | `write(level, message)`, in the game log as `[mod <id>]` |
|
||||
| `game` | `game-read` | `get-player()`: x y z, yaw, pitch, health, food, dimension; `get-clock()`: game time, day time |
|
||||
| `game` | `game-read` | `get-player()`: x y z, yaw, pitch, health, food, dimension; `get-clock()`: game time, day time; `raycast(distance)`: the first block along the view (fluids pass), up to 1024 blocks and across the distant terrain, with the point hit and the block's id |
|
||||
| `chat` | `chat` | `show(text)`: a line only the local player sees, after the mod's name (8 per call) |
|
||||
| `hud` | `hud` | `set-panel(corner, lines)`, `clear()`: up to 16 lines of 256 characters |
|
||||
| `storage` | `storage` | `get(key)`, `set(key, value)`, `delete(key)`: a per-mod folder of up to 64 files, 4 MiB total, at most 1 MiB written per call |
|
||||
|
||||
Reference in New Issue
Block a user