mcbe-leveldb 1.17.0-jsonly → 1.18.0-jsonly
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 +28 -0
- package/LevelUtils.d.ts +1 -1
- package/LevelUtils.js +118 -43
- package/LevelUtils.js.map +1 -1
- package/__biome_data__.d.ts +7 -1
- package/__biome_data__.js +12 -3
- package/__biome_data__.js.map +1 -1
- package/nbtSchemas.d.ts +727 -68
- package/nbtSchemas.js +438 -65
- package/nbtSchemas.js.map +1 -1
- package/package.json +4 -3
package/nbtSchemas.js
CHANGED
|
@@ -7235,6 +7235,7 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
7235
7235
|
type: "byte",
|
|
7236
7236
|
},
|
|
7237
7237
|
},
|
|
7238
|
+
allOf: [{ $ref: "Item_ItemStack" }],
|
|
7238
7239
|
},
|
|
7239
7240
|
},
|
|
7240
7241
|
fogCommandStack: {
|
|
@@ -7266,6 +7267,7 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
7266
7267
|
type: "byte",
|
|
7267
7268
|
},
|
|
7268
7269
|
},
|
|
7270
|
+
allOf: [{ $ref: "Item_ItemStack" }],
|
|
7269
7271
|
},
|
|
7270
7272
|
},
|
|
7271
7273
|
LeftShoulderRiderID: {
|
|
@@ -8113,6 +8115,7 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
8113
8115
|
type: "byte",
|
|
8114
8116
|
},
|
|
8115
8117
|
},
|
|
8118
|
+
allOf: [{ $ref: "Item_ItemStack" }],
|
|
8116
8119
|
},
|
|
8117
8120
|
},
|
|
8118
8121
|
},
|
|
@@ -9495,8 +9498,8 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
9495
9498
|
},
|
|
9496
9499
|
//#endregion
|
|
9497
9500
|
//#region Item NBT Schemas
|
|
9498
|
-
|
|
9499
|
-
id: "
|
|
9501
|
+
Item_ItemStackBase: {
|
|
9502
|
+
id: "Item_ItemStackBase",
|
|
9500
9503
|
markdownDescription: "All items share this base.",
|
|
9501
9504
|
type: "compound",
|
|
9502
9505
|
required: ["Count", "Damage", "Name", "WasPickedUp"],
|
|
@@ -9545,6 +9548,223 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
9545
9548
|
},
|
|
9546
9549
|
$fragment: true,
|
|
9547
9550
|
},
|
|
9551
|
+
Item_ItemStack: {
|
|
9552
|
+
id: "Item_ItemStack",
|
|
9553
|
+
markdownDescription: "All items share this base.",
|
|
9554
|
+
type: "compound",
|
|
9555
|
+
anyOf: [
|
|
9556
|
+
{ $ref: "Item_GeneralTags" },
|
|
9557
|
+
{ $ref: "Item_EnchantmentTags" },
|
|
9558
|
+
// { $ref: "Item_ArmorTrim" },
|
|
9559
|
+
// { $ref: "Item_BookAndQuills" },
|
|
9560
|
+
// { $ref: "Item_BucketOfAquaticMob" },
|
|
9561
|
+
// { $ref: "Item_Crossbow" },
|
|
9562
|
+
// { $ref: "Item_FilledMap" },
|
|
9563
|
+
// { $ref: "Item_FireworkRocket" },
|
|
9564
|
+
// { $ref: "Item_FireworkStar" },
|
|
9565
|
+
// { $ref: "Item_GlowStick" },
|
|
9566
|
+
// { $ref: "Item_HorseArmor" },
|
|
9567
|
+
// { $ref: "Item_LodestoneCompass" },
|
|
9568
|
+
// { $ref: "Item_Potion" },
|
|
9569
|
+
// { $ref: "Item_Shield" },
|
|
9570
|
+
// { $ref: "Item_WrittenBook" },
|
|
9571
|
+
],
|
|
9572
|
+
allOf: [{ $ref: "Item_ItemStackBase" }],
|
|
9573
|
+
$fragment: true,
|
|
9574
|
+
},
|
|
9575
|
+
Item_GeneralTags: {
|
|
9576
|
+
id: "Item_GeneralTags",
|
|
9577
|
+
type: "compound",
|
|
9578
|
+
properties: {
|
|
9579
|
+
tag: {
|
|
9580
|
+
type: "compound",
|
|
9581
|
+
properties: {
|
|
9582
|
+
Damage: {
|
|
9583
|
+
markdownDescription: "(May not exist) The damage value for this item. Defaults to 0.",
|
|
9584
|
+
type: "int",
|
|
9585
|
+
default: { type: "int", value: 0 },
|
|
9586
|
+
},
|
|
9587
|
+
display: {
|
|
9588
|
+
description: "(May not exist) Display properties.",
|
|
9589
|
+
type: "compound",
|
|
9590
|
+
properties: {
|
|
9591
|
+
Lore: {
|
|
9592
|
+
description: "(May not exist) List of strings to display as lore for the item.",
|
|
9593
|
+
type: "list",
|
|
9594
|
+
items: {
|
|
9595
|
+
markdownDescription: "(May not exist) A line of text for the lore of an item.",
|
|
9596
|
+
type: "string",
|
|
9597
|
+
},
|
|
9598
|
+
},
|
|
9599
|
+
Name: {
|
|
9600
|
+
markdownDescription: "(May not exist) The JSON text component to use to display the item name.",
|
|
9601
|
+
type: "string",
|
|
9602
|
+
},
|
|
9603
|
+
},
|
|
9604
|
+
},
|
|
9605
|
+
"minecraft:item_lock": {
|
|
9606
|
+
markdownDescription: '1 for "lock in slot". 2 for "lock in inventory".',
|
|
9607
|
+
type: "byte",
|
|
9608
|
+
default: { type: "byte", value: 0 },
|
|
9609
|
+
markdownEnumDescriptions: ["none", "lock in slot", "lock in inventory"],
|
|
9610
|
+
enum: [
|
|
9611
|
+
{ type: "byte", value: 0 },
|
|
9612
|
+
{ type: "byte", value: 1 },
|
|
9613
|
+
{ type: "byte", value: 2 },
|
|
9614
|
+
],
|
|
9615
|
+
},
|
|
9616
|
+
"minecraft:keep_on_death": {
|
|
9617
|
+
markdownDescription: "1 if keeping on death.*needs testing*",
|
|
9618
|
+
type: "byte",
|
|
9619
|
+
default: { type: "byte", value: 0 },
|
|
9620
|
+
markdownEnumDescriptions: ["false", "true"],
|
|
9621
|
+
enum: [
|
|
9622
|
+
{ type: "byte", value: 0 },
|
|
9623
|
+
{ type: "byte", value: 1 },
|
|
9624
|
+
],
|
|
9625
|
+
},
|
|
9626
|
+
RepairCost: {
|
|
9627
|
+
markdownDescription: "(May not exist) Number of experience levels to add to the base level cost when repairing, combining, or renaming this item with an [Anvil](https://minecraft.wiki/w/Anvil).",
|
|
9628
|
+
type: "int",
|
|
9629
|
+
default: { type: "int", value: 0 },
|
|
9630
|
+
},
|
|
9631
|
+
Unbreakable: {
|
|
9632
|
+
markdownDescription: "1 or 0 (true/false) - (may not exist) if this item's durability is allowed to take damage.",
|
|
9633
|
+
type: "byte",
|
|
9634
|
+
default: { type: "byte", value: 0 },
|
|
9635
|
+
markdownEnumDescriptions: ["false", "true"],
|
|
9636
|
+
enum: [
|
|
9637
|
+
{ type: "byte", value: 0 },
|
|
9638
|
+
{ type: "byte", value: 1 },
|
|
9639
|
+
],
|
|
9640
|
+
},
|
|
9641
|
+
},
|
|
9642
|
+
},
|
|
9643
|
+
},
|
|
9644
|
+
$fragment: true,
|
|
9645
|
+
markdownDescription: "Items with durability store their damage value in NBT. Additionally, items can have custom display names and lore. There is also the **RepairCost** tag which tracks anvil usage for items, making them more costly with every use of the anvil.",
|
|
9646
|
+
},
|
|
9647
|
+
Item_EnchantmentTags: {
|
|
9648
|
+
id: "Item_EnchantmentTags",
|
|
9649
|
+
type: "compound",
|
|
9650
|
+
properties: {
|
|
9651
|
+
tag: {
|
|
9652
|
+
type: "compound",
|
|
9653
|
+
required: ["ench"],
|
|
9654
|
+
properties: {
|
|
9655
|
+
ench: {
|
|
9656
|
+
description: "Contains enchantments on this item.",
|
|
9657
|
+
type: "list",
|
|
9658
|
+
items: {
|
|
9659
|
+
description: "A single enchantment.",
|
|
9660
|
+
type: "compound",
|
|
9661
|
+
required: ["id", "lvl"],
|
|
9662
|
+
properties: {
|
|
9663
|
+
id: {
|
|
9664
|
+
markdownDescription: "The ID of the enchantment. See [Bedrock Edition data values#Enchantment IDs](https://minecraft.wiki/w/Bedrock_Edition_data_values#Enchantment_IDs).",
|
|
9665
|
+
type: "short",
|
|
9666
|
+
markdownEnumDescriptions: [
|
|
9667
|
+
"Protection (protection)",
|
|
9668
|
+
"Fire Protection (fire_protection)",
|
|
9669
|
+
"Feather Falling (feather_falling)",
|
|
9670
|
+
"Blast Protection (blast_protection)",
|
|
9671
|
+
"Projectile Protection (projectile_protection)",
|
|
9672
|
+
"Thorns (thorns)",
|
|
9673
|
+
"Respiration (respiration)",
|
|
9674
|
+
"Depth Strider (depth_strider)",
|
|
9675
|
+
"Aqua Affinity (aqua_affinity)",
|
|
9676
|
+
"Sharpness (sharpness)",
|
|
9677
|
+
"Smite (smite)",
|
|
9678
|
+
"Bane of Arthropods (bane_of_arthropods)",
|
|
9679
|
+
"Knockback (knockback)",
|
|
9680
|
+
"Fire Aspect (fire_aspect)",
|
|
9681
|
+
"Looting (looting)",
|
|
9682
|
+
"Efficiency (efficiency)",
|
|
9683
|
+
"Silk Touch (silk_touch)",
|
|
9684
|
+
"Unbreaking (unbreaking)",
|
|
9685
|
+
"Fortune (fortune)",
|
|
9686
|
+
"Power (power)",
|
|
9687
|
+
"Punch (punch)",
|
|
9688
|
+
"Flame (flame)",
|
|
9689
|
+
"Infinity (infinity)",
|
|
9690
|
+
"Luck of the Sea (luck_of_the_sea)",
|
|
9691
|
+
"Lure (lure)",
|
|
9692
|
+
"Frost Walker (frost_walker)",
|
|
9693
|
+
"Mending (mending)",
|
|
9694
|
+
"Curse of Binding (binding)",
|
|
9695
|
+
"Curse of Vanishing (vanishing)",
|
|
9696
|
+
"Impaling (impaling)",
|
|
9697
|
+
"Riptide (riptide)",
|
|
9698
|
+
"Loyalty (loyalty)",
|
|
9699
|
+
"Channeling (channeling)",
|
|
9700
|
+
"Multishot (multishot)",
|
|
9701
|
+
"Piercing (piercing)",
|
|
9702
|
+
"Quick Charge (quick_charge)",
|
|
9703
|
+
"Soul Speed (soul_speed)",
|
|
9704
|
+
"Swift Sneak (swift_sneak)",
|
|
9705
|
+
"Wind Burst (wind_burst)",
|
|
9706
|
+
"Density (density)",
|
|
9707
|
+
"Breach (breach)",
|
|
9708
|
+
"Lunge (lunge)",
|
|
9709
|
+
],
|
|
9710
|
+
enum: [
|
|
9711
|
+
{ type: "byte", value: 0 },
|
|
9712
|
+
{ type: "byte", value: 1 },
|
|
9713
|
+
{ type: "byte", value: 2 },
|
|
9714
|
+
{ type: "byte", value: 3 },
|
|
9715
|
+
{ type: "byte", value: 4 },
|
|
9716
|
+
{ type: "byte", value: 5 },
|
|
9717
|
+
{ type: "byte", value: 6 },
|
|
9718
|
+
{ type: "byte", value: 7 },
|
|
9719
|
+
{ type: "byte", value: 8 },
|
|
9720
|
+
{ type: "byte", value: 9 },
|
|
9721
|
+
{ type: "byte", value: 10 },
|
|
9722
|
+
{ type: "byte", value: 11 },
|
|
9723
|
+
{ type: "byte", value: 12 },
|
|
9724
|
+
{ type: "byte", value: 13 },
|
|
9725
|
+
{ type: "byte", value: 14 },
|
|
9726
|
+
{ type: "byte", value: 15 },
|
|
9727
|
+
{ type: "byte", value: 16 },
|
|
9728
|
+
{ type: "byte", value: 17 },
|
|
9729
|
+
{ type: "byte", value: 18 },
|
|
9730
|
+
{ type: "byte", value: 19 },
|
|
9731
|
+
{ type: "byte", value: 20 },
|
|
9732
|
+
{ type: "byte", value: 21 },
|
|
9733
|
+
{ type: "byte", value: 22 },
|
|
9734
|
+
{ type: "byte", value: 23 },
|
|
9735
|
+
{ type: "byte", value: 24 },
|
|
9736
|
+
{ type: "byte", value: 25 },
|
|
9737
|
+
{ type: "byte", value: 26 },
|
|
9738
|
+
{ type: "byte", value: 27 },
|
|
9739
|
+
{ type: "byte", value: 28 },
|
|
9740
|
+
{ type: "byte", value: 29 },
|
|
9741
|
+
{ type: "byte", value: 30 },
|
|
9742
|
+
{ type: "byte", value: 31 },
|
|
9743
|
+
{ type: "byte", value: 32 },
|
|
9744
|
+
{ type: "byte", value: 33 },
|
|
9745
|
+
{ type: "byte", value: 34 },
|
|
9746
|
+
{ type: "byte", value: 35 },
|
|
9747
|
+
{ type: "byte", value: 36 },
|
|
9748
|
+
{ type: "byte", value: 37 },
|
|
9749
|
+
{ type: "byte", value: 38 },
|
|
9750
|
+
{ type: "byte", value: 39 },
|
|
9751
|
+
{ type: "byte", value: 40 },
|
|
9752
|
+
{ type: "byte", value: 41 },
|
|
9753
|
+
],
|
|
9754
|
+
},
|
|
9755
|
+
lvl: {
|
|
9756
|
+
markdownDescription: "The level of the enchantment, where 1 is level 1. Values are clamped between -32768 and 32767 when reading.",
|
|
9757
|
+
type: "short",
|
|
9758
|
+
},
|
|
9759
|
+
},
|
|
9760
|
+
},
|
|
9761
|
+
},
|
|
9762
|
+
},
|
|
9763
|
+
},
|
|
9764
|
+
},
|
|
9765
|
+
$fragment: true,
|
|
9766
|
+
markdownDescription: "In [Bedrock Edition](https://minecraft.wiki/w/Bedrock_Edition), there's only one way to store enchantment NBTs: both enchanted items and [Enchanted Book](https://minecraft.wiki/w/Enchanted_Book) share the ench tag.",
|
|
9767
|
+
},
|
|
9548
9768
|
Item_ArmorTrim: {
|
|
9549
9769
|
id: "Item_ArmorTrim",
|
|
9550
9770
|
markdownDescription: "Additional fields when an [armor](https://minecraft.wiki/w/armor) is [trimmed](https://minecraft.wiki/w/Smithing_Template).",
|
|
@@ -10164,6 +10384,7 @@ however when the corresponding block in the block layer is broken, this block ge
|
|
|
10164
10384
|
type: "byte",
|
|
10165
10385
|
},
|
|
10166
10386
|
},
|
|
10387
|
+
allOf: [{ $ref: "Item_ItemStack" }],
|
|
10167
10388
|
},
|
|
10168
10389
|
},
|
|
10169
10390
|
InventoryVersion: {
|
|
@@ -11055,41 +11276,98 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
11055
11276
|
title: "The Data2D schema.",
|
|
11056
11277
|
markdownDescription: "The NBT structure of the parsed data of the Data2D content type.\n\nNote: This NBT structure is specific to the parser and serializer implemented by this module.\nThis is because the actual data is stored in binary format.",
|
|
11057
11278
|
type: "compound",
|
|
11058
|
-
|
|
11059
|
-
|
|
11060
|
-
|
|
11061
|
-
|
|
11062
|
-
|
|
11063
|
-
|
|
11064
|
-
|
|
11065
|
-
|
|
11066
|
-
|
|
11067
|
-
|
|
11068
|
-
|
|
11069
|
-
|
|
11070
|
-
|
|
11071
|
-
markdownDescription: "
|
|
11072
|
-
type:
|
|
11279
|
+
oneOf: [
|
|
11280
|
+
{
|
|
11281
|
+
type: "compound",
|
|
11282
|
+
required: ["version", "heightMap", "biomeData"],
|
|
11283
|
+
properties: {
|
|
11284
|
+
version: {
|
|
11285
|
+
title: "Format Version",
|
|
11286
|
+
markdownDescription: "The format version of the Data2D data. For versions before v1.18.0, this is format version 1. For modern Minecraft versions this is format version 2 but it is only used for worlds using the Old world type or an older base game version.",
|
|
11287
|
+
type: "byte",
|
|
11288
|
+
enumDescriptions: ["Pre-v1.18.0"],
|
|
11289
|
+
enum: [{ type: "byte", value: 1 }],
|
|
11290
|
+
},
|
|
11291
|
+
heightMap: {
|
|
11292
|
+
markdownDescription: "The height map data.\n\nIn it is stored as a 2D matrix with [x][z] height values.",
|
|
11293
|
+
type: "list",
|
|
11294
|
+
minItems: 16,
|
|
11295
|
+
maxItems: 16,
|
|
11296
|
+
items: {
|
|
11297
|
+
markdownDescription: "A height map row. Its index corresponds to the offset on the x axis.",
|
|
11298
|
+
type: "list",
|
|
11299
|
+
minItems: 16,
|
|
11300
|
+
maxItems: 16,
|
|
11301
|
+
items: {
|
|
11302
|
+
markdownDescription: "A height value. Its index corresponds to the offset on the z axis.",
|
|
11303
|
+
type: `${NBT.TagType.Short}`,
|
|
11304
|
+
},
|
|
11305
|
+
},
|
|
11306
|
+
},
|
|
11307
|
+
biomeData: {
|
|
11308
|
+
markdownDescription: "The biome data.\n\nIn it is stored as a 2D matrix with [x][z] biome numeric ID values.",
|
|
11309
|
+
type: "list",
|
|
11310
|
+
minItems: 16,
|
|
11311
|
+
maxItems: 16,
|
|
11312
|
+
items: {
|
|
11313
|
+
markdownDescription: "A biome data row. Its index corresponds to the offset on the x axis.",
|
|
11314
|
+
type: "list",
|
|
11315
|
+
minItems: 16,
|
|
11316
|
+
maxItems: 16,
|
|
11317
|
+
items: {
|
|
11318
|
+
markdownDescription: "A biome numeric ID value. Its index corresponds to the offset on the z axis.",
|
|
11319
|
+
type: `${NBT.TagType.Byte}`,
|
|
11320
|
+
},
|
|
11321
|
+
},
|
|
11073
11322
|
},
|
|
11074
11323
|
},
|
|
11075
11324
|
},
|
|
11076
|
-
|
|
11077
|
-
|
|
11078
|
-
|
|
11079
|
-
|
|
11080
|
-
|
|
11081
|
-
|
|
11082
|
-
|
|
11083
|
-
|
|
11084
|
-
|
|
11085
|
-
|
|
11086
|
-
|
|
11087
|
-
|
|
11088
|
-
|
|
11325
|
+
{
|
|
11326
|
+
type: "compound",
|
|
11327
|
+
required: ["version", "heightMap", "biomeData"],
|
|
11328
|
+
properties: {
|
|
11329
|
+
version: {
|
|
11330
|
+
title: "Format Version",
|
|
11331
|
+
markdownDescription: "The format version of the Data2D data. For versions before v1.18.0, this is format version 1. For modern Minecraft versions this is format version 2 but it is only used for worlds using the Old world type or an older base game version.",
|
|
11332
|
+
type: "byte",
|
|
11333
|
+
enumDescriptions: ["Post-v1.18.0"],
|
|
11334
|
+
enum: [{ type: "byte", value: 2 }],
|
|
11335
|
+
},
|
|
11336
|
+
heightMap: {
|
|
11337
|
+
markdownDescription: "The height map data.\n\nIn it is stored as a 2D matrix with [x][z] height values.",
|
|
11338
|
+
type: "list",
|
|
11339
|
+
minItems: 16,
|
|
11340
|
+
maxItems: 16,
|
|
11341
|
+
items: {
|
|
11342
|
+
markdownDescription: "A height map row. Its index corresponds to the offset on the x axis.",
|
|
11343
|
+
type: "list",
|
|
11344
|
+
minItems: 16,
|
|
11345
|
+
maxItems: 16,
|
|
11346
|
+
items: {
|
|
11347
|
+
markdownDescription: "A height value. Its index corresponds to the offset on the z axis.",
|
|
11348
|
+
type: `${NBT.TagType.Short}`,
|
|
11349
|
+
},
|
|
11350
|
+
},
|
|
11351
|
+
},
|
|
11352
|
+
biomeData: {
|
|
11353
|
+
markdownDescription: "The biome data.\n\nIn it is stored as a 2D matrix with [x][z] biome numeric ID values.",
|
|
11354
|
+
type: "list",
|
|
11355
|
+
minItems: 16,
|
|
11356
|
+
maxItems: 16,
|
|
11357
|
+
items: {
|
|
11358
|
+
markdownDescription: "A biome data row. Its index corresponds to the offset on the x axis.",
|
|
11359
|
+
type: "list",
|
|
11360
|
+
minItems: 16,
|
|
11361
|
+
maxItems: 16,
|
|
11362
|
+
items: {
|
|
11363
|
+
markdownDescription: "A biome numeric ID value. Its index corresponds to the offset on the z axis.",
|
|
11364
|
+
type: `${NBT.TagType.Short}`,
|
|
11365
|
+
},
|
|
11366
|
+
},
|
|
11089
11367
|
},
|
|
11090
11368
|
},
|
|
11091
11369
|
},
|
|
11092
|
-
|
|
11370
|
+
],
|
|
11093
11371
|
},
|
|
11094
11372
|
// NOTE: Verified.
|
|
11095
11373
|
Data3D: {
|
|
@@ -11378,16 +11656,15 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
11378
11656
|
],
|
|
11379
11657
|
},
|
|
11380
11658
|
},
|
|
11381
|
-
|
|
11382
|
-
|
|
11383
|
-
|
|
11384
|
-
markdownDescription: "256 bytes representing a 16x16 grid of dirty column flags.",
|
|
11659
|
+
height_map: {
|
|
11660
|
+
title: "Height Map",
|
|
11661
|
+
markdownDescription: "256 bytes representing a 16x16 grid of height map data.",
|
|
11385
11662
|
type: "list",
|
|
11386
11663
|
minItems: 256,
|
|
11387
11664
|
maxItems: 256,
|
|
11388
11665
|
items: {
|
|
11389
|
-
title: "
|
|
11390
|
-
markdownDescription: "A byte representing
|
|
11666
|
+
title: "Height",
|
|
11667
|
+
markdownDescription: "A byte representing the height value.",
|
|
11391
11668
|
type: "byte",
|
|
11392
11669
|
},
|
|
11393
11670
|
},
|
|
@@ -11400,8 +11677,7 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
11400
11677
|
items: {
|
|
11401
11678
|
title: "Grass Color Component",
|
|
11402
11679
|
// REVIEW: Maybe this should be changed to be a list of tuples or compounds.
|
|
11403
|
-
|
|
11404
|
-
markdownDescription: "A byte representing one of four color components for a column. (NOTE: This may actually be [BiomeID,R,G,B] rather than [R,G,B,A].)",
|
|
11680
|
+
markdownDescription: "A byte representing one of four components for a column. The components are: BiomeID,R,G,B",
|
|
11405
11681
|
type: "byte",
|
|
11406
11682
|
},
|
|
11407
11683
|
},
|
|
@@ -12099,18 +12375,6 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
12099
12375
|
}
|
|
12100
12376
|
if (!schema)
|
|
12101
12377
|
throw new TypeError("schema is required, recieved " + schema);
|
|
12102
|
-
if (schema.$ref) {
|
|
12103
|
-
if (options.inlineRefs ?? ToJSONSchema.defaultConvertOptions.inlineRefs) {
|
|
12104
|
-
const refTarget = allSchemas[schema.$ref];
|
|
12105
|
-
if (!refTarget) {
|
|
12106
|
-
throw new Error(`Unknown $ref: ${schema.$ref}`);
|
|
12107
|
-
}
|
|
12108
|
-
return nbtSchemaToJsonSchema(refTarget, allSchemas, options, isRoot);
|
|
12109
|
-
}
|
|
12110
|
-
else {
|
|
12111
|
-
return { $ref: schema.$ref }; // preserve the ref
|
|
12112
|
-
}
|
|
12113
|
-
}
|
|
12114
12378
|
const jsonSchema = {
|
|
12115
12379
|
id: schema.id,
|
|
12116
12380
|
$id: schema.$id,
|
|
@@ -12131,18 +12395,41 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
12131
12395
|
delete jsonSchema.description;
|
|
12132
12396
|
if (!("markdownDescription" in schema))
|
|
12133
12397
|
delete jsonSchema.markdownDescription;
|
|
12398
|
+
if (schema.$ref) {
|
|
12399
|
+
if (options.inlineRefs ?? ToJSONSchema.defaultConvertOptions.inlineRefs) {
|
|
12400
|
+
const refTarget = allSchemas[schema.$ref];
|
|
12401
|
+
if (!refTarget) {
|
|
12402
|
+
throw new Error(`Unknown $ref: ${schema.$ref}`);
|
|
12403
|
+
}
|
|
12404
|
+
const schemaRef = nbtSchemaToJsonSchema(refTarget, allSchemas, options, isRoot);
|
|
12405
|
+
if (Object.keys(schema).length === 1)
|
|
12406
|
+
return schemaRef;
|
|
12407
|
+
jsonSchema.allOf = [schemaRef];
|
|
12408
|
+
// if (typeof schemaRef === "boolean") return schemaRef;
|
|
12409
|
+
// for (const [k, v] of Object.entries(schemaRef) as [keyof JSONSchema, JSONSchema[keyof JSONSchema]][]) {
|
|
12410
|
+
// if ((k in jsonSchema)) continue;
|
|
12411
|
+
// jsonSchema[k] = v;
|
|
12412
|
+
// }
|
|
12413
|
+
}
|
|
12414
|
+
else {
|
|
12415
|
+
jsonSchema.$ref = schema.$ref;
|
|
12416
|
+
}
|
|
12417
|
+
}
|
|
12134
12418
|
// FIXME: List int value enum entries inside of a oneOf in the int value seem to only work when the enum array is just the numbers and not the full NBT.Int objects, fix this.
|
|
12135
12419
|
for (const key of ["oneOf", "anyOf", "allOf"]) {
|
|
12136
12420
|
if (!(key in schema) || !schema[key])
|
|
12137
12421
|
continue;
|
|
12138
|
-
jsonSchema[key] =
|
|
12422
|
+
jsonSchema[key] = [
|
|
12423
|
+
...(jsonSchema[key] ?? []),
|
|
12424
|
+
...schema[key].map((s) => nbtSchemaToJsonSchema(s, allSchemas, options, isRoot)),
|
|
12425
|
+
];
|
|
12139
12426
|
}
|
|
12140
12427
|
for (const key of ["not"]) {
|
|
12141
12428
|
if (!(key in schema) || schema[key] === undefined)
|
|
12142
12429
|
continue;
|
|
12143
12430
|
jsonSchema[key] = nbtSchemaToJsonSchema(schema[key], allSchemas, options, isRoot);
|
|
12144
12431
|
}
|
|
12145
|
-
let valueSchema
|
|
12432
|
+
let valueSchema;
|
|
12146
12433
|
let skipExtraPropertyDefs = false;
|
|
12147
12434
|
if (schema.type) {
|
|
12148
12435
|
if (Array.isArray(schema.type)) {
|
|
@@ -12154,7 +12441,7 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
12154
12441
|
const data: JSONSchema = tagTypeToSchema(schema.type, schema, allSchemas, options);
|
|
12155
12442
|
Object.assign(jsonSchema, { ...data, ...(data.properties!.value as JSONSchema) });
|
|
12156
12443
|
} else */ {
|
|
12157
|
-
Object.assign(jsonSchema, tagTypeToSchema(schema.type, schema, allSchemas, options, isRoot));
|
|
12444
|
+
Object.assign(jsonSchema, tagTypeToSchema(schema.type, { ...schema, $ref: undefined }, allSchemas, options, isRoot));
|
|
12158
12445
|
if ((options.makeValueSchema ?? ToJSONSchema.defaultConvertOptions.makeValueSchema) && isRoot) {
|
|
12159
12446
|
// REVIEW: I removed an ! before isRoot, make sure this wasn't a mistake.
|
|
12160
12447
|
valueSchema = jsonSchema.properties?.value ?? jsonSchema;
|
|
@@ -13544,6 +13831,17 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13544
13831
|
}
|
|
13545
13832
|
}
|
|
13546
13833
|
}
|
|
13834
|
+
let anyOfRefTypes = undefined;
|
|
13835
|
+
if (!(opts.inlineRefs ?? false) && schema.anyOf !== undefined) {
|
|
13836
|
+
const refAnyOfs = schema.anyOf.filter((ref) => typeof ref === "object" && !!ref.$ref);
|
|
13837
|
+
if (refAnyOfs.length > 0) {
|
|
13838
|
+
anyOfRefTypes ??= [];
|
|
13839
|
+
for (const refAnyOf of refAnyOfs) {
|
|
13840
|
+
anyOfRefTypes.push(resolveSchemaRefName(refAnyOf.$ref, !(opts.inlineRefs ?? false), opts) +
|
|
13841
|
+
(additionalInformation.isListChild ? '["value"]' : ""));
|
|
13842
|
+
}
|
|
13843
|
+
}
|
|
13844
|
+
}
|
|
13547
13845
|
let allOfNonRefTypes = undefined;
|
|
13548
13846
|
if (schema.allOf !== undefined) {
|
|
13549
13847
|
const nonRefAllOfs = schema.allOf.filter((ref) => typeof ref !== "object" || ref.$ref === undefined);
|
|
@@ -13574,9 +13872,25 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13574
13872
|
}
|
|
13575
13873
|
}
|
|
13576
13874
|
}
|
|
13875
|
+
let anyOfNonRefTypes = undefined;
|
|
13876
|
+
if (schema.anyOf !== undefined) {
|
|
13877
|
+
const nonRefAnyOfs = schema.anyOf.filter((ref) => typeof ref !== "object" || ref.$ref === undefined);
|
|
13878
|
+
if (nonRefAnyOfs.length > 0) {
|
|
13879
|
+
anyOfNonRefTypes ??= [];
|
|
13880
|
+
for (const nonRefAnyOf of nonRefAnyOfs) {
|
|
13881
|
+
const types = nonRefAnyOf.type ?? resolvedSchema.type;
|
|
13882
|
+
if (!types)
|
|
13883
|
+
continue;
|
|
13884
|
+
anyOfNonRefTypes.push(Array.isArray(types) ?
|
|
13885
|
+
types.map((t) => buildBuiltTypeForTag(t, nonRefAnyOf, indent, opts, ctx).value).join("|")
|
|
13886
|
+
: buildBuiltTypeForTag(types, nonRefAnyOf, indent, opts, ctx).value);
|
|
13887
|
+
}
|
|
13888
|
+
}
|
|
13889
|
+
}
|
|
13577
13890
|
const inlineRefTypes = {
|
|
13578
13891
|
allOf: [],
|
|
13579
13892
|
oneOf: [],
|
|
13893
|
+
anyOf: [],
|
|
13580
13894
|
};
|
|
13581
13895
|
if (opts.inlineRefs ?? false) {
|
|
13582
13896
|
if (allOfRefTypes)
|
|
@@ -13601,6 +13915,17 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13601
13915
|
.join("|")
|
|
13602
13916
|
: buildTypeForTag(types, refLookup[refType], indent, opts, ctx));
|
|
13603
13917
|
}
|
|
13918
|
+
if (anyOfRefTypes)
|
|
13919
|
+
for (const refType of anyOfRefTypes) {
|
|
13920
|
+
const types = refLookup[refType].type ?? resolvedSchema.type;
|
|
13921
|
+
if (!types)
|
|
13922
|
+
continue;
|
|
13923
|
+
inlineRefTypes.anyOf.push(Array.isArray(types) ?
|
|
13924
|
+
types
|
|
13925
|
+
.map((t) => buildTypeForTag(t, refLookup[refType], indent, opts, ctx))
|
|
13926
|
+
.join("|")
|
|
13927
|
+
: buildTypeForTag(types, refLookup[refType], indent, opts, ctx));
|
|
13928
|
+
}
|
|
13604
13929
|
}
|
|
13605
13930
|
if (!st) {
|
|
13606
13931
|
if (resolvedSchema.properties) {
|
|
@@ -13608,8 +13933,8 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13608
13933
|
return {
|
|
13609
13934
|
type: '"compound"',
|
|
13610
13935
|
value: (opts.inlineRefs ?? false) ?
|
|
13611
|
-
`${(allOfRefTypes || oneOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType.value) ? "" : `(${compoundType.value})`}${inlineRefTypes.allOf ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf ? ` & (
|
|
13612
|
-
: `${(allOfRefTypes || oneOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType.value) ? "" : `(${compoundType.value})`}${allOfRefTypes ? ` & ${allOfRefTypes.join(" & ")}` : ""}${oneOfRefTypes ? ` & (
|
|
13936
|
+
`${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType.value) ? "" : `(${compoundType.value})`}${inlineRefTypes.allOf ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf ? ` & (ExclusifyUnion<${inlineRefTypes.oneOf.join(" | ")}>)` : ""}${inlineRefTypes.anyOf ? ` & (${inlineRefTypes.anyOf.join(" | ")})` : ""}`
|
|
13937
|
+
: `${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType.value) ? "" : `(${compoundType.value})`}${allOfRefTypes ? ` & ${allOfRefTypes.join(" & ")}` : ""}${oneOfRefTypes ? ` & (ExclusifyUnion<${oneOfRefTypes.join(" | ")}>)` : ""}${anyOfRefTypes ? ` & (${anyOfRefTypes.join(" | ")})` : ""}`.replace(/^ & /, ""),
|
|
13613
13938
|
};
|
|
13614
13939
|
}
|
|
13615
13940
|
if (!(opts.inlineRefs ?? false) && schema.$ref) {
|
|
@@ -13626,10 +13951,16 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13626
13951
|
return {
|
|
13627
13952
|
type: builtType.type,
|
|
13628
13953
|
value: (opts.inlineRefs ?? false) ?
|
|
13629
|
-
`${(allOfRefTypes || oneOfRefTypes || oneOfNonRefTypes || allOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType.value) ? "" : `(${builtType.value})`}${inlineRefTypes.allOf || allOfNonRefTypes ?
|
|
13954
|
+
`${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes || oneOfNonRefTypes || allOfNonRefTypes || anyOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType.value) ? "" : `(${builtType.value})`}${inlineRefTypes.allOf || allOfNonRefTypes ?
|
|
13630
13955
|
` & ${[...(inlineRefTypes.allOf ?? []), ...(allOfNonRefTypes ?? [])].join(" & ")}`
|
|
13631
|
-
: ""}${inlineRefTypes.oneOf || oneOfNonRefTypes ?
|
|
13632
|
-
|
|
13956
|
+
: ""}${inlineRefTypes.oneOf || oneOfNonRefTypes ?
|
|
13957
|
+
` & (ExclusifyUnion<${[...(inlineRefTypes.oneOf ?? []), ...(oneOfNonRefTypes ?? [])].join(" | ")}>)`
|
|
13958
|
+
: ""}${inlineRefTypes.anyOf || anyOfNonRefTypes ?
|
|
13959
|
+
` & (${[...(inlineRefTypes.anyOf ?? []), ...(anyOfNonRefTypes ?? [])].join(" | ")})`
|
|
13960
|
+
: ""}`.replace(/^ & /, "")
|
|
13961
|
+
: `${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes || oneOfNonRefTypes || allOfNonRefTypes || anyOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType.value) ? "" : `(${builtType.value})`}${allOfRefTypes || allOfNonRefTypes ? ` & ${[...(allOfRefTypes ?? []), ...(allOfNonRefTypes ?? [])].join(" & ")}` : ""}${oneOfRefTypes || oneOfNonRefTypes ?
|
|
13962
|
+
` & (ExclusifyUnion<${[...(oneOfRefTypes ?? []), ...(oneOfNonRefTypes ?? [])].join(" | ")}>)`
|
|
13963
|
+
: ""}${anyOfRefTypes || anyOfNonRefTypes ? ` & (${[...(anyOfRefTypes ?? []), ...(anyOfNonRefTypes ?? [])].join(" | ")})` : ""}`.replace(/^ & /, ""),
|
|
13633
13964
|
};
|
|
13634
13965
|
}
|
|
13635
13966
|
function buildBuiltTypeForTag(tagType, schema, indent, opts, ctx) {
|
|
@@ -13922,6 +14253,16 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13922
14253
|
}
|
|
13923
14254
|
}
|
|
13924
14255
|
}
|
|
14256
|
+
let anyOfRefTypes = undefined;
|
|
14257
|
+
if (!(opts.inlineRefs ?? false) && schema.anyOf !== undefined) {
|
|
14258
|
+
const refAnyOfs = schema.anyOf.filter((ref) => typeof ref === "object" && !!ref.$ref);
|
|
14259
|
+
if (refAnyOfs.length > 0) {
|
|
14260
|
+
anyOfRefTypes ??= [];
|
|
14261
|
+
for (const refAnyOf of refAnyOfs) {
|
|
14262
|
+
anyOfRefTypes.push(resolveSchemaRefName(refAnyOf.$ref, !(opts.inlineRefs ?? false), opts));
|
|
14263
|
+
}
|
|
14264
|
+
}
|
|
14265
|
+
}
|
|
13925
14266
|
let allOfNonRefTypes = undefined;
|
|
13926
14267
|
if (schema.allOf !== undefined) {
|
|
13927
14268
|
const nonRefAllOfs = schema.allOf.filter((ref) => typeof ref !== "object" || ref.$ref === undefined);
|
|
@@ -13952,9 +14293,25 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13952
14293
|
}
|
|
13953
14294
|
}
|
|
13954
14295
|
}
|
|
14296
|
+
let anyOfNonRefTypes = undefined;
|
|
14297
|
+
if (schema.anyOf !== undefined) {
|
|
14298
|
+
const nonRefAnyOfs = schema.anyOf.filter((ref) => typeof ref !== "object" || ref.$ref === undefined);
|
|
14299
|
+
if (nonRefAnyOfs.length > 0) {
|
|
14300
|
+
anyOfNonRefTypes ??= [];
|
|
14301
|
+
for (const nonRefAnyOf of nonRefAnyOfs) {
|
|
14302
|
+
const types = nonRefAnyOf.type ?? resolvedSchema.type;
|
|
14303
|
+
if (!types)
|
|
14304
|
+
continue;
|
|
14305
|
+
anyOfNonRefTypes.push(Array.isArray(types) ?
|
|
14306
|
+
types.map((t) => buildTypeForTag(t, nonRefAnyOf, indent, opts, ctx)).join("|")
|
|
14307
|
+
: buildTypeForTag(types, nonRefAnyOf, indent, opts, ctx));
|
|
14308
|
+
}
|
|
14309
|
+
}
|
|
14310
|
+
}
|
|
13955
14311
|
const inlineRefTypes = {
|
|
13956
14312
|
allOf: [],
|
|
13957
14313
|
oneOf: [],
|
|
14314
|
+
anyOf: [],
|
|
13958
14315
|
};
|
|
13959
14316
|
if (opts.inlineRefs ?? false) {
|
|
13960
14317
|
if (allOfRefTypes)
|
|
@@ -13981,13 +14338,25 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13981
14338
|
.join("|")
|
|
13982
14339
|
: buildBuiltTypeForTag(types, refLookup[refType], indent, opts, ctx).value);
|
|
13983
14340
|
}
|
|
14341
|
+
if (anyOfRefTypes)
|
|
14342
|
+
for (const refType of anyOfRefTypes) {
|
|
14343
|
+
const types = refLookup[refType].type ?? resolvedSchema.type;
|
|
14344
|
+
if (!types)
|
|
14345
|
+
continue;
|
|
14346
|
+
inlineRefTypes.anyOf.push(Array.isArray(types) ?
|
|
14347
|
+
types
|
|
14348
|
+
.map((t) => buildBuiltTypeForTag(t, refLookup[refType], indent, opts, ctx)
|
|
14349
|
+
.value)
|
|
14350
|
+
.join("|")
|
|
14351
|
+
: buildBuiltTypeForTag(types, refLookup[refType], indent, opts, ctx).value);
|
|
14352
|
+
}
|
|
13984
14353
|
}
|
|
13985
14354
|
if (!st) {
|
|
13986
14355
|
if (resolvedSchema.properties) {
|
|
13987
14356
|
const compoundType = buildTypeForTag("compound", resolvedSchema, indent, opts, ctx);
|
|
13988
14357
|
return (opts.inlineRefs ?? false) ?
|
|
13989
|
-
`${(allOfRefTypes || oneOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType) ? "" : `(${compoundType})`}${inlineRefTypes.allOf ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf ? ` & (
|
|
13990
|
-
: `${(allOfRefTypes || oneOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType) ? "" : `(${compoundType})`}${allOfRefTypes ? ` & ${allOfRefTypes.join(" & ")}` : ""}${oneOfRefTypes ? ` & (
|
|
14358
|
+
`${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType) ? "" : `(${compoundType})`}${inlineRefTypes.allOf ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf ? ` & (ExclusifyUnion<${inlineRefTypes.oneOf.join(" | ")}>)` : ""}${inlineRefTypes.anyOf ? ` & (${inlineRefTypes.anyOf.join(" | ")})` : ""}`
|
|
14359
|
+
: `${(allOfRefTypes || oneOfRefTypes || anyOfRefTypes) && /^(?:\{\s*\}|object)$/.test(compoundType) ? "" : `(${compoundType})`}${allOfRefTypes ? ` & ${allOfRefTypes.join(" & ")}` : ""}${oneOfRefTypes ? ` & (ExclusifyUnion<${oneOfRefTypes.join(" | ")}>)` : ""}${anyOfRefTypes ? ` & (${anyOfRefTypes.join(" | ")})` : ""}`.replace(/^ & /, "");
|
|
13991
14360
|
}
|
|
13992
14361
|
if (!(opts.inlineRefs ?? false) && schema.$ref) {
|
|
13993
14362
|
const refType = refLookup[resolveSchemaRefName(schema.$ref, false, opts)]
|
|
@@ -13998,8 +14367,10 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
13998
14367
|
}
|
|
13999
14368
|
const builtType = buildTypeForTag(st, resolvedSchema, indent, opts, ctx);
|
|
14000
14369
|
return (opts.inlineRefs ?? false) ?
|
|
14001
|
-
`${(allOfRefTypes || oneOfRefTypes || allOfNonRefTypes || oneOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType) ? "" : `(${builtType})`}${inlineRefTypes.allOf || allOfNonRefTypes ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf || oneOfNonRefTypes ? ` & (
|
|
14002
|
-
: `${(allOfRefTypes || oneOfRefTypes || allOfNonRefTypes || oneOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType) ? "" : `(${builtType})`}${allOfRefTypes || allOfNonRefTypes ? ` & ${[...(allOfRefTypes ?? []), ...(allOfNonRefTypes ?? [])].join(" & ")}` : ""}${oneOfRefTypes || oneOfNonRefTypes ?
|
|
14370
|
+
`${(allOfRefTypes || oneOfRefTypes || allOfNonRefTypes || oneOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType) ? "" : `(${builtType})`}${inlineRefTypes.allOf || allOfNonRefTypes ? ` & ${inlineRefTypes.allOf.join(" & ")}` : ""}${inlineRefTypes.oneOf || oneOfNonRefTypes ? ` & (ExclusifyUnion<${inlineRefTypes.oneOf.join(" | ")}>)` : ""}${inlineRefTypes.anyOf || anyOfNonRefTypes ? ` & (${inlineRefTypes.anyOf.join(" | ")})` : ""}`.replace(/^ & /, "")
|
|
14371
|
+
: `${(allOfRefTypes || oneOfRefTypes || allOfNonRefTypes || oneOfNonRefTypes) && /^(?:\{\s*\}|object)$/.test(builtType) ? "" : `(${builtType})`}${allOfRefTypes || allOfNonRefTypes ? ` & ${[...(allOfRefTypes ?? []), ...(allOfNonRefTypes ?? [])].join(" & ")}` : ""}${oneOfRefTypes || oneOfNonRefTypes ?
|
|
14372
|
+
` & (ExclusifyUnion<${[...(oneOfRefTypes ?? []), ...(oneOfNonRefTypes ?? [])].join(" | ")}>)`
|
|
14373
|
+
: ""}${anyOfRefTypes || anyOfNonRefTypes ? ` & (${[...(anyOfRefTypes ?? []), ...(anyOfNonRefTypes ?? [])].join(" | ")})` : ""}`.replace(/^ & /, "");
|
|
14003
14374
|
}
|
|
14004
14375
|
/**
|
|
14005
14376
|
* Generates a TypeScript type from a top-level {@link NBTSchema} or {@link NBTSchemaFragment}.
|
|
@@ -14173,6 +14544,7 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
14173
14544
|
.replace(/\{\{needs testing\}\}/gi, " *needs testing*")
|
|
14174
14545
|
// Replace {{code|...}} with `...`
|
|
14175
14546
|
.replace(/\{\{code\|([^}]*)\}\}/gi, "`$1`")
|
|
14547
|
+
// TODO: The below two replacements should replace spaces in the URL with underscores.
|
|
14176
14548
|
// Replace [[target|label]] with [label](https://minecraft.wiki/w/target)
|
|
14177
14549
|
.replace(/\[\[([^\]|]+)\|([^\]]+)\]\]/g, "[$2](https://minecraft.wiki/w/$1)")
|
|
14178
14550
|
// Replace [[target]] with [target](https://minecraft.wiki/w/target)
|
|
@@ -14491,16 +14863,17 @@ pillager outpost or witch hut; for most structures, this is \`0\`.`,
|
|
|
14491
14863
|
* @returns An array of NBT schemas.
|
|
14492
14864
|
*/
|
|
14493
14865
|
function extractNBTSchemasFromFullWikiNBTPageData(input, options = {}) {
|
|
14866
|
+
input = input.replaceAll(/^\{\{in\|bedrock\}\}/gm, "In [[Bedrock Edition]]").replaceAll(/\{\{in\|bedrock\}\}/g, "in [[Bedrock Edition]]");
|
|
14494
14867
|
const containers = input.match(/(?<=(^|\n)<div class="treeview">\s*).+?\n(?=<\/div>($|\n))/gs);
|
|
14495
14868
|
if (!containers)
|
|
14496
14869
|
return [];
|
|
14497
14870
|
const schemas = [];
|
|
14498
14871
|
for (const container of containers) {
|
|
14499
14872
|
// console.log(1.792, container);
|
|
14500
|
-
if (!/(?<=(^|\n)===? (?<header>[^\n]+?) ===?\s*?\n(?:(?<description
|
|
14873
|
+
if (!/(?<=(^|\n)===? (?<header>[^\n]+?) ===?\s*?\n(?:(?<description>(?:\w|\[)[^\n]*?)\n{1,2})?)(?<schema>\*[^\n]+?(?:\n\*[^\n]+?|\n\w[^\n]+?)+?)(?=\n+?(?:===? [^\n]+? ===?\n)*?===? [^\n]+? ===?\s*?\n(?:\w[^\n]*?\n)?|\s*?$)/.test(container))
|
|
14501
14874
|
continue;
|
|
14502
14875
|
// console.log(2.792);
|
|
14503
|
-
const schemaSubContainers = container.matchAll(/(?<=(^|\n)===? (?<header>[^\n]+?) ===?\s*?\n(?:(?<description
|
|
14876
|
+
const schemaSubContainers = container.matchAll(/(?<=(^|\n)===? (?<header>[^\n]+?) ===?\s*?\n(?:(?<description>(?:\w|\[)[^\n]*?)\n{1,2})?)(?<schema>\*[^\n]+?(?:\n\*[^\n]+?|\n\w[^\n]+?)+?)(?=\n+?(?:===? [^\n]+? ===?\n)*?===? [^\n]+? ===?\s*?\n(?:\w[^\n]*?\n)?|\s*?$)/g);
|
|
14504
14877
|
for (const schemaSubContainer of schemaSubContainers) {
|
|
14505
14878
|
// console.log(3.792, schemaSubContainer);
|
|
14506
14879
|
const header = schemaSubContainer.groups.header;
|