setBlock

open fun setBlock(block: Block, blockId: Key): Boolean(source)

Sets the block with blockId in its default state in place of the empty block.


abstract fun setBlock(block: Block, blockId: Key, state: String?): Boolean(source)

Sets the block with blockId in place of the empty block. To replace a block, break it first, so its plugin can clean up. Block physics is applied as usual, so neighboring blocks are updated.

Return

false if the block is not empty, the ID is unknown, the state is invalid, or the block can't be set.

Parameters

state

State of the block in the format of its provider, usually block state properties like [facing=north]. A blank state is the same as null: the default state. If the state is invalid, the block is not set and a warning is logged.