Script API - v26.40.29
    Preparing search index...

    Class ItemBlockDynamicPropertiesComponentBeta

    Represents the dynamic properties of a block. Only available from block entities. Up to 1KBytes of data can be stored per content pack per block entity in their dynamic properties storage.

    export class ItemBlockDynamicPropertiesComponent extends ItemComponent {
    private constructor();
    static readonly componentId = 'minecraft:block_actor_dynamic_properties';
    get(key: string): boolean | number | string | Vector3 | undefined;
    set(key: string, value?: boolean | number | string | Vector3): void;
    totalByteCount(): number;
    }

    Hierarchy (View Summary)

    Index

    Constructors

    Properties

    isValid: boolean

    Returns whether the component is valid. A component is considered valid if its owner is valid, in addition to any addition to any additional validation required by the component.

    This property can't be read in early-execution mode.

    typeId: string

    Identifier of the component.

    This property can't be read in early-execution mode.

    componentId: "minecraft:block_actor_dynamic_properties" = 'minecraft:block_actor_dynamic_properties'

    Methods

    • Parameters

      • key: string

      Returns string | number | boolean | Vector3 | undefined

      Returns a DynamicProperty that was stored with the provided key. Keys are unique to each content pack and cannot be used to retrieve dynamic properties set from other content packs. Returns undefined if the key was not found.

      This function can throw errors.

      Error

      InvalidItemStackError

      This function can't be called in early-execution mode.

    • Parameters

      • key: string
      • Optionalvalue: string | number | boolean | Vector3

      Returns void

      Sets a dynamic property with the provided key and value. Keys are unique to each content pack and cannot be used to set dynamic properties for other content packs. Values can be either a Number, a String or a Vector3. Setting a property with an undefined value will remove it from the storage. Storage size usage is counted towards the 1KBytes limit per content pack.

      This function can throw errors.

      Error

      InvalidItemStackError

      This function can't be called in early-execution mode.

    • Returns number

      Returns the current size, in bytes, of the dynamic properties storage for this block. The byte count only accounts for properties set by your content pack. The 1KBytes limit is per content pack.

      This function can throw errors.

      InvalidItemStackError

      This function can't be called in early-execution mode.