Global

Type Definitions

Block

A block string consisting of a resource location[0] and a list of comma-seperated block states in brackets. [0] https://minecraft.fandom.com/wiki/Resource_location e.g. - `minecraft:chest[facing=north,type=single,waterlogged=false]` - `minecraft:redstone_wire[east=side,north=none,power=5,south=up,west=none]`

ContainerReference

Properties:
Name Type Attributes Description
ContainerReference.x number <nullable>
the x coordinate of the container this item is in
ContainerReference.y number <nullable>
the y coordinate of the container this item is in
ContainerReference.z number <nullable>
the z coordinate of the container this item is in
ContainerReference.structure boolean <nullable>
when `true`, use structure inventory instead of a container

CraftError

Properties:
Name Type Description
CraftError.type String one of "connection closed", "unauthenticated", "authentication failed", "invalid operation", "invalid structure", "bad request", "out of fuel" or "offline".

Entity

Properties:
Name Type Attributes Description
Entity.type String
Entity.name String
Entity.health number <nullable>
Entity.max_health number <nullable>
Entity.player_uuid String <nullable>
Entity.x number
Entity.y number
Entity.z number

FuelInfo

Properties:
Name Type Description
connections Array.<FuelInfoConnection> A list of all active connections for your player to all your structures.
strategies Array.<FuelInfoStrategy> A list of strategies and how much fuel they have in reserve.
apis Object.<string, FuelInfoAPICost> A list of apis you can call and their base and adjusted fuel costs

FuelInfoAPICost

Properties:
Name Type Description
baseFuelCost number How much this API costs normally
fuelCost number How much this API costs right now

FuelInfoConnection

Properties:
Name Type Description
x number the minimum x coordinate of the connection's structure
y number the minimum y coordinate of the connection's structure
z number the minimum z coordinate of the connection's structure
structure string A textual representation of the structure. The format is not fixed and subject to change.
fuelUsage Object.<string, FuelInfoConnectionFuelUsage> Fuel used by API route

FuelInfoConnectionFuelUsage

Properties:
Name Type Description
second number the amount of fuel used in the past 1 second
minute number the amount of fuel used in the past 1 minute

FuelInfoStrategy

Properties:
Name Type Description
name string the name of the strategy
strategy string the type of strategy ("ratelimit", "item", "economy", "durability", etc.)
spareFuel number How much "spare" fuel this strategy has, which will be used before the strategy is activated to generate more. For `ratelimit`, this is always increasing up to a cap. For `item`, this is refilled when an item is burnt.
userLimit number How much fuel the strategy is allowed to use for this context, as set by `setFuelLimit`
totalUsed number How much fuel the strategy has generated for this context so far
generatableEstimate number An estimate of how much fuel can be generated

Item

Properties:
Name Type Description
Item.index number
Item.type String
Item.amount number

ItemReference

Properties:
Name Type Description
ItemReference.index number the container slot this item is in

TransactionControl() → {Promise}

Returns:
Promise

XYZ

A tuple of x, y, z coordinates

Events

block update

Parameters:
Name Type Description
cause string The cause of the update. One of: "poll" "burn" "break" "explode" "fade" "grow" "ignite" "piston_extend" "piston_retract" "place" "fluid" "decay" "redstone"
block Block the new state of the block
x number the x coordinate of the block that changed
y number the y coordinate of the block that changed
z number the z coordinate of the block that changed
context number the context ID this event was fired in. Will be re-fired on the appropriate StructureContext as well.

close

contextClosed

Parameters:
Name Type Description
context number the ID of the closed context. Will be re-fired on the appropriate StructureContext as well.
cause String why the context was closed

contextOpened

Parameters:
Name Type Description
context StructureContext the newly created context
cause String why the context was created. One of `itemAttack`, `itemBreakBlock`, `itemInteractBlock`, `itemInteractAir`.

error

Parameters:
Name Type Description
the CraftError error that occured

open

outOfFuel

Parameters:
Name Type Description
error CraftError the out of fuel error

transact

Parameters:
Name Type Description
transaction Object
Properties:
Name Type Description
transaction.query String the text used in the /transact command, excluding the initial amount
transaction.amount number The amount of money being offered in the transaction
transaction.player String the username of the player using the /transact command
transaction.player_uuid String the uuid of the player using the /transact command
transaction.accept TransactionControl Accepts the transaction, depositing the money into your account
transaction.deny TransactionControl Denies the transaction, refunding the money
transaction.context number the context ID this event was fired in. Will be re-fired on the appropriate StructureContext as well.