Bedrock Energistics Core
    Preparing search index...

    Function addMachineSlotItem

    • Beta

      Adds items to a machine item slot, stacking onto whatever is already there.

      Parameters

      Returns Promise<number>

      The amount of items added. Fewer than newItemStack.amount if the slot couldn't fit them all, and 0 if nothing was added - because the slot is full, holds a different item, or doesn't meet options.

      Prefer this over reading a slot and writing it back: the whole read-modify-write happens inside Bedrock Energistics Core, so a change the player makes in between can't be overwritten.

      Throws a PublicError of type PublicErrorType.NotFound if there is no block at the given location, including when that location's chunk is not loaded.

      Throws a PublicError of type PublicErrorType.NotRegistered if the block is not registered as a machine.

      Throws a PublicError of type PublicErrorType.InvalidArgument if the element is not an item slot, if the item is not allowed in that slot, or if the item does not exist.

      Throws a PublicError of type PublicErrorType.InvalidState if this package has not been initialized (see init).