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

    Class BlockEntityStorageComponentBeta

    Represents storage for entities associated with a block entity. This component is available on blocks whose behavior pack definition enables entity storage with the minecraft:block_entity component. Stored entities are serialized and removed from the world until they are released or transferred. A block can store up to four entities. Entity storage is scoped to the content pack accessing it.

    export class BlockEntityStorageComponent extends BlockComponent {
    private constructor();
    static readonly componentId = 'minecraft:entity_storage';
    getEntities(): BlockEntityStorageInfo[];
    release(entityId: string): Entity;
    size(): number;
    store(entity: Entity): string;
    transfer(entityId: string, targetBlock: Block): void;
    }

    Hierarchy (View Summary)

    Index
    block: Block

    Block instance that this component pertains to.

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

    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:entity_storage" = 'minecraft:entity_storage'
    • Parameters

      Returns string

      The unique ID assigned to the stored entity. Keep this ID to release, transfer, or inspect the stored entity later.

      Serializes and stores an entity in this block's entity storage. The entity is removed from the world after it is stored. Only non-player mob entities can be stored. Entities with passengers or that are passengers cannot be stored.

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

      Throws if the storage is full, the entity is already stored, the entity cannot be serialized, or the block entity is invalid.

      Error

      InvalidBlockComponentError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError

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

    • Parameters

      Returns void

      Moves a stored entity from this block's entity storage to the target block's entity storage without releasing it into the world.

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

      Throws if the entity ID is invalid or not stored by the current content pack, if the target block is invalid, in another dimension, lacks entity storage, or is full, or if the source and target blocks are the same.

      Error

      InvalidBlockComponentError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError

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