c0de 0.3.0This page in English

Diese Seite ist noch nicht übersetzt. Sie wird auf Englisch angezeigt.

MINE_BLOCK ​

Breaks a block like a player, with a tool from an inventory.

It takes the most suitable tool of tool_inventory: first a tool that gets the block and is faster (a pickaxe for cobblestone, shears for leaves), then an item that gets the block, then a faster tool, and otherwise bare hands. Of several equally suitable tools it takes the first one, e.g. the iron pickaxe in slot 0 before the diamond pickaxe in slot 2 for cobblestone; for obsidian it takes the diamond pickaxe.

The tool is damaged as if a player used it, and the program waits as long as a player would need to break the block. The drops go into output_inventory; without it, they fall on the ground. If they don't fit into the output inventory, INVENTORY_FULL is raised and the block stays. Bedrock and fluids can't be mined (INVALID_ARGUMENT). Every owner may use MINE_BLOCK, because it only does what players can do.

Parameters and results

  • position STRUCT c0de/minecraft/POSITION: where the block is
  • tool_inventory STRUCT c0de/minecraft/POSITION: the block whose inventory holds the tools, e.g. a chest
  • output_inventory STRUCT c0de/minecraft/POSITION: the block whose inventory gets the drops (optional)

Example

c0de
CALL c0de/minecraft/MINE_BLOCK
    PARAMETER position spot ;
    PARAMETER tool_inventory tools ;
    PARAMETER output_inventory chest ;