mcbe-leveldb 1.9.1-jsonly → 1.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Changelog.md +52 -1
- package/DBUtils.ts +184 -0
- package/LevelUtils.d.ts +240 -21
- package/LevelUtils.js +634 -56
- package/LevelUtils.js.map +1 -1
- package/LevelUtils.ts +3602 -0
- package/SNBTUtils.ts +2146 -0
- package/__biome_data__.ts +282 -0
- package/index.ts +14 -0
- package/nbtSchemas.d.ts +15712 -10967
- package/nbtSchemas.js +5194 -1982
- package/nbtSchemas.js.map +1 -1
- package/nbtSchemas.ts +25611 -0
- package/package.json +9 -2
- package/types.d.ts +124 -116
- package/utils/JSONB.ts +566 -0
package/Changelog.md
CHANGED
|
@@ -1,3 +1,54 @@
|
|
|
1
|
+
# v1.10.0
|
|
2
|
+
|
|
3
|
+
## Breaking Changes
|
|
4
|
+
|
|
5
|
+
- The `Dimension` content type and corresponding NBT schema have been split up into three new content types and NBT schemas:
|
|
6
|
+
- `Overworld`
|
|
7
|
+
- `Nether`
|
|
8
|
+
- `TheEnd`
|
|
9
|
+
- The `LegacyDimension` content type has been split up into three new content types:
|
|
10
|
+
- `LegacyOverworld`
|
|
11
|
+
- `LegacyNether`
|
|
12
|
+
- `LegacyTheEnd`
|
|
13
|
+
- All NBT schemas have been updated to have descriptions specified on the `markdownDescription` property instead of the `description` property.
|
|
14
|
+
- All NBT schemas have been updated to have enum descriptions specified on the `markdownEnumDescriptions` property instead of the `enumDescriptions` property.
|
|
15
|
+
|
|
16
|
+
## Additions
|
|
17
|
+
|
|
18
|
+
- Added a custom serializer and parser for the `LegacyTerrain` content type.
|
|
19
|
+
- Added the `LegacyTerrain` NBT schema.
|
|
20
|
+
- Added a custom serializer and parser for the `Data2D` content type.
|
|
21
|
+
- Added the `Data2D` NBT schema.
|
|
22
|
+
- Added a custom serializer and parser for the `Data2DLegacy` content type.
|
|
23
|
+
- Added the `Data2DLegacy` NBT schema.
|
|
24
|
+
- Added support for `SubChunkPrefix` versions `0x00`, `0x01`, `0x02`, `0x03`, `0x04`, `0x05`, `0x06`, and `0x07`.
|
|
25
|
+
- Split the `SubChunkPrefix` NBT schema into three versioned schemas, the `SubChunkPrefix` NBT schema now is a union of the three versioned schemas:
|
|
26
|
+
- `SubChunkPrefix_v0` (versions 0, 2, 3, 4, 5, 6, and 7)
|
|
27
|
+
- `SubChunkPrefix_v1` (version 1)
|
|
28
|
+
- `SubChunkPrefix_v8` (versions 8 and 9, the same as the previous `SubChunkPrefix` NBT schema)
|
|
29
|
+
- Added the `LegacyOverworld` NBT schema.
|
|
30
|
+
- Added the `LegacyNether` NBT schema.
|
|
31
|
+
- Added the `LegacyTheEnd` NBT schema.
|
|
32
|
+
- Added the `PositionTrackingLastId` NBT schema.
|
|
33
|
+
- Added the `PositionTrackingDB` NBT schema.
|
|
34
|
+
- Added examples for the `InventoryVersion` property of the `LevelDat` NBT schema.
|
|
35
|
+
- Added the `DBEntryContentTypesGrouping` constant.
|
|
36
|
+
- Added the `DBEntryContentTypeGroup` type.
|
|
37
|
+
- Added the `tileID` property to the `PendingTicks` NBT schema.
|
|
38
|
+
- Added default values for the following content types:
|
|
39
|
+
- `PendingTicks`
|
|
40
|
+
- `RandomTicks`
|
|
41
|
+
- Added an enum to the `storageVersion` property of the `SubChunkPrefixLayer` NBT schema.
|
|
42
|
+
- Added min and max item count values to several properties of various NBT schemas.
|
|
43
|
+
- Added the `package.json` file to the `package.json` file's `exports` field.
|
|
44
|
+
|
|
45
|
+
## Fixes
|
|
46
|
+
|
|
47
|
+
- The `currentTick` property of the `PendingTicks` NBT schema is now marked as optional as in older versions it doesn't exist.
|
|
48
|
+
- The `time`, `x`, `y`, and `z` properties of the `PendingTicks` and `RandomTicks` NBT schemas are now marked as required.
|
|
49
|
+
- The `blockState` property of the `RandomTicks` NBT schema is now marked as required.
|
|
50
|
+
- Fixed over 100 markdown links in the NBT schemas that were missing a `https://minecraft.wiki/w/` prefix.
|
|
51
|
+
|
|
1
52
|
# v1.9.1
|
|
2
53
|
|
|
3
54
|
## Critical Fixes
|
|
@@ -22,7 +73,7 @@
|
|
|
22
73
|
|
|
23
74
|
## Fixes
|
|
24
75
|
|
|
25
|
-
- `prettyPrintSNBT` no longer inserts newlines when the `indent` option is set to `0`.
|
|
76
|
+
- `prettyPrintSNBT` no longer inserts newlines when the `indent` option is set to `0`.
|
|
26
77
|
|
|
27
78
|
# v1.8.0
|
|
28
79
|
|
package/DBUtils.ts
ADDED
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
import type { LevelDB } from "@8crafter/leveldb-zlib";
|
|
2
|
+
import { getContentTypeFromDBKey, type DBEntryContentType } from "./LevelUtils.ts";
|
|
3
|
+
import NBT from "prismarine-nbt";
|
|
4
|
+
import { JSONB } from "./utils/JSONB.ts";
|
|
5
|
+
|
|
6
|
+
// TO-DO: Make an abstract class version of the LevelDB class to use as the type of the db parameter.
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Gets the keys from the LevelDB with a specific content type.
|
|
10
|
+
*
|
|
11
|
+
* @template T The content type to look for.
|
|
12
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
13
|
+
* @param type The {@link DBEntryContentType | content type} to look for.
|
|
14
|
+
* @returns The keys from the LevelDB with the specified content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
15
|
+
*/
|
|
16
|
+
export async function getKeysOfType<T extends DBEntryContentType>(db: LevelDB, type: T): Promise<Buffer<ArrayBuffer>[]>;
|
|
17
|
+
/**
|
|
18
|
+
* Gets the keys from the list of LevelDB keys with a specific content type.
|
|
19
|
+
*
|
|
20
|
+
* @template T The content type to look for.
|
|
21
|
+
* @template TArrayBuffer The type of the buffers.
|
|
22
|
+
* @param dbKeys The LevelDB keys. Should be an array of Buffers.
|
|
23
|
+
* @param type The {@link DBEntryContentType | content type} to look for.
|
|
24
|
+
* @returns The keys from the provided LevelDB keys array with the specified content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
25
|
+
*/
|
|
26
|
+
export function getKeysOfType<T extends DBEntryContentType, TArrayBuffer extends ArrayBufferLike = ArrayBufferLike>(
|
|
27
|
+
dbKeys: Buffer<TArrayBuffer>[],
|
|
28
|
+
type: T
|
|
29
|
+
): Buffer<TArrayBuffer>[];
|
|
30
|
+
export function getKeysOfType<T extends DBEntryContentType>(dbOrDBKeys: LevelDB | Buffer[], type: T): Promise<Buffer<ArrayBuffer>[]> | Buffer[] {
|
|
31
|
+
if (Array.isArray(dbOrDBKeys)) return dbOrDBKeys.filter((key: Buffer): boolean => getContentTypeFromDBKey(key) === type);
|
|
32
|
+
return new Promise(
|
|
33
|
+
(resolve: (value: Buffer<ArrayBuffer>[]) => void): void =>
|
|
34
|
+
void (async (): Promise<void> => {
|
|
35
|
+
const foundKeys: Buffer<ArrayBuffer>[] = [];
|
|
36
|
+
for await (const [rawKey, _value] of dbOrDBKeys.getIterator({ keys: true, keyAsBuffer: true, values: false })) {
|
|
37
|
+
if (getContentTypeFromDBKey(rawKey) === type) foundKeys.push(rawKey);
|
|
38
|
+
}
|
|
39
|
+
resolve(foundKeys);
|
|
40
|
+
})()
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Gets the keys from the LevelDB with one of the specified content types.
|
|
46
|
+
*
|
|
47
|
+
* @template T The content types to look for.
|
|
48
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
49
|
+
* @param types The {@link DBEntryContentType | content types} to look for.
|
|
50
|
+
* @returns An object mapping each of the specified content types to the keys from the LevelDB with that content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
51
|
+
*/
|
|
52
|
+
export async function getKeysOfTypes<T extends DBEntryContentType[] | readonly DBEntryContentType[]>(
|
|
53
|
+
db: LevelDB,
|
|
54
|
+
types: T
|
|
55
|
+
): Promise<{ [key in T[number]]: Buffer<ArrayBuffer>[] }>;
|
|
56
|
+
/**
|
|
57
|
+
* Gets the keys from the list of LevelDB keys with one of the specified content types.
|
|
58
|
+
*
|
|
59
|
+
* @template T The content types to look for.
|
|
60
|
+
* @template TArrayBuffer The type of the buffers.
|
|
61
|
+
* @param dbKeys The LevelDB keys. Should be an array of Buffers.
|
|
62
|
+
* @param types The {@link DBEntryContentType | content types} to look for.
|
|
63
|
+
* @returns An object mapping each of the specified content types to the keys from the provided LevelDB keys array with that content type, the keys are in Buffer format, this is because some keys contain binary data like chunk indices.
|
|
64
|
+
*/
|
|
65
|
+
export function getKeysOfTypes<T extends DBEntryContentType[] | readonly DBEntryContentType[], TArrayBuffer extends ArrayBufferLike>(
|
|
66
|
+
dbKeys: Buffer<TArrayBuffer>[],
|
|
67
|
+
types: T
|
|
68
|
+
): { [key in T[number]]: Buffer<TArrayBuffer>[] };
|
|
69
|
+
export function getKeysOfTypes<T extends DBEntryContentType[] | readonly DBEntryContentType[]>(
|
|
70
|
+
dbOrDBKeys: LevelDB | Buffer[],
|
|
71
|
+
types: T
|
|
72
|
+
): Promise<{ [key in T[number]]: Buffer<ArrayBuffer>[] }> | { [key in T[number]]: Buffer[] } {
|
|
73
|
+
const results = {} as { [key in T[number]]: Buffer<any>[] };
|
|
74
|
+
types.forEach((contentType: T[number]): void => {
|
|
75
|
+
results[contentType] = [];
|
|
76
|
+
});
|
|
77
|
+
if (Array.isArray(dbOrDBKeys)) {
|
|
78
|
+
for (const key of dbOrDBKeys) {
|
|
79
|
+
const contentType: DBEntryContentType = getContentTypeFromDBKey(key);
|
|
80
|
+
if (types.includes(contentType)) results[contentType as T[number]].push(key);
|
|
81
|
+
}
|
|
82
|
+
return results;
|
|
83
|
+
}
|
|
84
|
+
return new Promise(
|
|
85
|
+
(resolve: (value: { [key in T[number]]: Buffer<ArrayBuffer>[] }) => void): void =>
|
|
86
|
+
void (async (): Promise<void> => {
|
|
87
|
+
for await (const [rawKey, _value] of dbOrDBKeys.getIterator({ keys: true, keyAsBuffer: true, values: false })) {
|
|
88
|
+
const contentType: DBEntryContentType = getContentTypeFromDBKey(rawKey);
|
|
89
|
+
if (types.includes(contentType)) results[contentType as T[number]].push(rawKey);
|
|
90
|
+
}
|
|
91
|
+
resolve(results);
|
|
92
|
+
})()
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Gets a player's name from their UUID.
|
|
98
|
+
*
|
|
99
|
+
* Only works if the player's name was stored in an add-on's dynamic properties with their ID linked to it, and it only works for a hardcoded list of add-ons,
|
|
100
|
+
* if you have your own add-on that you would like this to be able to read the player's names from, {@link https://www.8crafter.com/main/contact | contact 8Crafter},
|
|
101
|
+
* or make a pull request.
|
|
102
|
+
*
|
|
103
|
+
* @param db The LevelDB. Should match the type of the {@link LevelDB} class from the {@link https://www.npmjs.com/package/@8crafter/leveldb-zlib | @8crafter/leveldb-zlib} package. It does not have to be the one from that package, as long as the types match.
|
|
104
|
+
* @param uuid The UUID of the play to get the name of.
|
|
105
|
+
* @returns The name of the player, or `null` if the player's name cannot be found or the world has no dynamic properties.
|
|
106
|
+
*
|
|
107
|
+
* @throws {any} If there was an error reading the DynamicProperties from the DB.
|
|
108
|
+
*/
|
|
109
|
+
export async function getPlayerNameFromUUID(db: LevelDB, uuid: string | bigint): Promise<string | null> {
|
|
110
|
+
const dynamicProperties: NBT.NBT | null = await db
|
|
111
|
+
.get("DynamicProperties")
|
|
112
|
+
.then((data: Buffer | null): Promise<NBT.NBT> | null =>
|
|
113
|
+
data ? NBT.parse(data!).then((data: { parsed: NBT.NBT; type: NBT.NBTFormat; metadata: NBT.Metadata }): NBT.NBT => data.parsed) : null
|
|
114
|
+
);
|
|
115
|
+
if (!dynamicProperties) return null;
|
|
116
|
+
return getPlayerNameFromUUIDSync(dynamicProperties, uuid);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* Gets a player's name from their UUID using the provided dynamic properties data.
|
|
121
|
+
*
|
|
122
|
+
* Only works if the player's name was stored in an add-on's dynamic properties with their ID linked to it, and it only works for a hardcoded list of add-ons,
|
|
123
|
+
* if you have your own add-on that you would like this to be able to read the player's names from, {@link https://www.8crafter.com/main/contact | contact 8Crafter},
|
|
124
|
+
* or make a pull request.
|
|
125
|
+
*
|
|
126
|
+
* @param dynamicProperties The dynamic properties data, should be the data from the `DynamicProperties` LevelDB key.
|
|
127
|
+
* @param uuid The UUID of the play to get the name of.
|
|
128
|
+
* @returns The name of the player, or `null` if the player's name cannot be found .
|
|
129
|
+
*/
|
|
130
|
+
export function getPlayerNameFromUUIDSync(dynamicProperties: NBT.NBT, uuid: string | bigint): string | null {
|
|
131
|
+
const UUIDString: string = uuid.toString();
|
|
132
|
+
for (const parser of playerUUIDToNameDynamicPropertyParsers) {
|
|
133
|
+
const name: string | null = parser(dynamicProperties, UUIDString);
|
|
134
|
+
if (name !== null) return name;
|
|
135
|
+
}
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
/**
|
|
140
|
+
* A function that can be used to get a player's name from their UUID from the dynamic properties.
|
|
141
|
+
*/
|
|
142
|
+
interface PlayerUUIDToNameDynamicPropertyParser {
|
|
143
|
+
/**
|
|
144
|
+
* A function that can be used to get a player's name from their UUID from the dynamic properties.
|
|
145
|
+
*
|
|
146
|
+
* @param dynamicProperties The dynamic properties data, should be the data from the `DynamicProperties` LevelDB key.
|
|
147
|
+
* @param uuid The UUID of the player to get the name of.
|
|
148
|
+
* @returns The name of the player, or `null` if the player's name cannot be found.
|
|
149
|
+
*/
|
|
150
|
+
(dynamicProperties: NBT.NBT, uuid: string): string | null;
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/**
|
|
154
|
+
* The list of functions that can be used to get a player's name from their UUID from the dynamic properties.
|
|
155
|
+
*
|
|
156
|
+
* These will be called in order until one of them returns a non-null value.
|
|
157
|
+
*/
|
|
158
|
+
const playerUUIDToNameDynamicPropertyParsers: PlayerUUIDToNameDynamicPropertyParser[] = [
|
|
159
|
+
function parse8CraftersServerUtilities(dynamicProperties: NBT.NBT, uuid: string): string | null {
|
|
160
|
+
const addOnUUIDs: string[] = [
|
|
161
|
+
// Internal development version
|
|
162
|
+
"53170125-3e79-4659-9bba-e49eb90b6ded",
|
|
163
|
+
// Release version
|
|
164
|
+
"53170125-3e79-4659-9bba-e49eb90b6dea",
|
|
165
|
+
];
|
|
166
|
+
for (const addOnUUID of addOnUUIDs) {
|
|
167
|
+
const addonDynamicProperties: NBT.Compound["value"] | null =
|
|
168
|
+
dynamicProperties.value[addOnUUID]?.type === "compound" ? dynamicProperties.value[addOnUUID].value : null;
|
|
169
|
+
if (!addonDynamicProperties) continue;
|
|
170
|
+
for (const key in addonDynamicProperties) {
|
|
171
|
+
if (key !== `player:${uuid}`) continue;
|
|
172
|
+
const dynamicPropertyValue: NBT.Byte | NBT.Double | NBT.String | NBT.List<NBT.TagType.Float> = addonDynamicProperties[key]! as any;
|
|
173
|
+
if (dynamicPropertyValue.type !== "string") continue;
|
|
174
|
+
try {
|
|
175
|
+
const data: any = JSONB.parse(dynamicPropertyValue.value);
|
|
176
|
+
if (typeof data === "object" && data !== null && typeof data.name === "string") return data.name;
|
|
177
|
+
} catch (e) {
|
|
178
|
+
continue;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
return null;
|
|
183
|
+
},
|
|
184
|
+
];
|
package/LevelUtils.d.ts
CHANGED
|
@@ -43,7 +43,77 @@ export declare const gameModes: readonly ["survival", "creative", "adventure", u
|
|
|
43
43
|
/**
|
|
44
44
|
* The content types for LevelDB entries.
|
|
45
45
|
*/
|
|
46
|
-
export declare const DBEntryContentTypes: readonly ["Data3D", "Version", "Data2D", "Data2DLegacy", "SubChunkPrefix", "LegacyTerrain", "BlockEntity", "Entity", "PendingTicks", "LegacyBlockExtraData", "BiomeState", "FinalizedState", "ConversionData", "BorderBlocks", "HardcodedSpawners", "RandomTicks", "Checksums", "GenerationSeed", "GeneratedPreCavesAndCliffsBlending", "BlendingBiomeHeight", "MetaDataHash", "BlendingData", "ActorDigestVersion", "LegacyVersion", "AABBVolumes", "VillageDwellers", "VillageInfo", "VillagePOI", "VillagePlayers", "VillageRaid", "Player", "PlayerClient", "ActorPrefix", "ChunkLoadedRequest", "Digest", "Map", "Portals", "SchedulerWT", "StructureTemplate", "TickingArea", "FlatWorldLayers", "
|
|
46
|
+
export declare const DBEntryContentTypes: readonly ["Data3D", "Version", "Data2D", "Data2DLegacy", "SubChunkPrefix", "LegacyTerrain", "BlockEntity", "Entity", "PendingTicks", "LegacyBlockExtraData", "BiomeState", "FinalizedState", "ConversionData", "BorderBlocks", "HardcodedSpawners", "RandomTicks", "Checksums", "GenerationSeed", "GeneratedPreCavesAndCliffsBlending", "BlendingBiomeHeight", "MetaDataHash", "BlendingData", "ActorDigestVersion", "LegacyVersion", "AABBVolumes", "VillageDwellers", "VillageInfo", "VillagePOI", "VillagePlayers", "VillageRaid", "Player", "PlayerClient", "ActorPrefix", "ChunkLoadedRequest", "Digest", "Map", "Portals", "SchedulerWT", "StructureTemplate", "TickingArea", "FlatWorldLayers", "LegacyOverworld", "LegacyNether", "LegacyTheEnd", "MVillages", "Villages", "LevelSpawnWasFixed", "PositionTrackingDB", "PositionTrackingLastId", "Scoreboard", "Overworld", "Nether", "TheEnd", "AutonomousEntities", "BiomeData", "BiomeIdsTable", "MobEvents", "DynamicProperties", "LevelChunkMetaDataDictionary", "RealmsStoriesData", "LevelDat", "ForcedWorldCorruption", "Unknown"];
|
|
47
|
+
/**
|
|
48
|
+
* Maps content types to grouping labels.
|
|
49
|
+
*
|
|
50
|
+
* Most content types are not grouped, only a few are.
|
|
51
|
+
*/
|
|
52
|
+
export declare const DBEntryContentTypesGrouping: {
|
|
53
|
+
readonly Data3D: "Data3D";
|
|
54
|
+
readonly Version: "Version";
|
|
55
|
+
readonly Data2D: "Data2D";
|
|
56
|
+
readonly Data2DLegacy: "Data2DLegacy";
|
|
57
|
+
readonly SubChunkPrefix: "SubChunkPrefix";
|
|
58
|
+
readonly LegacyTerrain: "LegacyTerrain";
|
|
59
|
+
readonly BlockEntity: "BlockEntity";
|
|
60
|
+
readonly Entity: "Entity";
|
|
61
|
+
readonly PendingTicks: "PendingTicks";
|
|
62
|
+
readonly LegacyBlockExtraData: "LegacyBlockExtraData";
|
|
63
|
+
readonly BiomeState: "BiomeState";
|
|
64
|
+
readonly FinalizedState: "FinalizedState";
|
|
65
|
+
readonly ConversionData: "ConversionData";
|
|
66
|
+
readonly BorderBlocks: "BorderBlocks";
|
|
67
|
+
readonly HardcodedSpawners: "HardcodedSpawners";
|
|
68
|
+
readonly RandomTicks: "RandomTicks";
|
|
69
|
+
readonly Checksums: "Checksums";
|
|
70
|
+
readonly GenerationSeed: "GenerationSeed";
|
|
71
|
+
readonly GeneratedPreCavesAndCliffsBlending: "GeneratedPreCavesAndCliffsBlending";
|
|
72
|
+
readonly BlendingBiomeHeight: "BlendingBiomeHeight";
|
|
73
|
+
readonly MetaDataHash: "MetaDataHash";
|
|
74
|
+
readonly BlendingData: "BlendingData";
|
|
75
|
+
readonly ActorDigestVersion: "ActorDigestVersion";
|
|
76
|
+
readonly LegacyVersion: "LegacyVersion";
|
|
77
|
+
readonly AABBVolumes: "AABBVolumes";
|
|
78
|
+
readonly VillageDwellers: "VillageDwellers";
|
|
79
|
+
readonly VillageInfo: "VillageInfo";
|
|
80
|
+
readonly VillagePOI: "VillagePOI";
|
|
81
|
+
readonly VillagePlayers: "VillagePlayers";
|
|
82
|
+
readonly VillageRaid: "VillageRaid";
|
|
83
|
+
readonly Player: "Player";
|
|
84
|
+
readonly PlayerClient: "PlayerClient";
|
|
85
|
+
readonly ActorPrefix: "ActorPrefix";
|
|
86
|
+
readonly ChunkLoadedRequest: "ChunkLoadedRequest";
|
|
87
|
+
readonly Digest: "Digest";
|
|
88
|
+
readonly Map: "Map";
|
|
89
|
+
readonly Portals: "Portals";
|
|
90
|
+
readonly SchedulerWT: "SchedulerWT";
|
|
91
|
+
readonly StructureTemplate: "StructureTemplate";
|
|
92
|
+
readonly TickingArea: "TickingArea";
|
|
93
|
+
readonly FlatWorldLayers: "FlatWorldLayers";
|
|
94
|
+
readonly LegacyOverworld: "LegacyDimension";
|
|
95
|
+
readonly LegacyNether: "LegacyDimension";
|
|
96
|
+
readonly LegacyTheEnd: "LegacyDimension";
|
|
97
|
+
readonly MVillages: "MVillages";
|
|
98
|
+
readonly Villages: "Villages";
|
|
99
|
+
readonly LevelSpawnWasFixed: "LevelSpawnWasFixed";
|
|
100
|
+
readonly PositionTrackingDB: "PositionTrackingDB";
|
|
101
|
+
readonly PositionTrackingLastId: "PositionTrackingLastId";
|
|
102
|
+
readonly Scoreboard: "Scoreboard";
|
|
103
|
+
readonly Overworld: "Dimension";
|
|
104
|
+
readonly Nether: "Dimension";
|
|
105
|
+
readonly TheEnd: "Dimension";
|
|
106
|
+
readonly AutonomousEntities: "AutonomousEntities";
|
|
107
|
+
readonly BiomeData: "BiomeData";
|
|
108
|
+
readonly BiomeIdsTable: "BiomeIdsTable";
|
|
109
|
+
readonly MobEvents: "MobEvents";
|
|
110
|
+
readonly DynamicProperties: "DynamicProperties";
|
|
111
|
+
readonly LevelChunkMetaDataDictionary: "LevelChunkMetaDataDictionary";
|
|
112
|
+
readonly RealmsStoriesData: "RealmsStoriesData";
|
|
113
|
+
readonly LevelDat: "LevelDat";
|
|
114
|
+
readonly ForcedWorldCorruption: "ForcedWorldCorruption";
|
|
115
|
+
readonly Unknown: "Unknown";
|
|
116
|
+
};
|
|
47
117
|
/**
|
|
48
118
|
* The content type to format mapping for LevelDB entries.
|
|
49
119
|
*/
|
|
@@ -118,31 +188,81 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
118
188
|
readonly defaultValue: Buffer<ArrayBuffer>;
|
|
119
189
|
};
|
|
120
190
|
/**
|
|
121
|
-
*
|
|
191
|
+
* The Data2D content type contains heightmap and biome data for 16x128x16 chunks of the world.
|
|
122
192
|
*
|
|
123
|
-
* @
|
|
124
|
-
*
|
|
193
|
+
* Unlike {@link entryContentTypeToFormatMap.Data3D | Data3D}, this only stores biome data for xz coordinates, so in this format all y coordinates have the same biome.
|
|
194
|
+
*
|
|
195
|
+
* @deprecated Only used in versions < 1.18.0.
|
|
125
196
|
*/
|
|
126
197
|
readonly Data2D: {
|
|
127
198
|
/**
|
|
128
199
|
* The format type of the data.
|
|
129
200
|
*/
|
|
130
|
-
readonly type: "
|
|
201
|
+
readonly type: "custom";
|
|
202
|
+
/**
|
|
203
|
+
* The format type that results from the {@link entryContentTypeToFormatMap.Data2D.parse | parse} method.
|
|
204
|
+
*/
|
|
205
|
+
readonly resultType: "JSONNBT";
|
|
206
|
+
/**
|
|
207
|
+
* The function to parse the data.
|
|
208
|
+
*
|
|
209
|
+
* The {@link data} parameter should be the buffer read directly from the file or LevelDB entry.
|
|
210
|
+
*
|
|
211
|
+
* @param data The data to parse, as a buffer.
|
|
212
|
+
* @returns The parsed data.
|
|
213
|
+
*/
|
|
214
|
+
readonly parse: (data: Buffer) => NBTSchemas.NBTSchemaTypes.Data2D;
|
|
215
|
+
/**
|
|
216
|
+
* The function to serialize the data.
|
|
217
|
+
*
|
|
218
|
+
* This result of this can be written directly to the file or LevelDB entry.
|
|
219
|
+
*
|
|
220
|
+
* @param data The data to serialize.
|
|
221
|
+
* @returns The serialized data, as a buffer.
|
|
222
|
+
*/
|
|
223
|
+
readonly serialize: (data: NBTSchemas.NBTSchemaTypes.Data2D) => Buffer<ArrayBuffer>;
|
|
131
224
|
};
|
|
132
225
|
/**
|
|
133
|
-
*
|
|
226
|
+
* The Data2D content type contains heightmap and biome data for 16x128x16 chunks of the world.
|
|
134
227
|
*
|
|
135
|
-
* @
|
|
136
|
-
*
|
|
228
|
+
* Unlike {@link entryContentTypeToFormatMap.Data3D | Data3D}, this only stores biome data for xz coordinates, so in this format all y coordinates have the same biome.
|
|
229
|
+
*
|
|
230
|
+
* Unlike both {@link entryContentTypeToFormatMap.Data3D | Data3D} and {@link entryContentTypeToFormatMap.Data2D | Data2D}, this also stores biome color data.
|
|
231
|
+
*
|
|
232
|
+
* @deprecated Only used in versions < 1.0.0.
|
|
137
233
|
*/
|
|
138
234
|
readonly Data2DLegacy: {
|
|
139
235
|
/**
|
|
140
236
|
* The format type of the data.
|
|
141
237
|
*/
|
|
142
|
-
readonly type: "
|
|
238
|
+
readonly type: "custom";
|
|
239
|
+
/**
|
|
240
|
+
* The format type that results from the {@link entryContentTypeToFormatMap.Data2DLegacy.parse | parse} method.
|
|
241
|
+
*/
|
|
242
|
+
readonly resultType: "JSONNBT";
|
|
243
|
+
/**
|
|
244
|
+
* The function to parse the data.
|
|
245
|
+
*
|
|
246
|
+
* The {@link data} parameter should be the buffer read directly from the file or LevelDB entry.
|
|
247
|
+
*
|
|
248
|
+
* @param data The data to parse, as a buffer.
|
|
249
|
+
* @returns The parsed data.
|
|
250
|
+
*/
|
|
251
|
+
readonly parse: (data: Buffer) => NBTSchemas.NBTSchemaTypes.Data2DLegacy;
|
|
252
|
+
/**
|
|
253
|
+
* The function to serialize the data.
|
|
254
|
+
*
|
|
255
|
+
* This result of this can be written directly to the file or LevelDB entry.
|
|
256
|
+
*
|
|
257
|
+
* @param data The data to serialize.
|
|
258
|
+
* @returns The serialized data, as a buffer.
|
|
259
|
+
*/
|
|
260
|
+
readonly serialize: (data: NBTSchemas.NBTSchemaTypes.Data2DLegacy) => Buffer<ArrayBuffer>;
|
|
143
261
|
};
|
|
144
262
|
/**
|
|
145
|
-
* The SubChunkPrefix content type contains block data for 16x16x16
|
|
263
|
+
* The SubChunkPrefix content type contains block data for 16x16x16 subchunks of the world.
|
|
264
|
+
*
|
|
265
|
+
* In older versions, it may also contain sky and block light data.
|
|
146
266
|
*
|
|
147
267
|
* @see {@link NBTSchemas.nbtSchemas.SubChunkPrefix}
|
|
148
268
|
*/
|
|
@@ -164,6 +284,7 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
164
284
|
* @returns A promise that resolves with the parsed data.
|
|
165
285
|
*
|
|
166
286
|
* @throws {Error} If the SubChunkPrefix version is unknown.
|
|
287
|
+
* @throws {Error} If the storage version is unknown.
|
|
167
288
|
*/
|
|
168
289
|
readonly parse: (data: Buffer) => Promise<NBTSchemas.NBTSchemaTypes.SubChunkPrefix>;
|
|
169
290
|
/**
|
|
@@ -177,16 +298,39 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
177
298
|
readonly serialize: (data: NBTSchemas.NBTSchemaTypes.SubChunkPrefix) => Buffer<ArrayBuffer>;
|
|
178
299
|
};
|
|
179
300
|
/**
|
|
301
|
+
* The LegacyTerrain content type contains block, sky light, block light, dirty columns, and grass color data for 16x16x128 chunks of the world.
|
|
302
|
+
*
|
|
180
303
|
* @deprecated Only used in versions < 1.0.0.
|
|
181
304
|
*
|
|
182
|
-
* @
|
|
183
|
-
* @todo Add a description for this.
|
|
305
|
+
* @see {@link NBTSchemas.nbtSchemas.LegacyTerrain}
|
|
184
306
|
*/
|
|
185
307
|
readonly LegacyTerrain: {
|
|
186
308
|
/**
|
|
187
309
|
* The format type of the data.
|
|
188
310
|
*/
|
|
189
|
-
readonly type: "
|
|
311
|
+
readonly type: "custom";
|
|
312
|
+
/**
|
|
313
|
+
* The format type that results from the {@link entryContentTypeToFormatMap.LegacyTerrain.parse | parse} method.
|
|
314
|
+
*/
|
|
315
|
+
readonly resultType: "JSONNBT";
|
|
316
|
+
/**
|
|
317
|
+
* The function to parse the data.
|
|
318
|
+
*
|
|
319
|
+
* The {@link data} parameter should be the buffer read directly from the file or LevelDB entry.
|
|
320
|
+
*
|
|
321
|
+
* @param data The data to parse, as a buffer.
|
|
322
|
+
* @returns The parsed data.
|
|
323
|
+
*/
|
|
324
|
+
readonly parse: (data: Buffer) => NBTSchemas.NBTSchemaTypes.LegacyTerrain;
|
|
325
|
+
/**
|
|
326
|
+
* The function to serialize the data.
|
|
327
|
+
*
|
|
328
|
+
* This result of this can be written directly to the file or LevelDB entry.
|
|
329
|
+
*
|
|
330
|
+
* @param data The data to serialize.
|
|
331
|
+
* @returns The serialized data, as a buffer.
|
|
332
|
+
*/
|
|
333
|
+
readonly serialize: (data: NBTSchemas.NBTSchemaTypes.LegacyTerrain) => Buffer<ArrayBuffer>;
|
|
190
334
|
};
|
|
191
335
|
/**
|
|
192
336
|
* A list of block entities associated with a chunk.
|
|
@@ -246,10 +390,11 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
246
390
|
}) => Buffer<ArrayBuffer>;
|
|
247
391
|
};
|
|
248
392
|
/**
|
|
393
|
+
* A list of entities associated with a chunk.
|
|
394
|
+
*
|
|
249
395
|
* @deprecated No longer used.
|
|
250
396
|
*
|
|
251
397
|
* @todo Figure out what version this was deprecated in (it exists in v1.16.40 but not in 1.21.51).
|
|
252
|
-
* @todo Add a description for this.
|
|
253
398
|
*/
|
|
254
399
|
readonly Entity: {
|
|
255
400
|
/**
|
|
@@ -313,6 +458,12 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
313
458
|
* The format type of the data.
|
|
314
459
|
*/
|
|
315
460
|
readonly type: "NBT";
|
|
461
|
+
/**
|
|
462
|
+
* The default value to use when initializing a new entry.
|
|
463
|
+
*
|
|
464
|
+
* @todo Add a link to the object with the default value once it is made.
|
|
465
|
+
*/
|
|
466
|
+
readonly defaultValue: Buffer<ArrayBuffer>;
|
|
316
467
|
};
|
|
317
468
|
/**
|
|
318
469
|
* @deprecated Only used in versions < 1.2.3.
|
|
@@ -343,6 +494,8 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
343
494
|
* - `0`: Unknown
|
|
344
495
|
* - `1`: Unknown
|
|
345
496
|
* - `2`: Unknown
|
|
497
|
+
*
|
|
498
|
+
* @todo Figure out the meanings of the values.
|
|
346
499
|
*/
|
|
347
500
|
readonly FinalizedState: {
|
|
348
501
|
/**
|
|
@@ -416,6 +569,12 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
416
569
|
* The format type of the data.
|
|
417
570
|
*/
|
|
418
571
|
readonly type: "NBT";
|
|
572
|
+
/**
|
|
573
|
+
* The default value to use when initializing a new entry.
|
|
574
|
+
*
|
|
575
|
+
* @todo Add a link to the object with the default value once it is made.
|
|
576
|
+
*/
|
|
577
|
+
readonly defaultValue: Buffer<ArrayBuffer>;
|
|
419
578
|
};
|
|
420
579
|
/**
|
|
421
580
|
* The low segment of the 4 byte halves of the seed value used to generate the chunk.
|
|
@@ -443,7 +602,7 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
443
602
|
readonly signed: true;
|
|
444
603
|
};
|
|
445
604
|
/**
|
|
446
|
-
* xxHash64 checksums of `
|
|
605
|
+
* xxHash64 checksums of `SubChunkPrefix`, `BlockEntity`, `Entity`, and `Data2D` values.
|
|
447
606
|
*
|
|
448
607
|
* @deprecated Only used in versions < 1.18.0.
|
|
449
608
|
*
|
|
@@ -814,22 +973,78 @@ export declare const entryContentTypeToFormatMap: {
|
|
|
814
973
|
readonly type: "NBT";
|
|
815
974
|
};
|
|
816
975
|
/**
|
|
976
|
+
* The structure data of the Overworld dimension.
|
|
977
|
+
*
|
|
978
|
+
* This content type coexists with the {@link entryContentTypeToFormatMap.Overworld | Overworld} content type in some versions (such as v1.0.0.16 and v1.1.5.0).
|
|
979
|
+
*
|
|
817
980
|
* @deprecated It is unknown when this was removed, it was found in a Windows 10 Edition Beta v0.15.0 world.
|
|
818
981
|
*
|
|
819
|
-
* @
|
|
820
|
-
* @todo Add a description for this.
|
|
982
|
+
* @see {@link NBTSchemas.nbtSchemas.LegacyOverworld}
|
|
821
983
|
*/
|
|
822
|
-
readonly
|
|
984
|
+
readonly LegacyOverworld: {
|
|
823
985
|
/**
|
|
824
986
|
* The format type of the data.
|
|
825
987
|
*/
|
|
826
988
|
readonly type: "NBT";
|
|
827
989
|
};
|
|
828
990
|
/**
|
|
829
|
-
*
|
|
830
|
-
*
|
|
991
|
+
* The structure data of the Nether dimension.
|
|
992
|
+
*
|
|
993
|
+
* This content type coexists with the {@link entryContentTypeToFormatMap.Nether | Nether} content type in some versions (such as v1.0.0.16 and v1.1.5.0).
|
|
994
|
+
*
|
|
995
|
+
* @deprecated It is unknown when this was removed, it was found in a Windows 10 Edition Beta v0.15.0 world.
|
|
996
|
+
*
|
|
997
|
+
* @see {@link NBTSchemas.nbtSchemas.LegacyNether}
|
|
831
998
|
*/
|
|
832
|
-
readonly
|
|
999
|
+
readonly LegacyNether: {
|
|
1000
|
+
/**
|
|
1001
|
+
* The format type of the data.
|
|
1002
|
+
*/
|
|
1003
|
+
readonly type: "NBT";
|
|
1004
|
+
};
|
|
1005
|
+
/**
|
|
1006
|
+
* The structure data of the End dimension.
|
|
1007
|
+
*
|
|
1008
|
+
* This content type coexists with the {@link entryContentTypeToFormatMap.TheEnd | TheEnd} content type in some versions (such as v1.0.0.16 and v1.1.5.0).
|
|
1009
|
+
*
|
|
1010
|
+
* @deprecated It is unknown when this was removed, it was found in a Windows 10 Edition Beta v0.15.0 world.
|
|
1011
|
+
*
|
|
1012
|
+
* @see {@link NBTSchemas.nbtSchemas.LegacyTheEnd}
|
|
1013
|
+
*/
|
|
1014
|
+
readonly LegacyTheEnd: {
|
|
1015
|
+
/**
|
|
1016
|
+
* The format type of the data.
|
|
1017
|
+
*/
|
|
1018
|
+
readonly type: "NBT";
|
|
1019
|
+
};
|
|
1020
|
+
/**
|
|
1021
|
+
* The data of the Overworld dimension.
|
|
1022
|
+
*
|
|
1023
|
+
* @see {@link NBTSchemas.nbtSchemas.Overworld}
|
|
1024
|
+
*/
|
|
1025
|
+
readonly Overworld: {
|
|
1026
|
+
/**
|
|
1027
|
+
* The format type of the data.
|
|
1028
|
+
*/
|
|
1029
|
+
readonly type: "NBT";
|
|
1030
|
+
};
|
|
1031
|
+
/**
|
|
1032
|
+
* The data of the Nether dimension.
|
|
1033
|
+
*
|
|
1034
|
+
* @see {@link NBTSchemas.nbtSchemas.Nether}
|
|
1035
|
+
*/
|
|
1036
|
+
readonly Nether: {
|
|
1037
|
+
/**
|
|
1038
|
+
* The format type of the data.
|
|
1039
|
+
*/
|
|
1040
|
+
readonly type: "NBT";
|
|
1041
|
+
};
|
|
1042
|
+
/**
|
|
1043
|
+
* The data of the End dimension.
|
|
1044
|
+
*
|
|
1045
|
+
* @see {@link NBTSchemas.nbtSchemas.TheEnd}
|
|
1046
|
+
*/
|
|
1047
|
+
readonly TheEnd: {
|
|
833
1048
|
/**
|
|
834
1049
|
* The format type of the data.
|
|
835
1050
|
*/
|
|
@@ -1361,6 +1576,10 @@ export type DBEntryContentType = (typeof DBEntryContentTypes)[number];
|
|
|
1361
1576
|
* A content type of a LevelDB chunk key entry.
|
|
1362
1577
|
*/
|
|
1363
1578
|
export type DBChunkKeyEntryContentType = "Data3D" | "Version" | "Data2D" | "Data2DLegacy" | "SubChunkPrefix" | "LegacyTerrain" | "BlockEntity" | "Entity" | "PendingTicks" | "LegacyBlockExtraData" | "BiomeState" | "FinalizedState" | "ConversionData" | "BorderBlocks" | "HardcodedSpawners" | "RandomTicks" | "Checksums" | "GenerationSeed" | "GeneratedPreCavesAndCliffsBlending" | "BlendingBiomeHeight" | "MetaDataHash" | "BlendingData" | "ActorDigestVersion" | "LegacyVersion" | "AABBVolumes";
|
|
1579
|
+
/**
|
|
1580
|
+
* The a grouping type of LevelDB entry content types.
|
|
1581
|
+
*/
|
|
1582
|
+
export type DBEntryContentTypeGroup = (typeof DBEntryContentTypesGrouping)[DBEntryContentType];
|
|
1364
1583
|
/**
|
|
1365
1584
|
* Parses an integer from a buffer gives the number of bytes, endianness, signedness and offset.
|
|
1366
1585
|
*
|