SerenityJS
    Preparing search index...

    Places beds as vanilla does: the foot goes where the bed is placed, and the head in the space beyond it, the way the player faces, which needs a floor too. Both halves keep the colour of the bed item, and breaking either half breaks the other.

    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: "bed"

    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.

    Accessors

    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

    • Sets the colour of the bed.

      Parameters

      • color: number

        The colour of the bed, as the auxiliary value of its item.

      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.