Skip to content

Namespace RegionReader

🏭 Functions

getSection

ts
getSection(region: RegionDataFrame, chunkY: number): RegionSectionDataFrame

Get a chunk section in a region by chunk Y value.

Parameters

  • region: RegionDataFrame The region
  • chunkY: number The y value of the chunk. It should be from [0, 16)

Return Type

  • RegionSectionDataFrame

Defined in: packages/game-data/level.ts:231

getSectionBlockIdArray

ts
getSectionBlockIdArray(section: NewRegionSectionDataFrame): number[]

Create an array of block ids from the chunk section given

Parameters

  • section: NewRegionSectionDataFrame The chunk section

Return Type

  • number[]

Defined in: packages/game-data/level.ts:272

getSectionInformation

ts
getSectionInformation(section: NewRegionSectionDataFrame): Object

Returns the palette, blockStates and bitLength for a section

Parameters

  • section: NewRegionSectionDataFrame The chunk section

Return Type

  • Object

Defined in: packages/game-data/level.ts:240

seekBlockState

ts
seekBlockState(section: NewRegionSectionDataFrame, index: number): BlockStateData

Seek the block state data from new region format.

Parameters

  • section: NewRegionSectionDataFrame The new region section
  • index: number The chunk index, which is a number in range [0, 4096)

Return Type

  • BlockStateData

Defined in: packages/game-data/level.ts:334

seekBlockStateId

ts
seekBlockStateId(section: LegacyRegionSectionDataFrame | NewRegionSectionDataFrame, index: number): number

Seek the section and get the block state id from the section.

Parameters

  • section: LegacyRegionSectionDataFrame | NewRegionSectionDataFrame The section
  • index: number The chunk index

Return Type

  • number

Defined in: packages/game-data/level.ts:313

walkBlockStateId

ts
walkBlockStateId(section: RegionSectionDataFrame, reader: Function): void

Walk through all the position in this chunk and emit all the id in every position.

Parameters

  • section: RegionSectionDataFrame The chunk section
  • reader: Function The callback which will receive the position + state id.

Return Type

  • void

Defined in: packages/game-data/level.ts:288

Released under the MIT License.