minecraft-data 3.8.0 → 3.10.1

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.
Files changed (73) hide show
  1. package/.github/workflows/ci.yml +1 -6
  2. package/.github/workflows/md-release.yml +5 -4
  3. package/.github/workflows/npm-publish.yml +1 -2
  4. package/.github/workflows/trigger.yml +2 -2
  5. package/README.md +14 -15
  6. package/data.js +40 -19
  7. package/doc/api.md +460 -167
  8. package/doc/history.md +408 -175
  9. package/index.d.ts +152 -125
  10. package/lib/indexes.js +0 -2
  11. package/lib/loader.js +1 -2
  12. package/minecraft-data/.github/workflows/ci.yml +1 -1
  13. package/minecraft-data/README.md +1 -1
  14. package/minecraft-data/data/bedrock/1.16.201/proto.yml +1 -1
  15. package/minecraft-data/data/bedrock/1.16.201/protocol.json +1 -1
  16. package/minecraft-data/data/bedrock/1.16.210/proto.yml +1 -1
  17. package/minecraft-data/data/bedrock/1.16.210/protocol.json +1 -1
  18. package/minecraft-data/data/bedrock/1.16.220/proto.yml +1 -1
  19. package/minecraft-data/data/bedrock/1.16.220/protocol.json +1 -1
  20. package/minecraft-data/data/bedrock/1.17.0/blockCollisionShapes.json +24 -24
  21. package/minecraft-data/data/bedrock/1.17.0/proto.yml +1 -1
  22. package/minecraft-data/data/bedrock/1.17.0/protocol.json +1 -1
  23. package/minecraft-data/data/bedrock/1.17.10/blockCollisionShapes.json +24 -24
  24. package/minecraft-data/data/bedrock/1.17.10/proto.yml +1 -1
  25. package/minecraft-data/data/bedrock/1.17.10/protocol.json +1 -1
  26. package/minecraft-data/data/bedrock/1.17.30/proto.yml +1 -1
  27. package/minecraft-data/data/bedrock/1.17.30/protocol.json +1 -1
  28. package/minecraft-data/data/bedrock/1.17.40/blockCollisionShapes.json +24 -24
  29. package/minecraft-data/data/bedrock/1.17.40/proto.yml +1 -1
  30. package/minecraft-data/data/bedrock/1.17.40/protocol.json +1 -1
  31. package/minecraft-data/data/bedrock/1.18.0/proto.yml +1 -1
  32. package/minecraft-data/data/bedrock/1.18.0/protocol.json +1 -1
  33. package/minecraft-data/data/bedrock/1.18.11/blockCollisionShapes.json +24 -24
  34. package/minecraft-data/data/bedrock/1.18.11/proto.yml +1 -1
  35. package/minecraft-data/data/bedrock/1.18.11/protocol.json +1 -1
  36. package/minecraft-data/data/bedrock/1.18.30/blockCollisionShapes.json +24 -24
  37. package/minecraft-data/data/bedrock/1.18.30/proto.yml +1 -1
  38. package/minecraft-data/data/bedrock/1.18.30/protocol.json +1 -1
  39. package/minecraft-data/data/bedrock/1.19.1/biomes.json +1022 -0
  40. package/minecraft-data/data/bedrock/1.19.1/blockCollisionShapes.json +899 -0
  41. package/minecraft-data/data/bedrock/1.19.1/blockStates.json +165209 -0
  42. package/minecraft-data/data/bedrock/1.19.1/blocks.json +15769 -0
  43. package/minecraft-data/data/bedrock/1.19.1/blocksB2J.json +7234 -0
  44. package/minecraft-data/data/bedrock/1.19.1/blocksJ2B.json +21450 -0
  45. package/minecraft-data/data/bedrock/1.19.1/entities.json +1442 -0
  46. package/minecraft-data/data/bedrock/1.19.1/items.json +9831 -0
  47. package/minecraft-data/data/bedrock/1.19.1/proto.yml +1 -1
  48. package/minecraft-data/data/bedrock/1.19.1/protocol.json +1 -1
  49. package/minecraft-data/data/bedrock/1.19.1/recipes.json +17454 -0
  50. package/minecraft-data/data/bedrock/1.19.10/items.json +9837 -0
  51. package/minecraft-data/data/bedrock/1.19.10/proto.yml +3680 -0
  52. package/minecraft-data/data/bedrock/1.19.10/protocol.json +57 -59
  53. package/minecraft-data/data/bedrock/1.19.10/recipes.json +17454 -0
  54. package/minecraft-data/data/bedrock/1.19.10/types.yml +1955 -0
  55. package/minecraft-data/data/bedrock/1.19.20/protocol.json +10644 -0
  56. package/minecraft-data/data/bedrock/1.19.20/version.json +6 -0
  57. package/minecraft-data/data/bedrock/common/protocolVersions.json +6 -0
  58. package/minecraft-data/data/bedrock/common/versions.json +2 -1
  59. package/minecraft-data/data/bedrock/latest/proto.yml +55 -7
  60. package/minecraft-data/data/bedrock/latest/types.yml +7 -0
  61. package/minecraft-data/data/dataPaths.json +40 -19
  62. package/minecraft-data/data/pc/1.19/protocol.json +1 -5
  63. package/minecraft-data/data/pc/1.7/protocol.json +1 -1
  64. package/minecraft-data/data/pc/1.8/protocol.json +1 -1
  65. package/minecraft-data/data/pc/15w40b/protocol.json +1 -1
  66. package/minecraft-data/data/pc/common/protocolVersions.json +42 -0
  67. package/minecraft-data/doc/history.md +16 -0
  68. package/minecraft-data/tools/js/compileProtocol.js +34 -9
  69. package/minecraft-data/tools/js/test/protocolSync.js +8 -0
  70. package/package.json +1 -1
  71. package/typings/generate-typings.js +22 -14
  72. package/typings/index-template.d.ts +160 -133
  73. package/typings/test-typings.ts +24 -29
@@ -0,0 +1,6 @@
1
+ {
2
+ "version": 544,
3
+ "minecraftVersion": "1.19.20",
4
+ "majorVersion": "1.19",
5
+ "releaseType": "release"
6
+ }
@@ -1,4 +1,10 @@
1
1
  [
2
+ {
3
+ "version": 544,
4
+ "minecraftVersion": "1.19.20",
5
+ "majorVersion": "1.19",
6
+ "releaseType": "release"
7
+ },
2
8
  {
3
9
  "version": 534,
4
10
  "minecraftVersion": "1.19.10",
@@ -13,5 +13,6 @@
13
13
  "1.18.11",
14
14
  "1.18.30",
15
15
  "1.19.1",
16
- "1.19.10"
16
+ "1.19.10",
17
+ "1.19.20"
17
18
  ]
@@ -1,7 +1,7 @@
1
1
  # Created from MiNET and gophertunnel docs
2
2
  # The version below is the latest version this protocol schema was updated for.
3
3
  # The output protocol.json will be in the folder for the version
4
- !version: 1.19.10
4
+ !version: 1.19.20
5
5
 
6
6
  # Some ProtoDef aliases
7
7
  string: ["pstring",{"countType":"varint"}] # String / array types
@@ -334,6 +334,10 @@ packet_start_game:
334
334
  # A hack that Mojang put in place to preserve backwards compatibility with old villagers.
335
335
  # The his never actually read though, so it has no functionality.
336
336
  only_spawn_v1_villagers: bool
337
+ # PersonaDisabled is true if persona skins are disabled for the current game session.
338
+ persona_disabled: bool
339
+ # CustomSkinsDisabled is true if custom skins are disabled for the current game session.
340
+ custom_skins_disabled: bool
337
341
  # The version of the game from which Vanilla features will be used.
338
342
  # The exact function of this field isn't clear.
339
343
  game_version: string
@@ -342,6 +346,13 @@ packet_start_game:
342
346
  is_new_nether: bool
343
347
  edu_resource_uri: EducationSharedResourceURI
344
348
  experimental_gameplay_override: bool
349
+ # ChatRestrictionLevel specifies the level of restriction on in-game chat.
350
+ chat_restriction_level: u8 =>
351
+ 0: none
352
+ 1: dropped
353
+ 2: disabled
354
+ # DisablePlayerInteractions is true if the client should ignore other players when interacting with the world.
355
+ disable_player_interactions: bool
345
356
  # A base64 encoded world ID that is used to identify the world.
346
357
  level_id: string
347
358
  # The name of the world that the player is joining. Note that this field shows up
@@ -407,6 +418,9 @@ packet_start_game:
407
418
  # WorldTemplateID is a UUID that identifies the template that was used to generate the world. Servers that do not
408
419
  # use a world based off of a template can set this to an empty UUID.
409
420
  world_template_id: uuid
421
+ # ClientSideGeneration is true if the client should use the features registered in the FeatureRegistry packet to
422
+ # generate terrain client-side to save on bandwidth.
423
+ client_side_generation: bool
410
424
 
411
425
  packet_add_player:
412
426
  !id: 0x0c
@@ -1047,7 +1061,7 @@ packet_set_entity_data:
1047
1061
  !bound: both
1048
1062
  runtime_entity_id: varint64
1049
1063
  metadata: MetadataDictionary
1050
- tick: varint
1064
+ tick: varint64
1051
1065
 
1052
1066
  # SetActorMotion is sent by the server to change the client-side velocity of an entity. It is usually used
1053
1067
  # in combination with server-side movement calculation.
@@ -1513,12 +1527,19 @@ packet_clientbound_map_item_data:
1513
1527
  # the length of the outer slice having to be exactly Height long and the inner slices exactly Width long.
1514
1528
  # To access this array, use $width * y + x
1515
1529
  pixels: varint[]varint
1530
+ # Origin is the center position of the map being updated.
1531
+ origin: BlockCoordinates
1516
1532
 
1517
1533
 
1518
1534
  packet_map_info_request:
1519
1535
  !id: 0x44
1520
1536
  !bound: both
1521
1537
  map_id: zigzag64
1538
+ # ClientPixels is a map of pixels sent from the client to notify the server about the pixels that it isn't
1539
+ # aware of.
1540
+ client_pixels: []lu32
1541
+ rgba: li32
1542
+ index: lu16
1522
1543
 
1523
1544
  # RequestChunkRadius is sent by the client to the server to update the server on the chunk view radius that
1524
1545
  # it has set in the settings. The server may respond with a ChunkRadiusUpdated packet with either the chunk
@@ -2226,11 +2247,21 @@ packet_modal_form_response:
2226
2247
  # FormID is the form ID of the form the client has responded to. It is the same as the ID sent in the
2227
2248
  # ModalFormRequest, and may be used to identify which form was submitted.
2228
2249
  form_id: varint
2229
- # ResponseData is a JSON encoded value representing the response of the player. If the form was
2230
- # cancelled, a JSON encoded 'null' is in the response. For a modal form, the response is either true or
2231
- # false, for a menu form, the response is an integer specifying the index of the button clicked, and for
2232
- # a custom form, the response is an array containing a value for each element.
2233
- data: string
2250
+ # HasResponseData is true if the client provided response data.
2251
+ has_response_data: bool
2252
+ # ResponseData is a JSON encoded value representing the response of the player. For a modal form, the response is
2253
+ # either true or false, for a menu form, the response is an integer specifying the index of the button clicked, and
2254
+ # for a custom form, the response is an array containing a value for each element.
2255
+ data: has_response_data ?
2256
+ if true: string
2257
+ # HasCancelReason is true if the client provided a reason for the form being cancelled.
2258
+ has_cancel_reason: bool
2259
+ # CancelReason represents the reason why the form was cancelled.
2260
+ _: has_cancel_reason ?
2261
+ if true:
2262
+ cancel_reason: u8 =>
2263
+ 0: closed
2264
+ 1: busy
2234
2265
 
2235
2266
  # ServerSettingsRequest is sent by the client to request the settings specific to the server. These settings
2236
2267
  # are shown in a separate tab client-side, and have the same structure as a custom form.
@@ -2540,6 +2571,12 @@ packet_network_chunk_publisher_update:
2540
2571
  # Unlike the RequestChunkRadius and ChunkRadiusUpdated packets, this radius is in blocks rather than
2541
2572
  # chunks, so the chunk radius needs to be multiplied by 16. (Or shifted to the left by 4.)
2542
2573
  radius: varint
2574
+ saved_chunks: []lu32
2575
+ # ChunkX is the X coordinate of the chunk sent. (To translate a block's X to a chunk's X: x >> 4)
2576
+ x: zigzag32
2577
+ # ChunkZ is the Z coordinate of the chunk sent. (To translate a block's Z to a chunk's Z: z >> 4)
2578
+ z: zigzag32
2579
+
2543
2580
 
2544
2581
  # BiomeDefinitionList is sent by the server to let the client know all biomes that are available and
2545
2582
  # implemented on the server side. It is much like the AvailableActorIdentifiers packet, but instead
@@ -3678,3 +3715,14 @@ packet_editor_network:
3678
3715
  !bound: client
3679
3716
  # Payload is a network little endian compound tag holding data relevant to the editor.
3680
3717
  payload: nbt
3718
+
3719
+ # FeatureRegistry is a packet used to notify the client about the world generation features the server is currently
3720
+ # using. This is used in combination with the client-side world generation system introduced in v1.19.20, allowing the
3721
+ # client to completely generate the chunks of the world without having to rely on the server.
3722
+ packet_feature_registry:
3723
+ !id: 0xbf
3724
+ !bound: client
3725
+ # Features is a slice of all registered world generation features.
3726
+ features: []varint
3727
+ name: string
3728
+ options: string
@@ -468,6 +468,13 @@ PlayerAttributes: []varint
468
468
  current: lf32
469
469
  default: lf32
470
470
  name: string
471
+ modifiers: []varint
472
+ id: string
473
+ name: string
474
+ amount: lf32
475
+ operation: li32
476
+ operand: li32
477
+ serializable: bool
471
478
 
472
479
  # UseItemTransactionData represents an inventory transaction data object sent when the client uses an item on
473
480
  # a block. Also used in PlayerAuthoritativeInput packet
@@ -1325,13 +1325,13 @@
1325
1325
  "version": "bedrock/1.18.30"
1326
1326
  },
1327
1327
  "1.19.1": {
1328
- "blocks": "bedrock/1.18.30",
1329
- "blockStates": "bedrock/1.18.30",
1330
- "blockCollisionShapes": "bedrock/1.18.30",
1331
- "biomes": "bedrock/1.18.0",
1332
- "entities": "bedrock/1.18.11",
1333
- "items": "bedrock/1.18.30",
1334
- "recipes": "bedrock/1.18.30",
1328
+ "blocks": "bedrock/1.19.1",
1329
+ "blockStates": "bedrock/1.19.1",
1330
+ "blockCollisionShapes": "bedrock/1.19.1",
1331
+ "biomes": "bedrock/1.19.1",
1332
+ "entities": "bedrock/1.19.1",
1333
+ "items": "bedrock/1.19.1",
1334
+ "recipes": "bedrock/1.19.1",
1335
1335
  "instruments": "bedrock/1.17.0",
1336
1336
  "materials": "pc/1.17",
1337
1337
  "enchantments": "pc/1.17",
@@ -1339,20 +1339,20 @@
1339
1339
  "protocol": "bedrock/1.19.1",
1340
1340
  "windows": "bedrock/1.16.201",
1341
1341
  "steve": "bedrock/1.16.201",
1342
- "blocksB2J": "bedrock/1.18.30",
1343
- "blocksJ2B": "bedrock/1.18.30",
1342
+ "blocksB2J": "bedrock/1.19.1",
1343
+ "blocksJ2B": "bedrock/1.19.1",
1344
1344
  "proto": "bedrock/1.19.1",
1345
1345
  "types": "bedrock/1.19.1",
1346
1346
  "version": "bedrock/1.19.1"
1347
1347
  },
1348
1348
  "1.19.10": {
1349
- "blocks": "bedrock/1.18.30",
1350
- "blockStates": "bedrock/1.18.30",
1351
- "blockCollisionShapes": "bedrock/1.18.30",
1352
- "biomes": "bedrock/1.18.0",
1353
- "entities": "bedrock/1.18.11",
1354
- "items": "bedrock/1.18.30",
1355
- "recipes": "bedrock/1.18.30",
1349
+ "blocks": "bedrock/1.19.1",
1350
+ "blockStates": "bedrock/1.19.1",
1351
+ "blockCollisionShapes": "bedrock/1.19.1",
1352
+ "biomes": "bedrock/1.19.1",
1353
+ "entities": "bedrock/1.19.1",
1354
+ "items": "bedrock/1.19.10",
1355
+ "recipes": "bedrock/1.19.10",
1356
1356
  "instruments": "bedrock/1.17.0",
1357
1357
  "materials": "pc/1.17",
1358
1358
  "enchantments": "pc/1.17",
@@ -1360,11 +1360,32 @@
1360
1360
  "protocol": "bedrock/1.19.10",
1361
1361
  "windows": "bedrock/1.16.201",
1362
1362
  "steve": "bedrock/1.16.201",
1363
- "blocksB2J": "bedrock/1.18.30",
1364
- "blocksJ2B": "bedrock/1.18.30",
1363
+ "blocksB2J": "bedrock/1.19.1",
1364
+ "blocksJ2B": "bedrock/1.19.1",
1365
+ "proto": "bedrock/1.19.10",
1366
+ "types": "bedrock/1.19.10",
1367
+ "version": "bedrock/1.19.10"
1368
+ },
1369
+ "1.19.20": {
1370
+ "blocks": "bedrock/1.19.1",
1371
+ "blockStates": "bedrock/1.19.1",
1372
+ "blockCollisionShapes": "bedrock/1.19.1",
1373
+ "biomes": "bedrock/1.19.1",
1374
+ "entities": "bedrock/1.19.1",
1375
+ "items": "bedrock/1.19.10",
1376
+ "recipes": "bedrock/1.19.10",
1377
+ "instruments": "bedrock/1.17.0",
1378
+ "materials": "pc/1.17",
1379
+ "enchantments": "pc/1.17",
1380
+ "effects": "pc/1.17",
1381
+ "protocol": "bedrock/1.19.20",
1382
+ "windows": "bedrock/1.16.201",
1383
+ "steve": "bedrock/1.16.201",
1384
+ "blocksB2J": "bedrock/1.19.1",
1385
+ "blocksJ2B": "bedrock/1.19.1",
1365
1386
  "proto": "bedrock/latest",
1366
1387
  "types": "bedrock/latest",
1367
- "version": "bedrock/1.19.10"
1388
+ "version": "bedrock/1.19.20"
1368
1389
  }
1369
1390
  }
1370
1391
  }
@@ -2819,10 +2819,6 @@
2819
2819
  "name": "locked",
2820
2820
  "type": "bool"
2821
2821
  },
2822
- {
2823
- "name": "trackingPosition",
2824
- "type": "bool"
2825
- },
2826
2822
  {
2827
2823
  "name": "icons",
2828
2824
  "type": [
@@ -3578,7 +3574,7 @@
3578
3574
  [
3579
3575
  {
3580
3576
  "name": "dimension",
3581
- "type": "nbt"
3577
+ "type": "string"
3582
3578
  },
3583
3579
  {
3584
3580
  "name": "worldName",
@@ -1299,7 +1299,7 @@
1299
1299
  "container",
1300
1300
  [
1301
1301
  {
1302
- "name": "UUID",
1302
+ "name": "uuid",
1303
1303
  "type": "UUID"
1304
1304
  },
1305
1305
  {
@@ -1278,7 +1278,7 @@
1278
1278
  "container",
1279
1279
  [
1280
1280
  {
1281
- "name": "UUID",
1281
+ "name": "uuid",
1282
1282
  "type": "UUID"
1283
1283
  },
1284
1284
  {
@@ -1240,7 +1240,7 @@
1240
1240
  "container",
1241
1241
  [
1242
1242
  {
1243
- "name": "UUID",
1243
+ "name": "uuid",
1244
1244
  "type": "UUID"
1245
1245
  },
1246
1246
  {
@@ -1,4 +1,46 @@
1
1
  [
2
+ {
3
+ "minecraftVersion": "1.19.2",
4
+ "version": 760,
5
+ "dataVersion": 3120,
6
+ "usesNetty": true,
7
+ "majorVersion": "1.19"
8
+ },
9
+ {
10
+ "minecraftVersion": "1.19.2-rc2",
11
+ "version": 1073741927,
12
+ "dataVersion": 3119,
13
+ "usesNetty": true,
14
+ "majorVersion": "1.19"
15
+ },
16
+ {
17
+ "minecraftVersion": "1.19.2-rc1",
18
+ "version": 1073741926,
19
+ "dataVersion": 3118,
20
+ "usesNetty": true,
21
+ "majorVersion": "1.19"
22
+ },
23
+ {
24
+ "minecraftVersion": "1.19.1",
25
+ "version": 760,
26
+ "dataVersion": 3117,
27
+ "usesNetty": true,
28
+ "majorVersion": "1.19"
29
+ },
30
+ {
31
+ "minecraftVersion": "1.19.1-rc3",
32
+ "version": 1073741925,
33
+ "dataVersion": 3116,
34
+ "usesNetty": true,
35
+ "majorVersion": "1.19"
36
+ },
37
+ {
38
+ "minecraftVersion": "1.19.1-rc2",
39
+ "version": 1073741924,
40
+ "dataVersion": 3115,
41
+ "usesNetty": true,
42
+ "majorVersion": "1.19"
43
+ },
2
44
  {
3
45
  "minecraftVersion": "1.19.1-pre6",
4
46
  "version": 1073741923,
@@ -1,3 +1,19 @@
1
+ ## 3.10.1
2
+ * node-minecraft-data release
3
+
4
+ ## 3.10.0
5
+ * bedrock: add protocol data for 1.19.20 (@stevarino)
6
+
7
+ ## 3.9.1
8
+
9
+ * pc: fix packet_respawn (@rob9315)
10
+
11
+ ## 3.9.0
12
+
13
+ * bedrock: Add bedrock 1.19 data (#600)
14
+ * bedrock: protocol corrections
15
+ * pc: Add 1.19.1-rc2 to protocol versions
16
+
1
17
  ## 3.8.0
2
18
 
3
19
  * [1.19] update features and add some @rob9315
@@ -52,20 +52,45 @@ function convert (ver, path) {
52
52
  return version
53
53
  }
54
54
 
55
+ function validate (ver, path) {
56
+ process.chdir(path || join(__dirname, '../../data/bedrock/' + ver))
57
+ console.log(process.cwd())
58
+ const version = genProtoSchema()
59
+
60
+ const expected = JSON.stringify({ types: getJSON('./proto.json') })
61
+ // If you crash here, no protocol.json was generated - run `npm run build`
62
+ const actual = JSON.stringify(getJSON(`../${version}/protocol.json`))
63
+
64
+ fs.unlinkSync('./proto.json') // remove temp file
65
+ fs.unlinkSync('./packet_map.yml') // remove temp file
66
+
67
+ // Make sure the protocol_expected.json file equals the protocol.json file; otherwise the JSON must be rebuilt
68
+ if (expected !== actual) {
69
+ throw Error(`${ver} (${version}) / protocol.json is desynced from yaml, please run 'npm run build'`)
70
+ }
71
+
72
+ console.log('ok', `../${version}/protocol.json`)
73
+ return version
74
+ }
75
+
76
+ function all (fn) {
77
+ const versions = require('../../data/dataPaths.json').bedrock
78
+ for (const versionId in versions) {
79
+ console.log('⏳', fn.name, 'protocol for bedrock', versionId)
80
+ const ver = versions[versionId]
81
+ if (ver.proto) {
82
+ fn(ver.proto.includes('latest') ? 'latest' : versionId)
83
+ }
84
+ }
85
+ }
86
+
55
87
  // If no argument, build everything
56
88
  if (!module.parent) {
57
89
  if (!process.argv[2]) {
58
- const versions = require('../../data/dataPaths.json').bedrock
59
- for (const versionId in versions) {
60
- console.log('Compiling bedrock protocol', versionId)
61
- const ver = versions[versionId]
62
- if (ver.proto) {
63
- convert(ver.proto.includes('latest') ? 'latest' : versionId)
64
- }
65
- }
90
+ all(convert)
66
91
  } else { // build the specified version
67
92
  convert(process.argv[2])
68
93
  }
69
94
  }
70
95
 
71
- module.exports = { convert }
96
+ module.exports = { convert, validate, all }
@@ -0,0 +1,8 @@
1
+ /* eslint-env mocha */
2
+ const protocolTools = require('../compileProtocol')
3
+
4
+ describe('protocol yaml', () => {
5
+ it('should be valid and in sync with json', () => {
6
+ protocolTools.all(protocolTools.validate)
7
+ })
8
+ })
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "minecraft-data",
3
- "version": "3.8.0",
3
+ "version": "3.10.1",
4
4
  "description": "Provide easy access to minecraft data in node.js",
5
5
  "main": "index.js",
6
6
  "tonicExampleFilename": "example.js",
@@ -5,29 +5,37 @@ const fs = require('fs')
5
5
  const templateTypings = fs.readFileSync(path.resolve(__dirname, './index-template.d.ts'), 'utf8')
6
6
 
7
7
  // Recursively get path of all files in a directory
8
- function walkSync (dir, filelist = []) {
8
+ function walkSync (dir, fileList = []) {
9
9
  const files = fs.readdirSync(dir)
10
- files.forEach(function (file) {
10
+ files.forEach((file) => {
11
11
  if (fs.statSync(path.join(dir, file)).isDirectory()) {
12
- filelist = walkSync(path.join(dir, file), filelist)
12
+ fileList = walkSync(path.join(dir, file), fileList)
13
13
  } else {
14
- filelist.push(path.join(dir, file))
14
+ fileList.push(path.join(dir, file))
15
15
  }
16
16
  })
17
- return filelist
17
+ return fileList
18
18
  }
19
19
 
20
20
  async function generate () {
21
21
  let typingString = 'declare namespace MinecraftData {\n\n'
22
- typingString += (await Promise.all(walkSync(path.resolve(__dirname, '../minecraft-data/schemas')).map(async (schemaPath) => {
23
- if (schemaPath.includes('protocol_types')) return
24
- return (await compileFromFile(schemaPath, {
25
- bannerComment: ''
26
- // declareExternallyReferenced: false
27
- })).replace(/export /g, '')
28
- }))).join('\n\n').split('\n').map(line => ' ' + line).join('\n')
22
+ typingString += (
23
+ await Promise.all(
24
+ walkSync(path.resolve(__dirname, '../minecraft-data/schemas')).map(async (schemaPath) => {
25
+ if (schemaPath.includes('protocol_types')) return
26
+ return (await compileFromFile(schemaPath, { bannerComment: '' })).replace(/export /g, '')
27
+ })
28
+ )
29
+ )
30
+ .join('\n\n')
31
+ .split('\n')
32
+ .map((line) => ' ' + line)
33
+ .join('\n')
29
34
 
30
- typingString += templateTypings.split('\n').map(line => ' ' + line).join('\n')
35
+ typingString += templateTypings
36
+ .split('\n')
37
+ .map((line) => ' ' + line)
38
+ .join('\n')
31
39
  typingString += '\n}\n\n' // Close namespace
32
40
  typingString += 'declare function MinecraftData(version: string | number): MinecraftData.IndexedData;\n'
33
41
  typingString += 'export = MinecraftData'
@@ -37,4 +45,4 @@ async function generate () {
37
45
 
38
46
  generate()
39
47
  .then(() => console.log('Generated index.d.ts'))
40
- .catch(e => { console.error(e.stack) })
48
+ .catch((err) => console.error(err.stack))