Documentation
¶
Overview ¶
Package schem is the public entry point for the S2D library. It defines the cross-cutting Schematic / Block / UnknownReport types, holds the format-handler registry, and exposes Read which dispatches to a format reader based on the filename.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Register ¶
func Register(h FormatHandler)
Register adds a FormatHandler to the dispatch table. Format-reader packages call this from their init() function.
Types ¶
type BedrockState ¶
BedrockState is a neutral Bedrock block-state identifier. It is the minecraft: identifier and state properties a consumer should preserve even if its runtime has no concrete behaviour implementation for the block. Properties may be shared between blocks that came from the same source palette entry; call Clone before mutating them.
func (BedrockState) Clone ¶
func (s BedrockState) Clone() BedrockState
Clone returns a copy of the Bedrock state and its property map.
type Block ¶
type Block struct {
Pos [3]int // x, y, z within the schematic local frame
Block world.Block // translated Bedrock block; never nil
Liquid world.Liquid // non-nil iff the Java source was waterlogged
BedrockState BedrockState // neutral Bedrock identifier/properties
PaletteIndex uint32 // source palette index when PaletteIndexOK is true
PaletteIndexOK bool // true when the source format had palette indexes
}
Block is one cell in a parsed schematic.
type BlockHandler ¶
BlockHandler receives one translated block while scanning a schematic.
type FormatHandler ¶
type FormatHandler struct {
Name Format
Extensions []string // e.g. []string{".schem"}
Signature func(headerPeek []byte) bool // optional NBT signature check
Read func(io.Reader) (*Schematic, error) // materialising reader
Scan func(io.Reader, InfoHandler, BlockHandler) (ScanInfo, error) // streaming reader
}
FormatHandler describes one supported on-disk format. Format-reader packages register their handler at init() time.
type InfoHandler ¶
InfoHandler receives schematic metadata before the first scanned block.
type ScanInfo ¶
type ScanInfo struct {
Format Format
Width, Height, Length int
Offset [3]int
PaletteSize int
Unknowns UnknownReport
}
ScanInfo is the metadata returned by Scan after visiting every block.
func Scan ¶
Scan parses a schematic from r and calls yield for each translated block without materialising the full Schematic.Blocks slice.
func ScanWithInfo ¶
func ScanWithInfo(filename string, r io.Reader, onInfo InfoHandler, yield BlockHandler) (ScanInfo, error)
ScanWithInfo parses a schematic from r, calls onInfo once after dimensions are known, then calls yield for each translated block.
type Schematic ¶
type Schematic struct {
Format Format
Width, Height, Length int
Offset [3]int
Blocks []Block
Unknowns UnknownReport
}
Schematic is the parsed result of Read.
type UnknownReport ¶
UnknownReport tallies cells whose Java state could not be translated. Counts is keyed by the canonical Java state string.