外观
protocol.runtime API
模块说明
text
Schema-driven author values; the Go host owns all wire serialization.T
python
T = TypeVar('T')OptionalValue
python
@dataclass
class OptionalValue(Generic[T])字段(包含继承字段):
OptionalValue.present
python
present: bool = False数据类字段;声明于 protocol.runtime.OptionalValue。
OptionalValue.value
python
value: T | None = None数据类字段;声明于 protocol.runtime.OptionalValue。
OptionalValue.some
python
@classmethod
def some(cls, value: T) -> OptionalValue[T]另继承外部类型 Generic[T];其通用方法不在本 SDK 目录中重复展开。
PointerValue
python
@dataclass
class PointerValue(Generic[T])SDK 说明:
text
An explicit nonnil pointer, including a pointer to a nil value.字段(包含继承字段):
PointerValue.value
python
value: T数据类字段;声明于 protocol.runtime.PointerValue。
另继承外部类型 Generic[T];其通用方法不在本 SDK 目录中重复展开。
UnionValue
python
@dataclass
class UnionValue字段(包含继承字段):
UnionValue.type_id
python
type_id: str数据类字段;声明于 protocol.runtime.UnionValue。
UnionValue.value
python
value: Any数据类字段;声明于 protocol.runtime.UnionValue。
DynamicValue
python
@dataclass(frozen=True)
class DynamicValueSDK 说明:
text
An explicitly typed NBT/MessagePack/interface value.字段(包含继承字段):
DynamicValue.type_id
python
type_id: str数据类字段;声明于 protocol.runtime.DynamicValue。
DynamicValue.value
python
value: Any数据类字段;声明于 protocol.runtime.DynamicValue。
StringBytes
python
@dataclass(frozen=True)
class StringBytesSDK 说明:
text
A Go string containing bytes that are not valid UTF-8.字段(包含继承字段):
StringBytes.value
python
value: bytes数据类字段;声明于 protocol.runtime.StringBytes。
Timestamp
python
@dataclass(frozen=True)
class TimestampSDK 说明:
text
Exact MessagePack time value and its current named UTC offset.字段(包含继承字段):
Timestamp.seconds
python
seconds: int数据类字段;声明于 protocol.runtime.Timestamp。
Timestamp.nanoseconds
python
nanoseconds: int = 0数据类字段;声明于 protocol.runtime.Timestamp。
Timestamp.offset_seconds
python
offset_seconds: int = 0数据类字段;声明于 protocol.runtime.Timestamp。
Timestamp.zone
python
zone: str = 'UTC'数据类字段;声明于 protocol.runtime.Timestamp。
FloatBits
python
@dataclass(frozen=True)
class FloatBitsSDK 说明:
text
IEEE bits retained without Python float NaN payload conversion.字段(包含继承字段):
FloatBits.bits
python
bits: int数据类字段;声明于 protocol.runtime.FloatBits。
FloatBits.width
python
width: int数据类字段;声明于 protocol.runtime.FloatBits。
python_type_names
python
def python_type_names(schema)SDK 说明:
text
Stable names shared by runtime class creation and static stub generation.Struct
python
class StructSDK 说明:
text
Mutable model with schema-checked construction and assignment.
Field names match the Core Go model exactly. Nested containers are checked
again at serialization, so mutations inside a list or map cannot bypass the
contract. Constructor defaults describe Go zero values, not valid gameplay.Struct.__init__
python
def __init__(self, **fields)Struct.copy
python
def copy(self, **changes)Struct.to_value
python
def to_value(self)Packet
python
class Packet(Struct)Packet.packet_id
python
packet_id: ClassVar[int]Packet.packet_name
python
packet_name: ClassVar[str]Packet.to_envelope
python
def to_envelope(self)Packet.__init__
python
def __init__(self, **fields)继承自 protocol.runtime.Struct.__init__。
Packet.copy
python
def copy(self, **changes)继承自 protocol.runtime.Struct.copy。
Packet.to_value
python
def to_value(self)继承自 protocol.runtime.Struct.to_value。
TypeDescriptors
python
class TypeDescriptors(dict)SDK 说明:
text
Resolve dynamic container types used inside NBT/MessagePack interfaces.TypeDescriptors.__init__
python
def __init__(self, descriptors)TypeDescriptors.__contains__
python
def __contains__(self, ref)另继承外部类型 dict;其通用方法不在本 SDK 目录中重复展开。
Registry
python
class RegistryRegistry.__init__
python
def __init__(self, schema)Registry.default
python
def default(self, ref)Registry.is_bytes
python
def is_bytes(self, descriptor)Registry.comparable
python
def comparable(self, ref)Registry.comparable_value
python
def comparable_value(self, ref, value)Registry.validate
python
def validate(self, ref, value, path='value', depth=0)Registry.schema
python
self.schema公开实例属性,在 __init__ 中设置。
Registry.types
python
self.types公开实例属性,在 __init__ 中设置。
Registry.classes
python
self.classes公开实例属性,在 __init__ 中设置。
Registry.packets
python
self.packets公开实例属性,在 __init__ 中设置。