SerenityJS
    Preparing search index...

    Class BlockSignTrait

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

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

    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.

    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 player at a position sees the front of the sign, rather than its back. The front faces the way the sign was put up: away from the wall it is on, or turned to face whoever put it up, on the floor or hanging from a ceiling.

      Parameters

      • from: IPosition

        The position the sign is seen from.

      Returns boolean

    • Gets which of sixteen steps around a sign turned to face a player points, as standing signs count them. 0 faces south, and each step turns a sixteenth of the way round, clockwise.

      Parameters

      • player: Player

        The player the sign faces.

      Returns number

    • Whether a block beside a hanging sign on a wall holds it up: any but blocks like air and signs, or another hanging sign on a wall, facing along the same line, which the signs then hang in.

      Parameters

      • block: Block

        The block beside the sign.

      • facing: number = ...

        The direction the hanging sign faces; defaults to the direction this sign faces.

      Returns boolean

    • Whether a player clicking a face of this sign hangs the hanging sign they hold beside it, rather than editing it. This is the case for the sides of a hanging sign on a wall, which another hangs from in line with it; its front and back are the sides that are edited.

      Parameters

      • player: Player

        The player clicking the sign.

      • Optionalface: BlockFace

        The face of the sign the player clicked.

      Returns boolean

    • Places a hanging sign against a face of a block, as vanilla does. Under a ceiling, it hangs from chains at its edges, facing away from the player, when the block above is solid; otherwise, or when the player sneaks, it hangs from one chain in its middle and turns in sixteen steps. Against a wall, it sticks out of the wall on a bracket, its faces at right angles to the wall. Hanging signs are not placed on top of a block.

      Parameters

      • player: Player

        The player placing the sign.

      • Optionalface: BlockFace

        The face of the block the sign was placed against.

      Returns boolean

      Whether the sign was placed.

    • 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.