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

    Class ItemBlockEntityStorageComponentBeta

    Stores serialized non-player mobs on an item stack. Each calling behavior pack can only access its manifest UUID bucket. All buckets share a four-entity limit. Available on item stacks even when empty. Destroying the item discards its storage without spawning entities. Data is compatible with entity-storage block carry-over and placement.

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

    Hierarchy (View Summary)

    Index
    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_entity_storage" = 'minecraft:block_entity_storage'
    • Returns BlockEntityStorageInfo[]

      Stored entity IDs and definition IDs, or an empty array for an empty bucket.

      Inspects the serialized entities in the calling pack's manifest UUID bucket without loading or spawning them.

      Throws if the item is invalid or its entity-storage format is unsupported.

      Error

      InvalidItemStackError

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

    • Parameters

      • entityId: string

        A stored entity ID in the calling pack's bucket.

      • location: DimensionLocation

        The target DimensionLocation. Must be finite, within world bounds, and in a loaded, ticking chunk.

      Returns Entity

      The spawned entity.

      Releases a stored mob at the supplied dimension and world position. Does not require a block target. The serialized position is replaced before the actor is loaded. Removes the entry from this item after spawning it.

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

      Throws for an invalid item, ID, dimension, or location, a missing entity, or a load or spawn failure. Failed releases preserve serialized storage.

      Error

      InvalidItemStackError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError

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

    • Returns number

      The number of entities in this pack's bucket, or zero if empty.

      Returns the number of serialized entities in the calling pack's manifest UUID bucket.

      Throws if the item is invalid or its entity-storage format is unsupported.

      Error

      InvalidItemStackError

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

    • Parameters

      • entity: Entity

        The live mob to store.

      Returns string

      The stored entity ID, used for inspection, release, or transfer.

      Serializes and despawns a non-player mob into the calling pack's item storage. Mounted entities and entities with passengers cannot be stored.

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

      Throws if the item or entity is invalid, storage is full, the entity is already stored, serialization fails, or the entity is not allowed. Rejected entities remain in the world.

      Error

      InvalidItemStackError

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

    • Parameters

      • entityId: string

        A stored entity ID in the calling pack's bucket.

      • targetBlock: Block

        A loaded block with an entity-storage component and available capacity.

      Returns void

      Moves serialized ownership from the calling pack's item bucket into the same bucket of a block's entity-storage without loading or spawning the entity. The target can be in any dimension and must have entity storage.

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

      Throws for an invalid item, ID, or target, a missing entity, full target storage, or an ID already stored at the target. Failure preserves both owners.

      Error

      InvalidItemStackError

      LocationInUnloadedChunkError

      LocationOutOfWorldBoundariesError

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