SerenityJS
    Preparing search index...

    Class BlockAttachmentTrait

    Breaks blocks, dropping them, when the block holding them up is removed: buttons, levers, ladders, wall and standing signs, banners, item frames, pressure plates, carpets, candles, rails, redstone dust, repeaters, comparators, doors and lanterns. They also cannot be placed where nothing holds them up.

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

    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: string[] = ...

    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

    • Whether a hanging sign on a wall is held up from one of its sides: by the block on that side, or, when that is another hanging sign in line with it, by what holds up the line of signs on that side. Signs in a line do not hold each other up, so the line breaks when nothing at either end holds it.

      Parameters

      • face: BlockFace

        The side of the sign.

      Returns boolean

    • Sets the direction of a lever from the face it was placed on. Levers on the top or bottom of a block lie along the direction the player faces.

      Parameters

      • face: BlockFace

        The face the lever was placed on.

      • Optionaldirection: CardinalDirection

        The direction the player placing the lever faces.

      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.