Skip to content
4tubborn edited this page Aug 9, 2026 · 3 revisions

APIs

Also see note for better understanding.

Functions

These APIs are functions tags. Call them directly as needed.


#sbox:create

Creates a box using storage data.

Inputs

Storage sbox:in.create:

{
  "shape": [[min_x, min_y, min_z, max_x, max_y, max_z]],
  "offset": { "x": 0, "y": 0, "z": 0 },
  "type": "collision",
  "root": true
}
  • shape: [[min_x, min_y, min_z, max_x, max_y, max_z]] The list of cube coordinates (matches the format of the Bookshelf Hitbox Module).

  • offset: {x:<double>,y:<double>,z:<double>} (Default: {x:0, y:0, z:0}) The positional offset of the box.

  • type: "collision"|"interaction"|"both" (Default: "collision")

    • collision creates a solid collision box.
    • interaction creates an interaction box.
    • both creates both collision and interaction boxes.
  • root: <bool> (Default: true) Whether to spawn a new root entity for the box.


#sbox:create_inline {with:{}}

Creates a box directly inline via a macro argument.

Inputs

Macro Arguments (with) :

Accepts the same fields as #sbox:create (shape, offset, type, root).


Note: The following function tags require Bookshelf Link Module to work.


#sbox:remove

Removes a box.

Inputs

Execution Context:

  • Executor: the root entity of the box.

#sbox:update_shape

Updates the shape or the type of the box using storage data.

Inputs

Storage sbox:in.update:

Example:

{
  "shape": [[min_x, min_y, min_z, max_x, max_y, max_z]],
  "offset": { "x": 0, "y": 0, "z": 0 },
  "type": "collision",
  "mode": "keep"
}
  • shape: [[min_x, min_y, min_z, max_x, max_y, max_z]] The list of cube coordinates (matches the format of the Bookshelf Hitbox Module).

  • offset: {x:<double>,y:<double>,z:<double>} (Default: {x:0, y:0, z:0}) The positional offset of the box.

  • type: "collision"|"interaction"|"both" (Default: the same type of the original box)

    • collision creates a solid collision box.
    • interaction creates an interaction box.
    • both creates both collision and interaction boxes.
  • mode: "keep"|"replace" (Default: "keep") Has lower priority than type.

    • keep: Keep original type.
    • replace: Replace the original type. (If set to replace, the default type will revert to "collision").

#sbox:update_shape_inline {with:{}}

Updates a box directly inline via a macro argument.

Inputs

Macro Arguments (with) :

Accepts the same fields as #sbox:update_shape (shape, offset, type, mode).


Function Tags

These APIs are function tags. Add your functions into these tags.


Note: This function tag requires Bookshelf Link Module to work.

#sbox:init/root

Triggered when creating the box or updating the box. Used for initializing the root, before calling function tag #sbox:init/boxes.

Execution Context:

Context Value
Executor The root entity (root: true) or the same as #sbox:create (root: false)
Dimension The same as #sbox:create
Position The same as #sbox:create
Rotation The same as #sbox:create
Anchor The same as #sbox:create

#sbox:init/boxes

Triggered when creating the box or updating the box. Used for initializing the unit roots and interactions.

Execution Context:

Context Value
Executor The unit roots and interactions
Dimension The same as #sbox:create
Position The same as #sbox:create
Rotation The same as #sbox:create
Anchor The same as #sbox:create

#sbox:event/on_create

Triggered before initializing the root, unit roots and interactions(before calling #sbox:init/root and #sbox:init/boxes).

Execution Context:

Context Value
Executor The same as #sbox:create
Dimension The same as #sbox:create
Position The same as #sbox:create
Rotation The same as #sbox:create
Anchor The same as #sbox:create

#sbox:event/on_remove

Triggered before killing the box.

Execution Context:

Context Value
Executor The root entity
Dimension The same as #sbox:remove
Position The same as #sbox:remove
Rotation The same as #sbox:remove
Anchor The same as #sbox:remove

#sbox:event/on_left_click

Triggered when hitting the box.

Execution Context:

Context Value
Executor The player who hits the box
Dimension The player's current dimension
Position The position of the player
Rotation The rotation of the player
Anchor feet

#sbox:event/on_right_click

Triggered when interacting with the box. The box type must be "both" or "interaction".

Execution Context:

Context Value
Executor The player who interacts with the box
Dimension The player's current dimension
Position The position of the player
Rotation The rotation of the player
Anchor feet

Predicates

These APIs are predicates. Call them directly as needed.

sbox:children

Check whether the entity is a unit root or an interaction.

sbox:interaction

Check whether the entity is an interaction.

sbox:unit_root

Check whether the entity is a unit root.