import { FileSystem } from "@xmcl/system"; import Long from "long"; export declare class WorldReader { private fs; static create(path: string | Uint8Array): Promise; constructor(fs: FileSystem); /** * Get region data frame * @param chunkX The x value of chunk coord * @param chunkZ The z value of chunk coord */ getRegionData(chunkX: number, chunkZ: number): Promise; /** * Get entity data frame * @param chunkX The x value of chunk coord * @param chunkZ The z value of chunk coord */ getEntityData(chunkX: number, chunkZ: number): Promise; /** * Get mca data frame * @param prefix The folder to load the .mca file from * @param chunkX The x value of chunk coord * @param chunkZ The z value of chunk coord */ getMCAData(prefix: string, chunkX: number, chunkZ: number): Promise; /** * Read the level data */ getLevelData(): Promise; getPlayerData(): Promise; getAdvancementsData(): Promise; } /** * The chunk index is a number in range [0, 4096), which is mapped position from (0,0,0) to (16,16,16) inside the chunk. */ export declare type ChunkIndex = number; /** * Get chunk index from position. * All x, y, z should be in range [0, 16) * * @param x The position x. Should be in range [0, 16) * @param y The position y. Should be in range [0, 16) * @param z The position z. Should be in range [0, 16) */ export declare function getIndexInChunk(x: number, y: number, z: number): ChunkIndex; /** * Get in-chunk coordination from chunk index * @param index The index number in chunk */ export declare function getCoordFromIndex(index: ChunkIndex): { x: number; y: number; z: number; }; export declare namespace RegionReader { /** * Get a chunk section in a region by chunk Y value. * @param region The region * @param chunkY The y value of the chunk. It should be from [0, 16) */ function getSection(region: RegionDataFrame, chunkY: number): RegionSectionDataFrame; /** * Walk through all the position in this chunk and emit all the id in every position. * @param section The chunk section * @param reader The callback which will receive the position + state id. */ function walkBlockStateId(section: RegionSectionDataFrame, reader: (x: number, y: number, z: number, id: number) => void): void; /** * Seek the section and get the block state id from the section. * @param section The section * @param index The chunk index */ function seekBlockStateId(section: NewRegionSectionDataFrame | LegacyRegionSectionDataFrame, index: ChunkIndex): number; /** * Seek the block state data from new region format. * @param section The new region section * @param index The chunk index, which is a number in range [0, 4096) */ function seekBlockState(section: NewRegionSectionDataFrame, index: ChunkIndex): BlockStateData; } /** * The Minecraft provided block state info. Only presented in the version >= 1.13 chunk data. */ export interface BlockStateData { Name: string; Properties: { [key: string]: string; }; } export declare enum GameType { NON = -1, SURVIVAL = 0, CREATIVE = 1, ADVENTURE = 2, SPECTATOR = 3 } export interface PlayerDataFrame { UUIDLeast: Long; UUIDMost: Long; DataVersion: number; Pos: [ number, number, number ]; Rotation: [ number, number, number ]; Motion: [ number, number, number ]; Dimension: number; SpawnX: number; SpawnY: number; SpawnZ: number; playerGameType: number; Attributes: Array<{ Base: number; Name: string; }>; HurtTime: number; DeathTime: number; HurtByTimestamp: number; SleepTimer: number; SpawnForced: number; FallDistance: number; SelectedItemSlot: number; seenCredits: number; Air: number; AbsorptionAmount: number; Invulnerable: number; FallFlying: number; PortalCooldown: number; Health: number; OnGround: number; XpLevel: number; Score: number; Sleeping: number; Fire: number; XpP: number; XpSeed: number; XpTotal: number; foodLevel: number; foodExhaustionLevel: number; foodTickTimer: number; foodSaturationLevel: number; recipeBook: { isFilteringCraftable: number; isGuiOpen: number; }; abilities: { invulnerable: number; mayfly: number; instabuild: number; walkSpeed: number; mayBuild: number; flying: number; flySpeed: number; }; } declare type StringBoolean = "true" | "false"; export interface LevelDataFrame { BorderCenterX: number; BorderCenterZ: number; BorderDamagePerBlock: number; BorderSafeZone: number; BorderSize: number; BorderSizeLerpTarget: number; BorderSizeLerpTime: Long; BorderWarningBlocks: number; BorderWarningTime: number; DataVersion: number; DayTime: Long; Difficulty: number; DifficultyLocked: number; DimensionData: { [dimension: number]: { DragonFight: { Gateways: number[]; DragonKilled: number; PreviouslyKilled: number; ExitPortalLocation?: [number, number, number]; }; }; }; GameRules: { doTileDrops: StringBoolean; doFireTick: StringBoolean; gameLoopFunction: string; maxCommandChainLength: string; reducedDebugInfo: string; naturalRegeneration: string; disableElytraMovementCheck: string; doMobLoot: StringBoolean; announceAdvancements: string; keepInventory: StringBoolean; doEntityDrops: StringBoolean; doLimitedCrafting: StringBoolean; mobGriefing: StringBoolean; randomTickSpeed: string; commandBlockOutput: string; spawnRadius: string; doMobSpawning: StringBoolean; maxEntityCramming: string; logAdminCommands: string; spectatorsGenerateChunks: string; doWeatherCycle: StringBoolean; sendCommandFeedback: string; doDaylightCycle: StringBoolean; showDeathMessages: StringBoolean; }; GameType: GameType; LastPlayed: Long; LevelName: string; MapFeatures: number; Player: PlayerDataFrame; RandomSeed: Long; readonly SizeOnDisk: Long; SpawnX: number; SpawnY: number; SpawnZ: number; Time: Long; Version: { Snapshot: number; Id: number; Name: string; }; allowCommands: number; clearWeatherTime: number; generatorName: "default" | "flat" | "largeBiomes" | "amplified" | "buffet" | "debug_all_block_states" | string; generatorOptions: string; generatorVersion: number; hardcore: number; initialized: number; rainTime: number; raining: number; thunderTime: number; thundering: number; version: number; } export interface AdvancementDataFrame { display?: { background?: string; description: object | string; show_toast: boolean; announce_to_chat: boolean; hidden: boolean; }; parent?: string; criteria: { [name: string]: { trigger: string; conditions: {}; }; }; requirements: string[]; rewards: { recipes: string[]; loot: string[]; experience: number; function: string; }; } export interface ItemStackDataFrame { Slot: number; id: string; Count: number; Damage: number; tag?: { Unbreakable: number; CanDestroy: string[]; CanPlaceOn: string[]; BlockEntityTag: {}; ench: Array<{ id: number; lvl: number; }>; StoredEnchantments: Array<{ id: number; lvl: number; }>; RepairCost: number; AttributeModifiers: Array<{ AttributeName: string; Name: string; Slot: string; Operation: number; Amount: number; UUIDMost: Long; UUIDLeast: Long; }>; CustomPotionEffects: Array<{ Id: number; Amplifier: number; Duration: number; Ambient: number; ShowParticles: number; }>; Potion: string; CustomPotionColor: number; display: Array<{ color: number; Name: string; LocName: string; Lore: string[]; }>; HideFlags: number; resolved: number; /** * The copy tier of the book. 0 = original, number = copy of original, number = copy of copy, number = tattered. * If the value is greater than number, the book cannot be copied. Does not exist for original books. * If this tag is missing, it is assumed the book is an original. 'Tattered' is unused in normal gameplay, and functions identically to the 'copy of copy' tier. */ generation: number; author: string; title: string; /** * A single page in the book. If generated by writing in a book and quill in-game, each page is a string in double quotes and uses the escape sequences \" for a double quote, * for a line break and \\ for a backslash. If created by commands or external tools, a page can be a serialized JSON object or an array of strings and/or objects (see Commands#Raw JSON text) or an unescaped string. */ pages: string[]; }; } export interface TileEntityDataFrame { x: number; y: number; z: number; Items: ItemStackDataFrame[]; id: string; [key: string]: any; } export declare type LegacyRegionSectionDataFrame = { Blocks: Array; Data: Array; Add: Array; BlockLight: number[]; SkyLight: number[]; Y: number; }; export declare type NewRegionSectionDataFrame = { BlockStates: Long[]; Palette: Array; Data: number[]; BlockLight: number[]; SkyLight: number[]; Y: number; }; export declare type RegionSectionDataFrame = LegacyRegionSectionDataFrame | NewRegionSectionDataFrame; export interface RegionDataFrame { Level: { xPos: number; zPos: number; LightPopulated: number; LastUpdate: Long; InhabitedTime: Long; HeightMap: number[]; Biomes: number[]; Entities: object[]; TileEntities: TileEntityDataFrame[]; Sections: RegionSectionDataFrame[]; }; DataVersion: number; ForgeDataVersion?: number; } export {}; //# sourceMappingURL=index.d.ts.map