跳转到正文

actors API ​

完整接口目录 · 实体观察用法 · 工具包下载

模块说明 ​

text
Connection-local actor evidence, including last received position.

Positions are observations, not synchronous world queries. Require a matching
connection, scope, identity and Add revision, visible/alive state, and a recent
position.stamp.at for control. sampled_at and last_packet_at cannot refresh an
old position. Actors without Add evidence are absent; this is not world coverage.

ActorStamp ​

python
class ActorStamp(TypedDict)

字段(包含继承字段):

ActorStamp.revision ​

python
revision: int

必填;声明于 actors.ActorStamp。

ActorStamp.at ​

python
at: str

必填;声明于 actors.ActorStamp。

ActorStamp.packet_id ​

python
packet_id: int

必填;声明于 actors.ActorStamp。

ActorCursor ​

python
class ActorCursor(TypedDict)

字段(包含继承字段):

ActorCursor.connection_id ​

python
connection_id: str

必填;声明于 actors.ActorCursor。

ActorCursor.revision ​

python
revision: int

必填;声明于 actors.ActorCursor。

ActorCursor.scope_revision ​

python
scope_revision: int

必填;声明于 actors.ActorCursor。

ActorPosition ​

python
class ActorPosition(TypedDict)

字段(包含继承字段):

ActorPosition.value ​

python
value: list[float]

必填;声明于 actors.ActorPosition。

ActorPosition.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorPosition。

ActorHealth ​

python
class ActorHealth(TypedDict)

字段(包含继承字段):

ActorHealth.value ​

python
value: float

必填;声明于 actors.ActorHealth。

ActorHealth.min ​

python
min: float

必填;声明于 actors.ActorHealth。

ActorHealth.max ​

python
max: float

必填;声明于 actors.ActorHealth。

ActorHealth.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorHealth。

ActorItem ​

python
class ActorItem(TypedDict)

字段(包含继承字段):

ActorItem.count ​

python
count: int

必填;声明于 actors.ActorItem。

ActorItem.stack_id ​

python
stack_id: int

必填;声明于 actors.ActorItem。

ActorItem.network_id ​

python
network_id: int

必填;声明于 actors.ActorItem。

ActorItem.attributes_fingerprint ​

python
attributes_fingerprint: str

必填;声明于 actors.ActorItem。

ActorTypedValue ​

python
class ActorTypedValue(TypedDict)

字段(包含继承字段):

ActorTypedValue.type ​

python
type: str

必填;声明于 actors.ActorTypedValue。

ActorTypedValue.value ​

python
value: Any

必填;声明于 actors.ActorTypedValue。

ActorField ​

python
class ActorField(TypedDict)

字段(包含继承字段):

ActorField.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorField。

ActorField.known ​

python
known: bool

必填;声明于 actors.ActorField。

ActorField.error ​

python
error: str

必填;声明于 actors.ActorField。

ActorMetadata ​

python
class ActorMetadata(ActorField)

字段(包含继承字段):

ActorMetadata.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorField。

ActorMetadata.known ​

python
known: bool

必填;声明于 actors.ActorField。

ActorMetadata.error ​

python
error: str

必填;声明于 actors.ActorField。

ActorMetadata.value ​

python
value: ActorTypedValue | None

必填;声明于 actors.ActorMetadata。

ActorEffect ​

python
class ActorEffect(ActorField)

字段(包含继承字段):

ActorEffect.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorField。

ActorEffect.known ​

python
known: bool

必填;声明于 actors.ActorField。

ActorEffect.error ​

python
error: str

必填;声明于 actors.ActorField。

ActorEffect.operation ​

python
operation: int

必填;声明于 actors.ActorEffect。

ActorEffect.present ​

python
present: bool | None

必填;声明于 actors.ActorEffect。

ActorEffect.amplifier ​

python
amplifier: int | None

必填;声明于 actors.ActorEffect。

ActorEffect.particles ​

python
particles: bool | None

必填;声明于 actors.ActorEffect。

ActorEffect.duration ​

python
duration: int | None

必填;声明于 actors.ActorEffect。

ActorEffect.tick ​

python
tick: str | None

必填;声明于 actors.ActorEffect。

ActorEquipmentItem ​

python
class ActorEquipmentItem(TypedDict)

字段(包含继承字段):

ActorEquipmentItem.network_id ​

python
network_id: int

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.stack_id ​

python
stack_id: int

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.count ​

python
count: int

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.metadata_value ​

python
metadata_value: int

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.block_runtime_id ​

python
block_runtime_id: int

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.nbt ​

python
nbt: ActorTypedValue

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.can_place_on ​

python
can_place_on: list[str] | None

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.can_break ​

python
can_break: list[str] | None

必填;声明于 actors.ActorEquipmentItem。

ActorEquipmentItem.fingerprint ​

python
fingerprint: str

必填;声明于 actors.ActorEquipmentItem。

ActorEquipment ​

python
class ActorEquipment(ActorField)

字段(包含继承字段):

ActorEquipment.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorField。

ActorEquipment.known ​

python
known: bool

必填;声明于 actors.ActorField。

ActorEquipment.error ​

python
error: str

必填;声明于 actors.ActorField。

ActorEquipment.item ​

python
item: ActorEquipmentItem | None

必填;声明于 actors.ActorEquipment。

ActorEquipment.inventory_slot ​

python
inventory_slot: int

必填;声明于 actors.ActorEquipment。

ActorEquipment.hotbar_slot ​

python
hotbar_slot: int

必填;声明于 actors.ActorEquipment。

ActorEquipment.window_id ​

python
window_id: int

必填;声明于 actors.ActorEquipment。

ActorAttribute ​

python
class ActorAttribute(ActorField)

字段(包含继承字段):

ActorAttribute.stamp ​

python
stamp: ActorStamp

必填;声明于 actors.ActorField。

ActorAttribute.known ​

python
known: bool

必填;声明于 actors.ActorField。

ActorAttribute.error ​

python
error: str

必填;声明于 actors.ActorField。

ActorAttribute.value ​

python
value: float | None

必填;声明于 actors.ActorAttribute。

ActorAttribute.min ​

python
min: float | None

必填;声明于 actors.ActorAttribute。

ActorAttribute.max ​

python
max: float | None

必填;声明于 actors.ActorAttribute。

ActorAttribute.defaults ​

python
defaults: dict[str, float] | None

必填;声明于 actors.ActorAttribute。

ActorAttribute.modifiers ​

python
modifiers: list[dict[str, Any]] | None

必填;声明于 actors.ActorAttribute。

ActorState ​

python
class ActorState(TypedDict)

字段(包含继承字段):

ActorState.runtime_id ​

python
runtime_id: str

必填;声明于 actors.ActorState。

ActorState.unique_id ​

python
unique_id: str

必填;声明于 actors.ActorState。

ActorState.entity_type ​

python
entity_type: str

必填;声明于 actors.ActorState。

ActorState.spawn_position ​

python
spawn_position: list[float]

必填;声明于 actors.ActorState。

ActorState.position ​

python
position: ActorPosition | None

必填;声明于 actors.ActorState。

ActorState.position_error ​

python
position_error: str

必填;声明于 actors.ActorState。

ActorState.position_error_stamp ​

python
position_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.visible ​

python
visible: bool

必填;声明于 actors.ActorState。

ActorState.added ​

python
added: ActorStamp

必填;声明于 actors.ActorState。

ActorState.removed ​

python
removed: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.death ​

python
death: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.health ​

python
health: ActorHealth | None

必填;声明于 actors.ActorState。

ActorState.health_error ​

python
health_error: str

必填;声明于 actors.ActorState。

ActorState.health_error_stamp ​

python
health_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.item ​

python
item: ActorItem | None

必填;声明于 actors.ActorState。

ActorState.metadata ​

python
metadata: dict[str, ActorMetadata]

必填;声明于 actors.ActorState。

ActorState.effects ​

python
effects: dict[str, ActorEffect]

必填;声明于 actors.ActorState。

ActorState.equipment ​

python
equipment: dict[str, ActorEquipment]

必填;声明于 actors.ActorState。

ActorState.attributes ​

python
attributes: dict[str, ActorAttribute]

必填;声明于 actors.ActorState。

ActorState.metadata_error ​

python
metadata_error: str

必填;声明于 actors.ActorState。

ActorState.metadata_error_stamp ​

python
metadata_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.effects_error ​

python
effects_error: str

必填;声明于 actors.ActorState。

ActorState.effects_error_stamp ​

python
effects_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.equipment_error ​

python
equipment_error: str

必填;声明于 actors.ActorState。

ActorState.equipment_error_stamp ​

python
equipment_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorState.attributes_error ​

python
attributes_error: str

必填;声明于 actors.ActorState。

ActorState.attributes_error_stamp ​

python
attributes_error_stamp: ActorStamp | None

必填;声明于 actors.ActorState。

ActorEvent ​

python
class ActorEvent(TypedDict)

字段(包含继承字段):

ActorEvent.revision ​

python
revision: int

必填;声明于 actors.ActorEvent。

ActorEvent.at ​

python
at: str

必填;声明于 actors.ActorEvent。

ActorEvent.packet_id ​

python
packet_id: int

必填;声明于 actors.ActorEvent。

ActorEvent.kind ​

python
kind: str

必填;声明于 actors.ActorEvent。

ActorEvent.runtime_id ​

python
runtime_id: str

必填;声明于 actors.ActorEvent。

ActorEvent.unique_id ​

python
unique_id: str

必填;声明于 actors.ActorEvent。

ActorEvent.taker_runtime_id ​

python
taker_runtime_id: str

必填;声明于 actors.ActorEvent。

ActorEvent.known ​

python
known: bool

必填;声明于 actors.ActorEvent。

ActorEvent.event_type ​

python
event_type: int

必填;声明于 actors.ActorEvent。

ActorEvent.event_data ​

python
event_data: int

必填;声明于 actors.ActorEvent。

ActorEvent.health_error ​

python
health_error: str

必填;声明于 actors.ActorEvent。

ActorEvent.changed_fields ​

python
changed_fields: list[str]

必填;声明于 actors.ActorEvent。

ActorEvent.error ​

python
error: str

必填;声明于 actors.ActorEvent。

ActorObserved ​

python
class ActorObserved(TypedDict)

SDK 说明:

text
Payload of a durable actor.observed event; source_gap has null identity.

字段(包含继承字段):

ActorObserved.source ​

python
source: str

必填;声明于 actors.ActorObserved。

ActorObserved.connection_id ​

python
connection_id: str | None

必填;声明于 actors.ActorObserved。

ActorObserved.scope_revision ​

python
scope_revision: int | None

必填;声明于 actors.ActorObserved。

ActorObserved.revision ​

python
revision: int | None

必填;声明于 actors.ActorObserved。

ActorObserved.at ​

python
at: str | None

必填;声明于 actors.ActorObserved。

ActorObserved.packet_id ​

python
packet_id: int | None

必填;声明于 actors.ActorObserved。

ActorObserved.kind ​

python
kind: str

必填;声明于 actors.ActorObserved。

ActorObserved.runtime_id ​

python
runtime_id: str | None

必填;声明于 actors.ActorObserved。

ActorObserved.unique_id ​

python
unique_id: str | None

必填;声明于 actors.ActorObserved。

ActorObserved.taker_runtime_id ​

python
taker_runtime_id: str | None

必填;声明于 actors.ActorObserved。

ActorObserved.known ​

python
known: bool

必填;声明于 actors.ActorObserved。

ActorObserved.gap ​

python
gap: bool

必填;声明于 actors.ActorObserved。

ActorObserved.complete_world_coverage ​

python
complete_world_coverage: bool

必填;声明于 actors.ActorObserved。

ActorObserved.changed_fields ​

python
changed_fields: list[str]

必填;声明于 actors.ActorObserved。

ActorObserved.error ​

python
error: str

必填;声明于 actors.ActorObserved。

ActorObserved.event_type ​

python
event_type: int | None

必填;声明于 actors.ActorObserved。

ActorObserved.event_data ​

python
event_data: int | None

必填;声明于 actors.ActorObserved。

ActorObserved.health_error ​

python
health_error: str

必填;声明于 actors.ActorObserved。

ActorSnapshot ​

python
class ActorSnapshot(ActorCursor)

字段(包含继承字段):

ActorSnapshot.connection_id ​

python
connection_id: str

必填;声明于 actors.ActorCursor。

ActorSnapshot.revision ​

python
revision: int

必填;声明于 actors.ActorCursor。

ActorSnapshot.scope_revision ​

python
scope_revision: int

必填;声明于 actors.ActorCursor。

ActorSnapshot.source ​

python
source: str

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.connected_at ​

python
connected_at: str

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.dropped_through ​

python
dropped_through: int

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.sampled_at ​

python
sampled_at: str

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.last_packet_at ​

python
last_packet_at: str

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.gap ​

python
gap: bool

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.truncated ​

python
truncated: bool

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.complete ​

python
complete: bool

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.complete_world_coverage ​

python
complete_world_coverage: bool

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.actors ​

python
actors: list[ActorState]

必填;声明于 actors.ActorSnapshot。

ActorSnapshot.events ​

python
events: list[ActorEvent]

必填;声明于 actors.ActorSnapshot。

ActorRef ​

python
@dataclass(frozen=True)
class ActorRef

SDK 说明:

text
Identity from one Add in one connection and dimension scope.

字段(包含继承字段):

ActorRef.connection_id ​

python
connection_id: str

数据类字段;声明于 actors.ActorRef。

ActorRef.scope_revision ​

python
scope_revision: int

数据类字段;声明于 actors.ActorRef。

ActorRef.runtime_id ​

python
runtime_id: str

数据类字段;声明于 actors.ActorRef。

ActorRef.unique_id ​

python
unique_id: str

数据类字段;声明于 actors.ActorRef。

ActorRef.added_revision ​

python
added_revision: int

数据类字段;声明于 actors.ActorRef。

ActorRef.resolve ​

python
def resolve(self, snapshot: ActorSnapshot) -> ActorState | None

SDK 说明:

text
Return current evidence, or None after a gap/removal/death/reuse.

This does not refresh any field or establish world coverage/freshness.

actor_ref ​

python
def actor_ref(snapshot: ActorSnapshot, runtime_id: str) -> ActorRef

SDK 说明:

text
Bind an observed live actor without IO; unknown identities are rejected.

Actors ​

python
class Actors

Actors.__init__ ​

python
def __init__(self, operations: Operations)

Actors.observe ​

python
def observe(
    self,
    *,
    idempotency_key: str,
    deadline: str,
    after: ActorCursor | None = None,
    runtime_ids: list[str] | None = None,
) -> OperationIntent

SDK 说明:

text
Prepare framework.actor.observe; its successful result is ActorSnapshot.

Host checks framework.actor.observe permission. Up to 64 explicit runtime
IDs (decimal strings) avoid unrelated actors exhausting the result limit.
A new query needs its own key; reusing a key reads the earlier receipt.

Actors.operations ​

python
self.operations

公开实例属性,在 __init__ 中设置。

Neomega · 使用、开发与参考文档