SerenityJS
    Preparing search index...

    Class BlockCommandBlockTrait

    Runs the command of impulse, repeating and chain command blocks.

    There is no redstone, so command blocks are powered by the power sources next to them: pressed buttons and pressure plates, levers that are on, redstone blocks and torches, powered redstone dust and observers. Buttons and levers also power the solid block they are attached to, and with it the command blocks next to that block.

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    block: Block

    The block that this trait is attached to.

    component: null | typeof BlockTypeComponent = ...

    The block component that this trait is attached to.

    dimension: Dimension

    The dimension that the block is in.

    identifier: string = ...

    The identifier of the trait.

    state: null | string = ...

    The block state key that this trait is attached to.

    tag: null | string = ...

    The block tag that this trait is attached to.

    component: null | typeof BlockTypeComponent = null

    The block component that this trait is compatible with by default. If null, the trait will not attach to any block by default.

    identifier: "command_block"

    The identifier of the trait.

    state: null | string = null

    The block state key that this trait is compatible with by default. If null, the trait will not be initialized by any block state.

    tag: null | string = null

    The block tag that this trait is compatible with by default. If null, the trait will not attach to any block by default.

    types: BlockIdentifier[] = ...

    The block type identifiers that this trait is compatible with by default.

    Methods

    • Breaks the block on the next tick, dropping it, if it is still not held up then. Breaking a block updates its neighbours, so blocks held up by one another break one per tick, as in vanilla, rather than all at once, which spreads the work of breaking many blocks over many ticks.

      Parameters

      • isSupported: () => boolean

        Checks whether the block is held up.

      Returns void

    • Runs the command of the command block, then the chain command block it points into.

      Parameters

      • currentTick: bigint

        The current tick.

      • length: number = 1

        The number of command blocks the chain has run so far.

      Returns void

    • Sets the probability of this trait being randomly ticked each tick.

      Parameters

      • numerator: number

        The numerator of the probability fraction.

      • denominator: number

        The denominator of the probability fraction.

      Returns void

    • Wether this trait should be randomly ticked this tick.

      Parameters

      • factor: number = 1

        A factor to multiply the chance by. Default is 1.

      Returns boolean

      True if the trait should be randomly ticked, false otherwise.