minecraft-data 3.97.0 → 3.99.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/data.js +54 -5
- package/doc/history.md +8 -0
- package/index.d.ts +72 -63
- package/minecraft-data/.github/copilot-instructions.md +63 -0
- package/minecraft-data/.github/helper-bot/handleMcpcGeneratedArtifacts.js +113 -0
- package/minecraft-data/.github/helper-bot/index.js +46 -41
- package/minecraft-data/.github/helper-bot/package.json +11 -0
- package/minecraft-data/.github/helper-bot/utils.js +50 -0
- package/minecraft-data/.github/workflows/bedrock-ci.yml +3 -2
- package/minecraft-data/.github/workflows/handle-mcpc-generator.yml +39 -0
- package/minecraft-data/.github/workflows/update-helper.yml +4 -3
- package/minecraft-data/README.md +2 -2
- package/minecraft-data/data/bedrock/1.21.100/proto.yml +4573 -0
- package/minecraft-data/data/bedrock/1.21.100/protocol.json +2 -2
- package/minecraft-data/data/bedrock/1.21.100/types.yml +2841 -0
- package/minecraft-data/data/bedrock/1.21.111/proto.yml +4573 -0
- package/minecraft-data/data/bedrock/1.21.111/protocol.json +14380 -0
- package/minecraft-data/data/bedrock/1.21.111/types.yml +2841 -0
- package/minecraft-data/data/bedrock/1.21.111/version.json +6 -0
- package/minecraft-data/data/bedrock/common/protocolVersions.json +6 -0
- package/minecraft-data/data/bedrock/common/versions.json +2 -1
- package/minecraft-data/data/bedrock/latest/proto.yml +37 -30
- package/minecraft-data/data/bedrock/latest/types.yml +160 -154
- package/minecraft-data/data/dataPaths.json +55 -6
- package/minecraft-data/data/pc/1.21.6/proto.yml +3494 -0
- package/minecraft-data/data/pc/1.21.8/attributes.json +247 -0
- package/minecraft-data/data/pc/1.21.8/biomes.json +652 -0
- package/minecraft-data/data/pc/1.21.8/blockCollisionShapes.json +142541 -0
- package/minecraft-data/data/pc/1.21.8/blocks.json +41358 -0
- package/minecraft-data/data/pc/1.21.8/effects.json +236 -0
- package/minecraft-data/data/pc/1.21.8/enchantments.json +959 -0
- package/minecraft-data/data/pc/1.21.8/entities.json +4176 -0
- package/minecraft-data/data/pc/1.21.8/foods.json +402 -0
- package/minecraft-data/data/pc/1.21.8/instruments.json +94 -0
- package/minecraft-data/data/pc/1.21.8/items.json +9284 -0
- package/minecraft-data/data/pc/1.21.8/language.json +7394 -0
- package/minecraft-data/data/pc/1.21.8/materials.json +206 -0
- package/minecraft-data/data/pc/1.21.8/particles.json +458 -0
- package/minecraft-data/data/pc/1.21.8/protocol.json +10249 -0
- package/minecraft-data/data/pc/1.21.8/recipes.json +30473 -0
- package/minecraft-data/data/pc/1.21.8/sounds.json +6914 -0
- package/minecraft-data/data/pc/1.21.8/tints.json +465 -0
- package/minecraft-data/data/pc/1.21.8/version.json +6 -0
- package/minecraft-data/data/pc/common/protocolVersions.json +96 -0
- package/minecraft-data/data/pc/common/versions.json +6 -2
- package/minecraft-data/data/pc/latest/proto.yml +1 -1
- package/minecraft-data/doc/history.md +21 -0
- package/minecraft-data/schemas/blockMappings_schema.json +24 -34
- package/minecraft-data/schemas/commands_schema.json +13 -7
- package/minecraft-data/schemas/tints_schema.json +37 -128
- package/minecraft-data/tools/js/extractPcEntityMetadata.js +160 -102
- package/minecraft-data/tools/js/test/audit_versions.js +48 -0
- package/minecraft-data/tools/js/test/test.js +6 -0
- package/package.json +1 -1
package/data.js
CHANGED
|
@@ -1611,6 +1611,33 @@ module.exports =
|
|
|
1611
1611
|
get tints () { return require("./minecraft-data/data/pc/1.21.6/tints.json") },
|
|
1612
1612
|
get version () { return require("./minecraft-data/data/pc/1.21.6/version.json") },
|
|
1613
1613
|
get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
|
|
1614
|
+
proto: __dirname + '/minecraft-data/data/pc/1.21.6/proto.yml'
|
|
1615
|
+
},
|
|
1616
|
+
'1.21.8': {
|
|
1617
|
+
get attributes () { return require("./minecraft-data/data/pc/1.21.8/attributes.json") },
|
|
1618
|
+
get blockCollisionShapes () { return require("./minecraft-data/data/pc/1.21.8/blockCollisionShapes.json") },
|
|
1619
|
+
get blocks () { return require("./minecraft-data/data/pc/1.21.8/blocks.json") },
|
|
1620
|
+
get blockLoot () { return require("./minecraft-data/data/pc/1.20/blockLoot.json") },
|
|
1621
|
+
get biomes () { return require("./minecraft-data/data/pc/1.21.8/biomes.json") },
|
|
1622
|
+
get commands () { return require("./minecraft-data/data/pc/1.20.3/commands.json") },
|
|
1623
|
+
get effects () { return require("./minecraft-data/data/pc/1.21.8/effects.json") },
|
|
1624
|
+
get enchantments () { return require("./minecraft-data/data/pc/1.21.8/enchantments.json") },
|
|
1625
|
+
get entities () { return require("./minecraft-data/data/pc/1.21.8/entities.json") },
|
|
1626
|
+
get entityLoot () { return require("./minecraft-data/data/pc/1.20/entityLoot.json") },
|
|
1627
|
+
get foods () { return require("./minecraft-data/data/pc/1.21.8/foods.json") },
|
|
1628
|
+
get instruments () { return require("./minecraft-data/data/pc/1.21.8/instruments.json") },
|
|
1629
|
+
get items () { return require("./minecraft-data/data/pc/1.21.8/items.json") },
|
|
1630
|
+
get language () { return require("./minecraft-data/data/pc/1.21.8/language.json") },
|
|
1631
|
+
get loginPacket () { return require("./minecraft-data/data/pc/1.21.3/loginPacket.json") },
|
|
1632
|
+
get mapIcons () { return require("./minecraft-data/data/pc/1.20.2/mapIcons.json") },
|
|
1633
|
+
get materials () { return require("./minecraft-data/data/pc/1.21.8/materials.json") },
|
|
1634
|
+
get particles () { return require("./minecraft-data/data/pc/1.21.8/particles.json") },
|
|
1635
|
+
get protocol () { return require("./minecraft-data/data/pc/1.21.8/protocol.json") },
|
|
1636
|
+
get recipes () { return require("./minecraft-data/data/pc/1.21.8/recipes.json") },
|
|
1637
|
+
get sounds () { return require("./minecraft-data/data/pc/1.21.8/sounds.json") },
|
|
1638
|
+
get tints () { return require("./minecraft-data/data/pc/1.21.8/tints.json") },
|
|
1639
|
+
get version () { return require("./minecraft-data/data/pc/1.21.8/version.json") },
|
|
1640
|
+
get windows () { return require("./minecraft-data/data/pc/1.16.1/windows.json") },
|
|
1614
1641
|
proto: __dirname + '/minecraft-data/data/pc/latest/proto.yml'
|
|
1615
1642
|
}
|
|
1616
1643
|
},
|
|
@@ -2494,7 +2521,7 @@ module.exports =
|
|
|
2494
2521
|
get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
|
|
2495
2522
|
get protocol () { return require("./minecraft-data/data/bedrock/1.21.80/protocol.json") },
|
|
2496
2523
|
get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
|
|
2497
|
-
get steve () { return require("./minecraft-data/data/bedrock/1.21.
|
|
2524
|
+
get steve () { return require("./minecraft-data/data/bedrock/1.21.70/steve.json") },
|
|
2498
2525
|
get blocksB2J () { return require("./minecraft-data/data/bedrock/1.21.80/blocksB2J.json") },
|
|
2499
2526
|
get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.21.80/blocksJ2B.json") },
|
|
2500
2527
|
proto: __dirname + '/minecraft-data/data/bedrock/1.21.80/proto.yml',
|
|
@@ -2516,7 +2543,7 @@ module.exports =
|
|
|
2516
2543
|
get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
|
|
2517
2544
|
get protocol () { return require("./minecraft-data/data/bedrock/1.21.90/protocol.json") },
|
|
2518
2545
|
get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
|
|
2519
|
-
get steve () { return require("./minecraft-data/data/bedrock/1.21.
|
|
2546
|
+
get steve () { return require("./minecraft-data/data/bedrock/1.21.70/steve.json") },
|
|
2520
2547
|
get blocksB2J () { return require("./minecraft-data/data/bedrock/1.21.80/blocksB2J.json") },
|
|
2521
2548
|
get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.21.80/blocksJ2B.json") },
|
|
2522
2549
|
proto: __dirname + '/minecraft-data/data/bedrock/1.21.90/proto.yml',
|
|
@@ -2538,7 +2565,7 @@ module.exports =
|
|
|
2538
2565
|
get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
|
|
2539
2566
|
get protocol () { return require("./minecraft-data/data/bedrock/1.21.93/protocol.json") },
|
|
2540
2567
|
get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
|
|
2541
|
-
get steve () { return require("./minecraft-data/data/bedrock/1.21.
|
|
2568
|
+
get steve () { return require("./minecraft-data/data/bedrock/1.21.70/steve.json") },
|
|
2542
2569
|
get blocksB2J () { return require("./minecraft-data/data/bedrock/1.21.80/blocksB2J.json") },
|
|
2543
2570
|
get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.21.80/blocksJ2B.json") },
|
|
2544
2571
|
proto: __dirname + '/minecraft-data/data/bedrock/1.21.93/proto.yml',
|
|
@@ -2560,13 +2587,35 @@ module.exports =
|
|
|
2560
2587
|
get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
|
|
2561
2588
|
get protocol () { return require("./minecraft-data/data/bedrock/1.21.100/protocol.json") },
|
|
2562
2589
|
get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
|
|
2563
|
-
get steve () { return require("./minecraft-data/data/bedrock/1.21.
|
|
2590
|
+
get steve () { return require("./minecraft-data/data/bedrock/1.21.70/steve.json") },
|
|
2564
2591
|
get blocksB2J () { return require("./minecraft-data/data/bedrock/1.21.80/blocksB2J.json") },
|
|
2565
2592
|
get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.21.80/blocksJ2B.json") },
|
|
2566
|
-
proto: __dirname + '/minecraft-data/data/bedrock/
|
|
2593
|
+
proto: __dirname + '/minecraft-data/data/bedrock/1.21.100/proto.yml',
|
|
2567
2594
|
types: __dirname + '/minecraft-data/data/bedrock/latest/types.yml',
|
|
2568
2595
|
get version () { return require("./minecraft-data/data/bedrock/1.21.100/version.json") },
|
|
2569
2596
|
get language () { return require("./minecraft-data/data/bedrock/1.21.70/language.json") }
|
|
2597
|
+
},
|
|
2598
|
+
'1.21.111': {
|
|
2599
|
+
get blocks () { return require("./minecraft-data/data/bedrock/1.21.90/blocks.json") },
|
|
2600
|
+
get blockStates () { return require("./minecraft-data/data/bedrock/1.21.80/blockStates.json") },
|
|
2601
|
+
get blockCollisionShapes () { return require("./minecraft-data/data/bedrock/1.21.90/blockCollisionShapes.json") },
|
|
2602
|
+
get biomes () { return require("./minecraft-data/data/bedrock/1.21.60/biomes.json") },
|
|
2603
|
+
get entities () { return require("./minecraft-data/data/bedrock/1.21.80/entities.json") },
|
|
2604
|
+
get items () { return require("./minecraft-data/data/bedrock/1.21.90/items.json") },
|
|
2605
|
+
get recipes () { return require("./minecraft-data/data/bedrock/1.19.10/recipes.json") },
|
|
2606
|
+
get instruments () { return require("./minecraft-data/data/bedrock/1.17.0/instruments.json") },
|
|
2607
|
+
get materials () { return require("./minecraft-data/data/pc/1.17/materials.json") },
|
|
2608
|
+
get enchantments () { return require("./minecraft-data/data/bedrock/1.19.1/enchantments.json") },
|
|
2609
|
+
get effects () { return require("./minecraft-data/data/pc/1.17/effects.json") },
|
|
2610
|
+
get protocol () { return require("./minecraft-data/data/bedrock/1.21.111/protocol.json") },
|
|
2611
|
+
get windows () { return require("./minecraft-data/data/bedrock/1.16.201/windows.json") },
|
|
2612
|
+
get steve () { return require("./minecraft-data/data/bedrock/1.21.70/steve.json") },
|
|
2613
|
+
get blocksB2J () { return require("./minecraft-data/data/bedrock/1.21.80/blocksB2J.json") },
|
|
2614
|
+
get blocksJ2B () { return require("./minecraft-data/data/bedrock/1.21.80/blocksJ2B.json") },
|
|
2615
|
+
proto: __dirname + '/minecraft-data/data/bedrock/latest/proto.yml',
|
|
2616
|
+
types: __dirname + '/minecraft-data/data/bedrock/latest/types.yml',
|
|
2617
|
+
get version () { return require("./minecraft-data/data/bedrock/1.21.111/version.json") },
|
|
2618
|
+
get language () { return require("./minecraft-data/data/bedrock/1.21.70/language.json") }
|
|
2570
2619
|
}
|
|
2571
2620
|
}
|
|
2572
2621
|
}
|
package/doc/history.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -208,27 +208,44 @@ declare namespace MinecraftData {
|
|
|
208
208
|
}
|
|
209
209
|
|
|
210
210
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
];
|
|
211
|
+
/**
|
|
212
|
+
* Maps block names and states between PC and PE (Bedrock) versions.
|
|
213
|
+
*/
|
|
214
|
+
type BlockMappings = {
|
|
215
|
+
pc: BlockRef;
|
|
216
|
+
pe: BlockRef1;
|
|
217
|
+
}[];
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* PC (Java Edition) block reference.
|
|
221
|
+
*/
|
|
222
|
+
interface BlockRef {
|
|
223
|
+
/**
|
|
224
|
+
* The block's unique name identifier.
|
|
225
|
+
*/
|
|
226
|
+
name: string;
|
|
227
|
+
/**
|
|
228
|
+
* The block's state properties as key-value pairs.
|
|
229
|
+
*/
|
|
230
|
+
states: {
|
|
231
|
+
[k: string]: unknown;
|
|
232
|
+
};
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* PE (Bedrock Edition) block reference.
|
|
236
|
+
*/
|
|
237
|
+
interface BlockRef1 {
|
|
238
|
+
/**
|
|
239
|
+
* The block's unique name identifier.
|
|
240
|
+
*/
|
|
241
|
+
name: string;
|
|
242
|
+
/**
|
|
243
|
+
* The block's state properties as key-value pairs.
|
|
244
|
+
*/
|
|
245
|
+
states: {
|
|
246
|
+
[k: string]: unknown;
|
|
247
|
+
};
|
|
248
|
+
}
|
|
232
249
|
|
|
233
250
|
|
|
234
251
|
type Blocks = Block[];
|
|
@@ -350,9 +367,8 @@ declare namespace MinecraftData {
|
|
|
350
367
|
|
|
351
368
|
|
|
352
369
|
interface HttpsExampleComPersonSchemaJson {
|
|
353
|
-
|
|
370
|
+
root: RootNode;
|
|
354
371
|
parsers: ParserInfo[];
|
|
355
|
-
[k: string]: unknown;
|
|
356
372
|
}
|
|
357
373
|
interface RootNode {
|
|
358
374
|
type: "root";
|
|
@@ -360,7 +376,6 @@ declare namespace MinecraftData {
|
|
|
360
376
|
executable: boolean;
|
|
361
377
|
redirects: string[];
|
|
362
378
|
children: (LiteralNode | ArgumentNode)[];
|
|
363
|
-
[k: string]: unknown;
|
|
364
379
|
}
|
|
365
380
|
interface LiteralNode {
|
|
366
381
|
type: "literal";
|
|
@@ -368,7 +383,6 @@ declare namespace MinecraftData {
|
|
|
368
383
|
executable: boolean;
|
|
369
384
|
redirects: string[];
|
|
370
385
|
children: (LiteralNode | ArgumentNode)[];
|
|
371
|
-
[k: string]: unknown;
|
|
372
386
|
}
|
|
373
387
|
interface ArgumentNode {
|
|
374
388
|
type: "argument";
|
|
@@ -381,9 +395,7 @@ declare namespace MinecraftData {
|
|
|
381
395
|
modifier?: {
|
|
382
396
|
[k: string]: unknown;
|
|
383
397
|
} | null;
|
|
384
|
-
[k: string]: unknown;
|
|
385
398
|
};
|
|
386
|
-
[k: string]: unknown;
|
|
387
399
|
}
|
|
388
400
|
interface ParserInfo {
|
|
389
401
|
parser: string;
|
|
@@ -391,7 +403,6 @@ declare namespace MinecraftData {
|
|
|
391
403
|
[k: string]: unknown;
|
|
392
404
|
} | null;
|
|
393
405
|
examples: string[];
|
|
394
|
-
[k: string]: unknown;
|
|
395
406
|
}
|
|
396
407
|
|
|
397
408
|
|
|
@@ -903,41 +914,39 @@ declare namespace MinecraftData {
|
|
|
903
914
|
|
|
904
915
|
|
|
905
916
|
interface Tints {
|
|
906
|
-
grass
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
default?: number;
|
|
940
|
-
};
|
|
917
|
+
grass: StringKeyTintGroup;
|
|
918
|
+
foliage: StringKeyTintGroup;
|
|
919
|
+
water: StringKeyTintGroup;
|
|
920
|
+
redstone: IntegerKeyTintGroup;
|
|
921
|
+
constant: StringKeyTintGroup;
|
|
922
|
+
}
|
|
923
|
+
interface StringKeyTintGroup {
|
|
924
|
+
/**
|
|
925
|
+
* @minItems 1
|
|
926
|
+
*/
|
|
927
|
+
data: [StringKeyTintEntry, ...StringKeyTintEntry[]];
|
|
928
|
+
default?: number;
|
|
929
|
+
}
|
|
930
|
+
interface StringKeyTintEntry {
|
|
931
|
+
/**
|
|
932
|
+
* @minItems 1
|
|
933
|
+
*/
|
|
934
|
+
keys: [string, ...string[]];
|
|
935
|
+
color: number;
|
|
936
|
+
}
|
|
937
|
+
interface IntegerKeyTintGroup {
|
|
938
|
+
/**
|
|
939
|
+
* @minItems 1
|
|
940
|
+
*/
|
|
941
|
+
data: [IntegerKeyTintEntry, ...IntegerKeyTintEntry[]];
|
|
942
|
+
default?: number;
|
|
943
|
+
}
|
|
944
|
+
interface IntegerKeyTintEntry {
|
|
945
|
+
/**
|
|
946
|
+
* @minItems 1
|
|
947
|
+
*/
|
|
948
|
+
keys: [number, ...number[]];
|
|
949
|
+
color: number;
|
|
941
950
|
}
|
|
942
951
|
|
|
943
952
|
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
PrismarineJS/minecraft-data holds Minecraft data including game versions, protocol schemas, block/item/entity states, and more. It provides a comprehensive cross-language set of data files combined with schemas that can be consumed in any language.
|
|
2
|
+
|
|
3
|
+
## Directory Structure
|
|
4
|
+
- `.github/`
|
|
5
|
+
- `workflows/`
|
|
6
|
+
- `ci.yml` -- Runs CI here (cd tools/js && npm install && npm test)
|
|
7
|
+
- `bedrock-ci.yml` -- Runs CI for Bedrock Edition via workflow dispatch to PrismarineJS/bedrock-protocol. This allows for testing and validation of Bedrock-specific changes.
|
|
8
|
+
- `commands.yml` -- Slash commands
|
|
9
|
+
- `handleMcpcGeneratedArtifacts.js`
|
|
10
|
+
- `helper-bot/` -- Files for the GitHub Actions cron helper.
|
|
11
|
+
- `data/`
|
|
12
|
+
- `dataPaths.json` -- map of { ['pc' | 'bedrock']: { '$version': { 'dataType': 'folderPath' } } }
|
|
13
|
+
- `[pc | bedrock]/` -- Minecraft Java Edition data
|
|
14
|
+
- `1.20/` -- Versioned data for Minecraft Java Edition 1.20
|
|
15
|
+
- `$version/` -- Versioned data for Minecraft Java Edition $version
|
|
16
|
+
- `common/` -- Common data for all Minecraft Java Edition versions
|
|
17
|
+
- `protocolVersions.json` -- List of protocol versions for Minecraft Java Edition
|
|
18
|
+
- `latest/` -- This holds the latest protocol yaml files. They are used to generate the protocol.json files in each versioned folder (more on this below).
|
|
19
|
+
- `schemas/` -- JSON schemas for validating data files
|
|
20
|
+
- `tools/js` -- JavaScript utilities for working with repo (holds tests, some data generators and helper scripts)
|
|
21
|
+
|
|
22
|
+
## Setup
|
|
23
|
+
No setup is needed as we just hold data. To set up the development environment that runs tests, run the following commands:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
cd tools/js
|
|
27
|
+
npm install
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
This will ensure all data matches schema among other checks.
|
|
31
|
+
|
|
32
|
+
There are no 'releases' in this repo beyond updating the data itself. Instead, we have a workflow that will automatically create tagged releases if the user runs the /makerelease slash command, so you can inform the user about that if a release is needed.
|
|
33
|
+
|
|
34
|
+
## Data
|
|
35
|
+
|
|
36
|
+
Most data is generated with data generators. For mcpc, data is generated with [minecraft-data-generator](https://github.com/PrismarineJS/minecraft-data-generator).
|
|
37
|
+
|
|
38
|
+
Avoid updating data manually unless necessary, like when specific data is not automated yet (for tips on what is and not, see doc/add-data-new-version.md). Instead, update the data generators or add new ones as needed. Since you don't have capability to make changes outside this repo, please inform the user what changes need to be made and be as detailed as possible.
|
|
39
|
+
|
|
40
|
+
Note we do not currently have any automation setup to generate bedrock edition data.
|
|
41
|
+
|
|
42
|
+
## Github Workflows
|
|
43
|
+
|
|
44
|
+
### Automation
|
|
45
|
+
|
|
46
|
+
Our GH Actions workflow (.github/helper-bot) auto updates the pc protocolVersions.json with new detected versions and also auto opens a scaffolding PR.
|
|
47
|
+
|
|
48
|
+
cron workflow .github/workflows/update-helper.yml -> .github/helper-bot/.
|
|
49
|
+
|
|
50
|
+
helper-bot dispatches to minecraft-data-generator so that it can run data generators for new versions. minecraft-data-generator then sends a workflow dispatch back to us so we can then take its generated artifacts and commit them here.
|
|
51
|
+
|
|
52
|
+
.github/workflows/handle-mcpc-generator.yml ->
|
|
53
|
+
.github/helper-bot/handleMcpcGeneratedArtifacts.js
|
|
54
|
+
|
|
55
|
+
## Notes
|
|
56
|
+
Not all data is generated. Some data (like protocol schemas) is manually curated on both pc and bedrock.
|
|
57
|
+
|
|
58
|
+
### Protocol data
|
|
59
|
+
|
|
60
|
+
We use a special yaml-like DSL to generate protocol.json files. Refer to doc/protocol.md for info.
|
|
61
|
+
These files are stored inside proto.yml files in the latest/ folder (like bedrock/latest/proto.yml) for the latest version, otherwise in the versioned folder (like pc/1.20/proto.yml).
|
|
62
|
+
|
|
63
|
+
Notably, run `npm run build` in tools/js to regenerate protocol.json files after making changes to the protocol yaml files. So, don't make changes to protocol.json files directly. Instead, update the relevant proto.yml file in latest/ and regenerate protocol.json by running `npm run build` in tools/js.
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
const fs = require('fs')
|
|
2
|
+
const github = require('gh-helpers')()
|
|
3
|
+
const { join } = require('path')
|
|
4
|
+
const { extractPcEntityMetadata } = require('../../tools/js/extractPcEntityMetadata')
|
|
5
|
+
const { exec, createInitialPR } = require('./utils')
|
|
6
|
+
|
|
7
|
+
const artifactsDir = join(__dirname, './artifacts')
|
|
8
|
+
const root = join(__dirname, '..', '..')
|
|
9
|
+
|
|
10
|
+
async function handle (ourPR, genPullNo, version, artifactURL, shouldPull) {
|
|
11
|
+
const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '_').toLowerCase()
|
|
12
|
+
const branch = ourPR.headBranch || `pc-${branchNameVersion}`
|
|
13
|
+
if (shouldPull) exec('git', ['pull', 'origin'])
|
|
14
|
+
|
|
15
|
+
// if external PR:
|
|
16
|
+
// const branch = ourPR.headBranch
|
|
17
|
+
// exec('git', ['remote', 'add', 'fo', ourPR.headCloneURL])
|
|
18
|
+
// exec('git', ['fetch', 'fo', branch])
|
|
19
|
+
// exec('git', ['checkout', '-b', branch, `fo/` + branch])
|
|
20
|
+
|
|
21
|
+
try {
|
|
22
|
+
exec('git', ['checkout', branch])
|
|
23
|
+
} catch (err) {
|
|
24
|
+
console.error('Error checking out branch:', err)
|
|
25
|
+
process.exit(1)
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const dataPaths = require('../../data/dataPaths.json')
|
|
29
|
+
const dataPath = dataPaths.pc[version]
|
|
30
|
+
|
|
31
|
+
const destDir = join(root, `./data/pc/${version}`)
|
|
32
|
+
if (!fs.existsSync(destDir) || !dataPath) {
|
|
33
|
+
console.warn(`⚠️ Version ${version} not found (checked ${destDir}) ; cannot continue.`, fs.existsSync(destDir), dataPath)
|
|
34
|
+
process.exit(1)
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
if (ourPR.body) {
|
|
38
|
+
await github.updateIssue(ourPR.number, {
|
|
39
|
+
body: ourPR.body.replace('<!--minecraft-data-generator-placeholder-->', `- https://github.com/PrismarineJS/minecraft-data-generator/pull/${genPullNo}`)
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
console.log('Handling PR:', ourPR)
|
|
44
|
+
|
|
45
|
+
fs.mkdirSync(artifactsDir, { recursive: true })
|
|
46
|
+
|
|
47
|
+
// https://github.com/PrismarineJS/minecraft-data-generator/actions/runs/17261281146/artifacts/3861320839
|
|
48
|
+
const s = artifactURL.split('github.com/')[1]
|
|
49
|
+
const [ownerName, repoName, _actions, _runs, _runId, _artifacts, artifactId] = s.split('/') // eslint-disable-line
|
|
50
|
+
console.log('Downloading artifacts', { ownerName, repoName, artifactId, artifactsDir })
|
|
51
|
+
await github.artifacts.downloadIdFrom(ownerName, repoName, artifactId, artifactsDir)
|
|
52
|
+
|
|
53
|
+
console.log(fs.readdirSync(artifactsDir))
|
|
54
|
+
|
|
55
|
+
// Now copy artifacts/${version}/*.json to data/pc/$version/*.json
|
|
56
|
+
const versionArtifactsDir = join(artifactsDir, version)
|
|
57
|
+
for (const file of fs.readdirSync(versionArtifactsDir)) {
|
|
58
|
+
if (file.endsWith('.json')) {
|
|
59
|
+
const src = join(versionArtifactsDir, file)
|
|
60
|
+
const dest = join(destDir, file)
|
|
61
|
+
fs.mkdirSync(destDir, { recursive: true })
|
|
62
|
+
console.log(`copy ${src} => ${dest}`)
|
|
63
|
+
fs.copyFileSync(src, dest)
|
|
64
|
+
dataPath[file.replace('.json', '')] = 'pc/' + version
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
// Commit the new dataPath
|
|
69
|
+
fs.writeFileSync(join(root, 'data', 'dataPaths.json'), JSON.stringify(dataPaths, null, 2))
|
|
70
|
+
|
|
71
|
+
try {
|
|
72
|
+
process.chdir(join(__dirname, '../../tools/js'))
|
|
73
|
+
extractPcEntityMetadata(version, version, { write: true, cloneIfMissing: true })
|
|
74
|
+
} catch (e) {
|
|
75
|
+
console.log('Failed to extract PC entity metadata', e)
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Now, we need to commit the changes
|
|
79
|
+
exec('git', ['config', 'user.name', 'github-actions[bot]'])
|
|
80
|
+
exec('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com'])
|
|
81
|
+
exec('git', ['add', '--all'])
|
|
82
|
+
exec('git', ['commit', '-m', `[Auto] Apply generated data from PrismarineJS/minecraft-data-generator#${genPullNo}`])
|
|
83
|
+
exec('git', ['push', 'origin', branch])
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
async function main (versions, genPullNo, artifactUrl, createPR) {
|
|
87
|
+
const version = versions.at(-1)
|
|
88
|
+
const pr = await github.findPullRequest({ titleIncludes: '🎈', author: null })
|
|
89
|
+
console.log('Found PR', pr)
|
|
90
|
+
if (pr && pr.isOpen) {
|
|
91
|
+
const details = await github.getPullRequest(pr.id)
|
|
92
|
+
console.log('PR', details)
|
|
93
|
+
await handle(details, genPullNo, version, artifactUrl, true)
|
|
94
|
+
} else if (createPR) {
|
|
95
|
+
const pr = await createInitialPR('pc', '(This issue was created for a minecraft-data-generator PR)', {
|
|
96
|
+
version,
|
|
97
|
+
protocolVersion: null
|
|
98
|
+
})
|
|
99
|
+
console.log('Created PR', pr)
|
|
100
|
+
const details = await github.getPullRequest(pr.number)
|
|
101
|
+
console.log('PR', details)
|
|
102
|
+
await handle(details, genPullNo, version, artifactUrl, false)
|
|
103
|
+
} else {
|
|
104
|
+
process.exit(1)
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
main(
|
|
109
|
+
JSON.parse(process.env.TRIGGER_MC_VERSIONS),
|
|
110
|
+
process.env.TRIGGER_PR_NO,
|
|
111
|
+
process.env.TRIGGER_ARTIFACT_URL,
|
|
112
|
+
process.env.CREATE_PR_IF_NONE
|
|
113
|
+
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
+
/* eslint-disable no-return-assign, no-sequences */
|
|
1
2
|
const fs = require('fs')
|
|
2
|
-
const cp = require('child_process')
|
|
3
3
|
const github = require('gh-helpers')()
|
|
4
|
-
const exec = (cmd) => github.mock ? console.log('> ', cmd) : (console.log('> ', cmd), cp.execSync(cmd, { stdio: 'inherit' }))
|
|
5
4
|
const pcManifestURL = 'https://launchermeta.mojang.com/mc/game/version_manifest.json'
|
|
6
5
|
const changelogURL = 'https://feedback.minecraft.net/hc/en-us/sections/360001186971-Release-Changelogs'
|
|
6
|
+
const { exec, createInitialPR } = require('./utils')
|
|
7
7
|
|
|
8
|
-
const download = (url, dest) => exec(
|
|
8
|
+
const download = (url, dest) => exec('curl', ['-L', url, '-o', dest])
|
|
9
9
|
|
|
10
10
|
function buildFirstIssue (title, result, jarData) {
|
|
11
11
|
const protocolVersion = jarData?.protocol_version || 'Failed to obtain from JAR'
|
|
@@ -28,27 +28,13 @@ A new Minecraft Java Edition version is available (as of ${date}), version **${r
|
|
|
28
28
|
<tr><td><b>Data Version</b></td><td>${jarData?.world_version}</td>
|
|
29
29
|
<tr><td><b>Java Version</b></td><td>${jarData?.java_version}</td>
|
|
30
30
|
</table>
|
|
31
|
+
|
|
31
32
|
<hr/>
|
|
32
33
|
🤖 I am a bot, I check for updates every 2 hours without a trigger. You can close this issue to prevent any further updates.
|
|
33
34
|
`
|
|
34
35
|
}
|
|
35
36
|
}
|
|
36
37
|
|
|
37
|
-
async function createInitialPull (edition, issueUrl, { version, protocolVersion }) {
|
|
38
|
-
exec('cd tools/js && npm install')
|
|
39
|
-
exec(`cd tools/js && npm run version ${edition} ${version} ${protocolVersion}`)
|
|
40
|
-
const branchNameVersion = version.replace(/[^a-zA-Z0-9]/g, '.').toLowerCase()
|
|
41
|
-
const branchName = `${edition}-${branchNameVersion}`
|
|
42
|
-
const title = `Initial data for ${edition} ${version}`
|
|
43
|
-
exec(`git checkout -b ${branchName}`)
|
|
44
|
-
exec(`git add --all`)
|
|
45
|
-
exec(`git commit -m "${title}"`)
|
|
46
|
-
exec(`git push origin ${branchName}`)
|
|
47
|
-
// createPullRequest(title: string, body: string, fromBranch: string, intoBranch?: string): Promise<{ number: number, url: string }>;
|
|
48
|
-
const pr = await github.createPullRequest(title, `${title}.\n\nRef: ${issueUrl}`, branchName, 'master')
|
|
49
|
-
return pr
|
|
50
|
-
}
|
|
51
|
-
|
|
52
38
|
const protocolVersions = {
|
|
53
39
|
pc: require('../../data/pc/common/protocolVersions.json'),
|
|
54
40
|
bedrock: require('../../data/bedrock/common/protocolVersions.json')
|
|
@@ -63,11 +49,21 @@ async function updateManifestPC () {
|
|
|
63
49
|
// fs.writeFileSync('./manifest.json', JSON.stringify(manifest, null, 2))
|
|
64
50
|
const knownVersions = protocolVersions.pc.reduce((acc, cur) => (acc[cur.minecraftVersion] = cur, acc), {})
|
|
65
51
|
const latestVersion = manifest.latest.snapshot
|
|
52
|
+
const latestReleaseVersion = manifest.latest.release
|
|
66
53
|
const latestVersionData = manifest.versions.find(v => v.id === latestVersion)
|
|
67
54
|
const latestVersionIsSnapshot = latestVersionData.type !== 'release'
|
|
68
55
|
|
|
69
|
-
const title = `Support Minecraft PC ${
|
|
70
|
-
const issueStatus = await github.findIssue({ titleIncludes: title }) || {}
|
|
56
|
+
const title = `Support Minecraft PC ${latestReleaseVersion}`
|
|
57
|
+
const issueStatus = await github.findIssue({ titleIncludes: title, author: null }) || {}
|
|
58
|
+
console.log('issueStatus', issueStatus)
|
|
59
|
+
|
|
60
|
+
if (issueStatus?.isOpen) {
|
|
61
|
+
if (supportedVersions.pc.includes(latestReleaseVersion)) {
|
|
62
|
+
// If the issue is open and the latest release version is supported, we can close the issue
|
|
63
|
+
github.close(issueStatus.id, `Closing as PC ${latestReleaseVersion} is now supported`)
|
|
64
|
+
return
|
|
65
|
+
}
|
|
66
|
+
}
|
|
71
67
|
|
|
72
68
|
if (latestVersionIsSnapshot) {
|
|
73
69
|
// don't make issues for snapshots
|
|
@@ -75,19 +71,11 @@ async function updateManifestPC () {
|
|
|
75
71
|
console.log('Latest version is a known snapshot, no work to do')
|
|
76
72
|
return
|
|
77
73
|
}
|
|
74
|
+
} else if (knownVersions[latestVersion]) {
|
|
75
|
+
console.log(`Latest PC version ${latestVersion} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestVersion].version})`)
|
|
76
|
+
return // We expect to have already handled this version.
|
|
78
77
|
} else {
|
|
79
|
-
|
|
80
|
-
if (issueStatus.isOpen) {
|
|
81
|
-
github.close(issueStatus.id, `Closing as PC ${latestVersion} is now supported`)
|
|
82
|
-
}
|
|
83
|
-
console.log('Latest PC version is supported.')
|
|
84
|
-
return
|
|
85
|
-
} else if (knownVersions[latestVersion]) {
|
|
86
|
-
console.log(`Latest PC version ${latestVersion} is known in protocolVersions.json, but not in versions.json (protocol version ${knownVersions[latestVersion].version})`)
|
|
87
|
-
return
|
|
88
|
-
} else {
|
|
89
|
-
console.log(`Latest PC version ${latestVersion} is not known in protocolVersions.json, adding and making issue`)
|
|
90
|
-
}
|
|
78
|
+
console.log(`Latest PC version ${latestVersion} is not known in protocolVersions.json, adding and making issue`)
|
|
91
79
|
}
|
|
92
80
|
|
|
93
81
|
let versionJson
|
|
@@ -118,7 +106,7 @@ async function updateManifestPC () {
|
|
|
118
106
|
console.log('Created issue', issue)
|
|
119
107
|
|
|
120
108
|
// Now create an initial PR with the new version data
|
|
121
|
-
const pr = await
|
|
109
|
+
const pr = await createInitialPR('pc', issue.url, {
|
|
122
110
|
minecraftVersion: versionJson.id,
|
|
123
111
|
version: latestVersion,
|
|
124
112
|
protocolVersion: versionJson.protocol_version
|
|
@@ -131,11 +119,28 @@ async function updateManifestPC () {
|
|
|
131
119
|
workflow: 'handle-mcdata-update.yml',
|
|
132
120
|
branch: 'main',
|
|
133
121
|
inputs: {
|
|
134
|
-
version: latestVersion
|
|
122
|
+
version: latestVersion,
|
|
123
|
+
issue_number: issue?.number,
|
|
124
|
+
pr_number: pr?.number
|
|
135
125
|
}
|
|
136
126
|
}
|
|
137
127
|
console.log('Sending workflow dispatch', dispatchPayload)
|
|
138
128
|
await github.sendWorkflowDispatch(dispatchPayload)
|
|
129
|
+
// Ask node-minecraft-protocol to handle new update
|
|
130
|
+
const nodeDispatchPayload = {
|
|
131
|
+
owner: 'PrismarineJS',
|
|
132
|
+
repo: 'node-minecraft-protocol',
|
|
133
|
+
workflow: 'update-from-minecraft-data.yml',
|
|
134
|
+
branch: 'master',
|
|
135
|
+
inputs: {
|
|
136
|
+
new_mc_version: latestVersion,
|
|
137
|
+
mcdata_branch: pr.branchName,
|
|
138
|
+
mcdata_pr_url: pr.url
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
console.log('Sending workflow dispatch', nodeDispatchPayload)
|
|
142
|
+
await github.sendWorkflowDispatch(nodeDispatchPayload)
|
|
143
|
+
// node-minecraft-protocol would then dispatch to mineflayer
|
|
139
144
|
}
|
|
140
145
|
|
|
141
146
|
async function addEntryFor (releaseVersion, releaseData) {
|
|
@@ -152,8 +157,8 @@ async function updateManifestPC () {
|
|
|
152
157
|
console.log(`Downloaded client jar ${releaseVersion}.jar (${clientJarSize} bytes), extracting its version.json...`)
|
|
153
158
|
|
|
154
159
|
// unzip with tar / unzip, Actions image uses 7z
|
|
155
|
-
if (process.platform === 'win32')
|
|
156
|
-
else
|
|
160
|
+
if (process.platform === 'win32') exec('tar', ['-xf', `./${releaseVersion}.jar`, 'version.json'])
|
|
161
|
+
else exec('7z', ['-y', 'e', `./${releaseVersion}.jar`, 'version.json'])
|
|
157
162
|
const versionJson = require('./version.json')
|
|
158
163
|
|
|
159
164
|
let majorVersion
|
|
@@ -179,11 +184,11 @@ async function updateManifestPC () {
|
|
|
179
184
|
if (process.env.CI) {
|
|
180
185
|
console.log('Committing changes to protocolVersions.json')
|
|
181
186
|
// https://github.com/actions/checkout/pull/1184
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
+
exec('git', ['config', 'user.name', 'github-actions[bot]'])
|
|
188
|
+
exec('git', ['config', 'user.email', '41898282+github-actions[bot]@users.noreply.github.com'])
|
|
189
|
+
exec('git', ['add', '../../data/pc/common/protocolVersions.json'])
|
|
190
|
+
exec('git', ['commit', '-m', `Add ${versionJson.id} to pc protocolVersions.json`])
|
|
191
|
+
exec('git', ['push'])
|
|
187
192
|
}
|
|
188
193
|
|
|
189
194
|
return versionJson
|