外观
subchunk API
模块说明
text
Bounded read-only views of neomega.subchunk.v1 (NSC v1) objects.
Parsing does no I/O and does not establish transfer integrity: verify the bulk
transfer before using its bytes. Epoch, dimension and revision belong to the
separate snapshot metadata. Runtime ID zero is not implicitly air. Raw block
entity NBT remains in its declared encoding; __tag is never expanded here.MAX_OBJECT_BYTES
python
MAX_OBJECT_BYTES = 1 << 20NBTRecord
python
@dataclass(frozen=True, slots=True)
class NBTRecord字段(包含继承字段):
NBTRecord.encoding
python
encoding: str数据类字段;声明于 subchunk.NBTRecord。
NBTRecord.data
python
data: bytes数据类字段;声明于 subchunk.NBTRecord。
SubChunkView
python
@dataclass(frozen=True, slots=True)
class SubChunkView该类型另有以下内部字段,参与数据类声明但不建议直接读写;创建对象时优先使用专题中的工厂方法:
python
_data: bytes
_layers: tuple[tuple[int, int], ...]
_nbt: Mapping[int, tuple[str, int, int]]
_nbt_complete: boolSubChunkView.layer_count
python
@property
def layer_count(self) -> intSubChunkView.nbt_count
python
@property
def nbt_count(self) -> intSubChunkView.nbt_complete
python
@property
def nbt_complete(self) -> boolSDK 说明:
text
Whether absent cells are known to have no NBT in this observation.SubChunkView.block
python
def block(self, x: int, y: int, z: int, layer: int=0) -> int | NoneSubChunkView.nbt
python
def nbt(self, x: int, y: int, z: int) -> NBTRecord | NoneSDK 说明:
text
Return owned raw bytes; None alone is not proof of absence if incomplete.parse_subchunk
python
def parse_subchunk(data: bytes | bytearray | memoryview) -> SubChunkViewSDK 说明:
text
Validate a complete bounded object; malformed input raises ValueError.
Immutable bytes are retained. Other supported buffers are copied before
validation, including read-only views over mutable backing storage. Layer
palettes/indices remain packed bytes instead of per-cell Python objects.