command

This peripheral allows you to interact with command blocks.

Command blocks are only wrapped as peripherals if the enable_command_block option is true within the config.

This API is not the same as the commands API, which is exposed on command computers.

setCommand(command)Set the command block's command.
getCommand()Get the command this command block will run.
runCommand()Execute the command block once.
setCommand(command)Source

Set the command block's command.

Parameters

  1. command string The new command.
getCommand()Source

Get the command this command block will run.

Returns

  1. string The current command.
runCommand()Source

Execute the command block once.

Returns

  1. boolean If the command completed successfully.
  2. string | nil A failure message.