外观
containers API
模块说明
text
Bounded container intent builders over existing Host operations.
All methods prepare without IO. The Host validates arguments, authorization,
current dimension, screen lifecycle and native item references when submitted.
No helper chooses slots, infers empty items, changes keys, submits or retries.ContainerKind
python
ContainerKind = Literal['chest', 'ender_chest', 'double_chest', 'barrel', 'shulker_box']TransferDirection
python
TransferDirection = Literal['deposit', 'withdraw']Containers
python
class ContainersContainers.__init__
python
def __init__(self, operations: Operations)Containers.inspect
python
def inspect(
self,
pos,
*,
dimension: int,
kind: ContainerKind = 'chest',
idempotency_key: str,
deadline: str,
) -> OperationIntentSDK 说明:
text
Prepare an active open/read/close, requiring world-write admission.
Retain the connection/time/slot evidence. This is not a passive cache
query; a failed close can return unknown and retain a recovery fence.Containers.transfer
python
def transfer(
self,
pos,
*,
dimension: int,
direction: TransferDirection,
inventory_slot: int,
container_slot: int,
count: int,
expected_source_stack_id: int,
expected_destination_stack_id: int,
expected_source_fingerprint: str,
idempotency_key: str,
deadline: str,
kind: ContainerKind = 'chest',
) -> OperationIntentSDK 说明:
text
Prepare one move to an explicitly observed empty destination (ID 0).
Source references must come from retained observations. A successful
server ACK still needs independent inventory/container readback.Containers.merge
python
def merge(
self,
pos,
*,
dimension: int,
direction: TransferDirection,
inventory_slot: int,
container_slot: int,
count: int,
expected_source_stack_id: int,
expected_destination_stack_id: int,
expected_source_fingerprint: str,
expected_destination_fingerprint: str,
expected_source_count: int,
expected_destination_count: int,
destination_count_limit: int,
idempotency_key: str,
deadline: str,
kind: ContainerKind = 'chest',
) -> OperationIntentSDK 说明:
text
Prepare one move into a compatible nonempty stack with exact references.
destination_count_limit is the caller's retained recovery bound, not a
guessed native stack limit. No automatic transfer/merge fallback occurs.Containers.batch
python
async def batch(self, intents, *, journal, timeout: float=30) -> dictSDK 说明:
text
Execute 1..32 prepared transfers/merges once with partial receipts.
Stops on failed/unknown; no retries, rollback or inferred next references.
Persist once admission before calling. journal must be durable and async.Containers.operations
python
self.operations公开实例属性,在 __init__ 中设置。