Item.useOnBlock

Function called when the item is used on a block clicking the right mouse button or performing a long pressure on the screen.

class Item
bool
useOnBlock

Return Value

Type: bool

true if the item is a tool and it has been cosnumed, false otherwise

Examples

// N.B. that this will not work as the block hasn't been placed
world[0, 64, 0] = Blocks.DIRT;
assert(world[0, 64, 0] == Blocks.DIRT);

new Items.WoodenShovel().useOnBlock(player, world[0, 64, 0], Faces.TOP);

assert(world[0, 64, 0] == Blocks.GRASS_PATH);

Meta