Crab.waitForBlock()

From 8x9craft
Jump to: navigation, search
function waitForBlock(): Vector3i

Make the crab wait until a block has been changed around it. That includes blocks in front, behind, to the left, to the right, above and below the crab.

Returns: an object of type Vector3i containing the position of the block that has changed.

Examples

// Wait for a block to change.
while (!crab.isBlocked()) {
    crab.forward();
}
var pos = crab.waitForBlock();
var forward = crab.getPosition().offset(crab.getFacing());
if (pos == forward) {
    crab.say('A block in the front has changed');
}

See also