**This is an old revision of the document!**

Component: Debug

This component is provided by the Debug Card.

Component name: debug.
The Debug Card, which is only available in creative mode, provides a set of fairly dangerous functionality for use in setting things up to debug and test code. Do not use the Debug Card without backups. No, really. One time I accidentally converted a vertical slice of the world entirely to Sign objects with no writing on them.

The debug card's “container” refers to the robot, computer or tablet with a debug card installed in it.

Callbacks:

  • getWorld():userdata
    Returns a World object (see below) that can manipulate the world containing the container of the debug card.
  • getPlayer(name:string): userdata
    returns a Player object (see below) that can interact with the named player.
  • getX(): number
    Get the container's X position in the world.
  • getY(): number
    Get the container's Y position in the world.
  • getZ(): number
    Get the container's Z position in the world.
  • changeBuffer(number): number
    Alters the power stored in the container's energy buffer.
  • runCommand(command:string):number
    Runs an arbitrary command using the common OC fake player. The name and UUID of this fake player can be changed in the config.

World Object

The world object reflects the current world (dimension) the container is in.

  • getDimensionName(): string
    Gets the name of the current dimension.
  • getDimensionID(): number
    Gets the numeric id of the current dimension.
  • getSeed(): number
    Gets the seed of the world.
  • isRaining(): boolean
    Returns whether it is currently raining.
  • setRaining(boolean)
    Sets whether it is currently raining.
  • isThundering(): boolean
    Returns whether it is currently thundering.
  • setThundering(boolean)
    Sets whether it is currently thundering. Note: it must be raining for this to have any effect.
  • getTime(): number
    Get the current world time, in ticks.
  • setTime(number)
    Set the current world time, in ticks.
  • getSpawnPoint(): number, number, number
    Get the current spawn point coordinates.
  • setSpawnPoint(x: number, y:number, z:number)
    Set the spawn point coordinates.
  • getBlockId(x: number, y:number, z:number): number
    Get the ID of the block at the specified coordinates.
  • getMetadata(x: number, y:number, z:number): number
    Get the metadata of the block at the specified coordinates.
  • isLoaded(x: number, y:number, z:number): number
    Check whether the block at the specified coordinates is loaded (or rather, the chunk containing the block).
  • hasTileEntity(x: number, y:number, z:number): number
    Check whether the block at the specified coordinates has a tile entity.
  • getLightOpacity(x: number, y:number, z:number): number
    Get the light opacity of the block at the specified coordinates.
  • getLightValue(x: number, y:number, z:number): number
    Get the light value (emission) of the block at the specified coordinates.
  • canSeeSky(x: number, y:number, z:number): number
    Get whether the block at the specified coordinates is directly under the sky.
  • setBlock(x: number, y:number, z:number, id:number, meta:number)
    Set the block at the specified coordinates.
  • setBlocks(x0: number, y0:number, z0:number, x1: number, y1:number, z1:number, id:number, meta:number)
    Set all blocks in the area defined by the two corner points (x1, y1, z1) and (x2, y2, z2).

Player Object

A player object represents a given player in the world.

  • getWorld(): userdata
    Get the player's world object (see above).
  • getGameType(): string
    Get the player's game type.
  • setGameType(value: string)
    Set the player's game type (survival, creative, adventure).
  • getPosition(): number, number, number
    Get the player's position.
  • setPosition(x: number, y:number, z:number) Set the player's position.
  • getHealth(): number
    Get the player's health, in half hearts.
  • getMaxHealth(): number
    Get the player's max health, in half hearts.
  • setHealth(value:number)
    Set the player's health, in half hearts.