@spyglassmc/java-edition 0.3.45 → 0.3.47

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.
@@ -17,7 +17,7 @@ export declare function dissectUri(uri: string, ctx: UriBinderContext): {
17
17
  namespace: string;
18
18
  identifier: string;
19
19
  path: string;
20
- category: "function" | "advancement" | "banner_pattern" | "cat_variant" | "chat_type" | "chicken_variant" | "cow_variant" | "damage_type" | "dialog" | "dimension" | "dimension_type" | "enchantment" | "enchantment_provider" | "frog_variant" | "instrument" | "item_modifier" | "jukebox_song" | "loot_table" | "painting_variant" | "pig_variant" | "predicate" | "recipe" | "structure" | "test_environment" | "test_instance" | "trial_spawner" | "trim_material" | "trim_pattern" | "wolf_sound_variant" | "wolf_variant" | "tag/function" | "tag/activity" | "tag/armor_material" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/block_type" | "tag/chunk_status" | "tag/command_argument_type" | "tag/consume_effect_type" | "tag/creative_mode_tab" | "tag/custom_stat" | "tag/data_component_predicate_type" | "tag/data_component_type" | "tag/decorated_pot_pattern" | "tag/decorated_pot_patterns" | "tag/dialog_action_type" | "tag/dialog_body_type" | "tag/dialog_type" | "tag/enchantment_effect_component_type" | "tag/enchantment_entity_effect_type" | "tag/enchantment_level_based_value_type" | "tag/enchantment_location_based_effect_type" | "tag/enchantment_provider_type" | "tag/enchantment_value_effect_type" | "tag/entity_sub_predicate_type" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/input_control_type" | "tag/instrument" | "tag/int_provider_type" | "tag/item" | "tag/item_sub_predicate_type" | "tag/loot_condition_type" | "tag/loot_function_type" | "tag/loot_nbt_provider_type" | "tag/loot_number_provider_type" | "tag/loot_pool_entry_type" | "tag/loot_score_provider_type" | "tag/map_decoration_type" | "tag/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/number_format_type" | "tag/particle_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_book_category" | "tag/recipe_display" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_block_entity_modifier" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/slot_display" | "tag/sound_event" | "tag/spawn_condition_type" | "tag/stat_type" | "tag/test_environment_definition_type" | "tag/test_function" | "tag/test_instance_type" | "tag/trigger_type" | "tag/ticket_type" | "tag/villager_profession" | "tag/villager_type" | "tag/worldgen/biome_source" | "tag/worldgen/block_placer_type" | "tag/worldgen/block_state_provider_type" | "tag/worldgen/carver" | "tag/worldgen/chunk_generator" | "tag/worldgen/decorator" | "tag/worldgen/density_function_type" | "tag/worldgen/feature" | "tag/worldgen/feature_size_type" | "tag/worldgen/foliage_placer_type" | "tag/worldgen/material_condition" | "tag/worldgen/material_rule" | "tag/worldgen/placement_modifier_type" | "tag/worldgen/pool_alias_binding" | "tag/worldgen/root_placer_type" | "tag/worldgen/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_placement" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/structure_type" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/advancement" | "tag/banner_pattern" | "tag/cat_variant" | "tag/chat_type" | "tag/chicken_variant" | "tag/cow_variant" | "tag/damage_type" | "tag/dialog" | "tag/dimension" | "tag/dimension_type" | "tag/enchantment" | "tag/enchantment_provider" | "tag/frog_variant" | "tag/item_modifier" | "tag/jukebox_song" | "tag/loot_table" | "tag/painting_variant" | "tag/pig_variant" | "tag/predicate" | "tag/recipe" | "tag/structure" | "tag/test_environment" | "tag/test_instance" | "tag/trial_spawner" | "tag/trim_material" | "tag/trim_pattern" | "tag/wolf_sound_variant" | "tag/wolf_variant" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/density_function" | "tag/worldgen/flat_level_generator_preset" | "tag/worldgen/multi_noise_biome_source_parameter_list" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/structure" | "tag/worldgen/structure_set" | "tag/worldgen/template_pool" | "tag/worldgen/world_preset" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/density_function" | "worldgen/flat_level_generator_preset" | "worldgen/multi_noise_biome_source_parameter_list" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/structure" | "worldgen/structure_set" | "worldgen/template_pool" | "worldgen/world_preset" | "atlas" | "block_definition" | "equipment" | "font" | "font/ttf" | "font/otf" | "font/unihex" | "gpu_warnlist" | "item_definition" | "lang" | "lang/deprecated" | "model" | "particle" | "post_effect" | "regional_compliancies" | "shader" | "shader/fragment" | "shader/vertex" | "sound" | "sounds" | "texture" | "texture_meta" | "waypoint_style";
20
+ category: "function" | "advancement" | "banner_pattern" | "cat_variant" | "chat_type" | "chicken_variant" | "cow_variant" | "damage_type" | "dialog" | "dimension" | "dimension_type" | "enchantment" | "enchantment_provider" | "frog_variant" | "instrument" | "item_modifier" | "jukebox_song" | "loot_table" | "painting_variant" | "pig_variant" | "predicate" | "recipe" | "structure" | "test_environment" | "test_instance" | "trial_spawner" | "trim_material" | "trim_pattern" | "wolf_sound_variant" | "wolf_variant" | "tag/function" | "tag/activity" | "tag/armor_material" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/block_type" | "tag/chunk_status" | "tag/command_argument_type" | "tag/consume_effect_type" | "tag/creative_mode_tab" | "tag/custom_stat" | "tag/data_component_predicate_type" | "tag/data_component_type" | "tag/debug_subscription" | "tag/decorated_pot_pattern" | "tag/decorated_pot_patterns" | "tag/dialog_action_type" | "tag/dialog_body_type" | "tag/dialog_type" | "tag/enchantment_effect_component_type" | "tag/enchantment_entity_effect_type" | "tag/enchantment_level_based_value_type" | "tag/enchantment_location_based_effect_type" | "tag/enchantment_provider_type" | "tag/enchantment_value_effect_type" | "tag/entity_sub_predicate_type" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/incoming_rpc_methods" | "tag/input_control_type" | "tag/instrument" | "tag/int_provider_type" | "tag/item" | "tag/item_sub_predicate_type" | "tag/loot_condition_type" | "tag/loot_function_type" | "tag/loot_nbt_provider_type" | "tag/loot_number_provider_type" | "tag/loot_pool_entry_type" | "tag/loot_score_provider_type" | "tag/map_decoration_type" | "tag/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/number_format_type" | "tag/outgoing_rpc_methods" | "tag/particle_type" | "tag/permission_check_type" | "tag/permission_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_book_category" | "tag/recipe_display" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_block_entity_modifier" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/slot_display" | "tag/sound_event" | "tag/spawn_condition_type" | "tag/stat_type" | "tag/test_environment_definition_type" | "tag/test_function" | "tag/test_instance_type" | "tag/trigger_type" | "tag/ticket_type" | "tag/villager_profession" | "tag/villager_type" | "tag/worldgen/biome_source" | "tag/worldgen/block_placer_type" | "tag/worldgen/block_state_provider_type" | "tag/worldgen/carver" | "tag/worldgen/chunk_generator" | "tag/worldgen/decorator" | "tag/worldgen/density_function_type" | "tag/worldgen/feature" | "tag/worldgen/feature_size_type" | "tag/worldgen/foliage_placer_type" | "tag/worldgen/material_condition" | "tag/worldgen/material_rule" | "tag/worldgen/placement_modifier_type" | "tag/worldgen/pool_alias_binding" | "tag/worldgen/root_placer_type" | "tag/worldgen/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_placement" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/structure_type" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/advancement" | "tag/banner_pattern" | "tag/cat_variant" | "tag/chat_type" | "tag/chicken_variant" | "tag/cow_variant" | "tag/damage_type" | "tag/dialog" | "tag/dimension" | "tag/dimension_type" | "tag/enchantment" | "tag/enchantment_provider" | "tag/frog_variant" | "tag/item_modifier" | "tag/jukebox_song" | "tag/loot_table" | "tag/painting_variant" | "tag/pig_variant" | "tag/predicate" | "tag/recipe" | "tag/structure" | "tag/test_environment" | "tag/test_instance" | "tag/trial_spawner" | "tag/trim_material" | "tag/trim_pattern" | "tag/wolf_sound_variant" | "tag/wolf_variant" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/density_function" | "tag/worldgen/flat_level_generator_preset" | "tag/worldgen/multi_noise_biome_source_parameter_list" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/structure" | "tag/worldgen/structure_set" | "tag/worldgen/template_pool" | "tag/worldgen/world_preset" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/density_function" | "worldgen/flat_level_generator_preset" | "worldgen/multi_noise_biome_source_parameter_list" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/structure" | "worldgen/structure_set" | "worldgen/template_pool" | "worldgen/world_preset" | "atlas" | "block_definition" | "equipment" | "font" | "font/ttf" | "font/otf" | "font/unihex" | "gpu_warnlist" | "item_definition" | "lang" | "lang/deprecated" | "model" | "particle" | "post_effect" | "regional_compliancies" | "shader" | "shader/fragment" | "shader/vertex" | "sound" | "sounds" | "texture" | "texture_meta" | "waypoint_style";
21
21
  ext: `.${string}`;
22
22
  pack: "assets" | "data";
23
23
  since?: `1.${number}` | undefined;
@@ -18,7 +18,6 @@ export interface VersionInfo {
18
18
  release: ReleaseVersion;
19
19
  id: string;
20
20
  name: string;
21
- isLatest: boolean;
22
21
  }
23
22
  export declare namespace PackMcmeta {
24
23
  function readPackFormat(data: any): number;
@@ -7,7 +7,12 @@ export var ReleaseVersion;
7
7
  * * `1` if `a` is newer than `b`.
8
8
  */
9
9
  function cmp(a, b) {
10
- return Math.sign(Number(a.slice(2)) - Number(b.slice(2)));
10
+ const [minorA, patchA = 0] = a.slice(2).split('.');
11
+ const [minorB, patchB = 0] = b.slice(2).split('.');
12
+ if (minorA !== minorB) {
13
+ return Math.sign(Number(minorA) - Number(minorB));
14
+ }
15
+ return Math.sign(Number(patchA) - Number(patchB));
11
16
  }
12
17
  ReleaseVersion.cmp = cmp;
13
18
  /**
@@ -22,6 +27,13 @@ export var ReleaseVersion;
22
27
  export var PackMcmeta;
23
28
  (function (PackMcmeta) {
24
29
  function readPackFormat(data) {
30
+ const max = data?.pack?.max_format;
31
+ if (Array.isArray(max) && max.length >= 1 && typeof max[0] === 'number') {
32
+ return max[0]; // only return major pack format
33
+ }
34
+ if (typeof max === 'number') {
35
+ return max;
36
+ }
25
37
  const supported = data?.pack?.supported_formats;
26
38
  if (Array.isArray(supported) && supported.length === 2 && typeof supported[1] === 'number') {
27
39
  return supported[1];
@@ -33,7 +45,7 @@ export var PackMcmeta;
33
45
  if (typeof format === 'number') {
34
46
  return format;
35
47
  }
36
- throw new Error('pack.pack_format” is not a number');
48
+ throw new Error('No pack format found');
37
49
  }
38
50
  PackMcmeta.readPackFormat = readPackFormat;
39
51
  async function getType(packRoot, externals) {
@@ -7,7 +7,7 @@ import type { McmetaSummary, McmetaVersions } from './mcmeta.js';
7
7
  *
8
8
  * [versions.json]: https://github.com/misode/mcmeta/blob/summary/versions/data.json
9
9
  */
10
- export declare function getVersions(externals: core.Externals, downloader: core.Downloader): Promise<McmetaVersions | undefined>;
10
+ export declare function getVersions(externals: core.Externals, logger: core.Logger): Promise<McmetaVersions | undefined>;
11
11
  interface GetMcmetaSummaryResult extends Partial<McmetaSummary> {
12
12
  checksum: string | undefined;
13
13
  }
@@ -16,29 +16,17 @@ interface GetMcmetaSummaryResult extends Partial<McmetaSummary> {
16
16
  *
17
17
  * @throws Network/file system errors.
18
18
  */
19
- export declare function getMcmetaSummary(externals: core.Externals, downloader: core.Downloader, logger: core.Logger, version: string, isLatest: boolean, source: string, overridePaths?: core.EnvConfig['mcmetaSummaryOverrides']): Promise<GetMcmetaSummaryResult>;
19
+ export declare function getMcmetaSummary(externals: core.Externals, logger: core.Logger, version: string, overridePaths?: core.EnvConfig['mcmetaSummaryOverrides']): Promise<GetMcmetaSummaryResult>;
20
20
  /**
21
21
  * @throws Network/file system errors.
22
- *
23
- * @returns
24
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
25
- * - `uri`: URI to the `.tar.gz` file.
26
22
  */
27
- export declare function getVanillaDatapack(downloader: core.Downloader, version: string, isLatest: boolean): Promise<core.Dependency>;
23
+ export declare function getVanillaDatapack(externals: core.Externals, logger: core.Logger, version: string): Promise<core.Dependency>;
28
24
  /**
29
25
  * @throws Network/file system errors.
30
- *
31
- * @returns
32
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
33
- * - `uri`: URI to the `.tar.gz` file.
34
26
  */
35
- export declare function getVanillaResourcepack(downloader: core.Downloader, version: string, isLatest: boolean): Promise<core.Dependency>;
27
+ export declare function getVanillaResourcepack(externals: core.Externals, logger: core.Logger, version: string): Promise<core.Dependency>;
36
28
  /**
37
29
  * @throws Network/file system errors.
38
- *
39
- * @returns
40
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
41
- * - `uri`: URI to the `.tar.gz` file.
42
30
  */
43
- export declare function getVanillaMcdoc(downloader: core.Downloader): Promise<core.Dependency>;
31
+ export declare function getVanillaMcdoc(externals: core.Externals, logger: core.Logger): Promise<core.Dependency>;
44
32
  //# sourceMappingURL=index.d.ts.map
@@ -1,23 +1,16 @@
1
1
  export * from './common.js';
2
2
  export * from './mcmeta.js';
3
3
  import * as core from '@spyglassmc/core';
4
- import { Fluids, getMcmetaSummaryUris } from './mcmeta.js';
5
- // Memory cache TTL in milliseconds
6
- const DownloaderTtl = 15_000;
4
+ import { Fluids } from './mcmeta.js';
7
5
  /* istanbul ignore next */
8
6
  /**
9
7
  * Return the deserialized [`versions.json`][versions.json].
10
8
  *
11
9
  * [versions.json]: https://github.com/misode/mcmeta/blob/summary/versions/data.json
12
10
  */
13
- export async function getVersions(externals, downloader) {
14
- return downloader.download({
15
- id: 'mc-je/versions.json.gz',
16
- uri: 'https://raw.githubusercontent.com/misode/mcmeta/summary/versions/data.json.gz',
17
- transformer: (buffer) => core.parseGzippedJson(externals, buffer),
18
- cache: getCacheOptionsBasedOnGitHubCommitSha('misode', 'mcmeta', 'refs/heads/summary'),
19
- ttl: DownloaderTtl,
20
- });
11
+ export async function getVersions(externals, logger) {
12
+ return (await core.fetchWithCache(externals, logger, 'https://api.spyglassmc.com/mcje/versions'))
13
+ .json();
21
14
  }
22
15
  /* istanbul ignore next */
23
16
  /**
@@ -25,15 +18,7 @@ export async function getVersions(externals, downloader) {
25
18
  *
26
19
  * @throws Network/file system errors.
27
20
  */
28
- export async function getMcmetaSummary(externals, downloader, logger, version, isLatest, source, overridePaths = {}) {
29
- const ref = getGitRef({
30
- defaultBranch: 'summary',
31
- getTag: (v) => `${v}-summary`,
32
- isLatest,
33
- version,
34
- });
35
- const uris = getMcmetaSummaryUris(version, isLatest, source);
36
- let checksum;
21
+ export async function getMcmetaSummary(externals, logger, version, overridePaths = {}) {
37
22
  async function handleOverride(currentValue, overrideConfig) {
38
23
  if (overrideConfig) {
39
24
  try {
@@ -52,135 +37,62 @@ export async function getMcmetaSummary(externals, downloader, logger, version, i
52
37
  return currentValue;
53
38
  }
54
39
  const getResource = async (type, overrideConfig) => {
55
- const out = {};
56
- const data = await downloader.download({
57
- id: `mc-je/${version}/${type}.json.gz`,
58
- uri: uris[type],
59
- transformer: (buffer) => core.parseGzippedJson(externals, buffer),
60
- cache: getCacheOptionsBasedOnGitHubCommitSha('misode', 'mcmeta', ref),
61
- ttl: DownloaderTtl,
62
- }, out);
63
- checksum ||= out.checksum;
64
- return handleOverride(data, overrideConfig);
40
+ const response = await core.fetchWithCache(externals, logger, `https://api.spyglassmc.com/mcje/versions/${encodeURIComponent(version)}/${type}`);
41
+ return {
42
+ data: await handleOverride(await response.json(), overrideConfig),
43
+ checksum: response.headers.get('etag') ?? '',
44
+ };
65
45
  };
66
46
  const [blocks, commands, fluids, registries] = [
67
- await getResource('blocks', overridePaths.blocks),
47
+ await getResource('block_states', overridePaths.blocks),
68
48
  await getResource('commands', overridePaths.commands),
69
- await handleOverride(Fluids, overridePaths.fluids),
49
+ {
50
+ data: await handleOverride(Fluids, overridePaths.fluids),
51
+ checksum: 'v1',
52
+ },
70
53
  await getResource('registries', overridePaths.registries),
71
54
  ];
72
- return { blocks, commands, fluids, registries, checksum };
73
- }
74
- function getGitRef({ defaultBranch, getTag, isLatest, version }) {
75
- return isLatest ? `refs/heads/${defaultBranch}` : `refs/tags/${getTag(version)}`;
76
- }
77
- const GitHubApiDownloadOptions = {
78
- headers: { Accept: 'application/vnd.github.v3+json', 'User-Agent': 'SpyglassMC' },
79
- };
80
- function getCacheOptionsBasedOnGitHubCommitSha(owner, repo, ref) {
81
55
  return {
82
- checksumExtension: '.commit-sha',
83
- checksumJob: {
84
- uri: `https://api.github.com/repos/${owner}/${repo}/git/${ref}`,
85
- transformer: (buffer) => {
86
- const response = JSON.parse(core.bufferToString(buffer));
87
- if (Array.isArray(response)) {
88
- return response[0].object.sha;
89
- }
90
- else if (response.message === undefined) {
91
- return response.object.sha;
92
- }
93
- else {
94
- throw new Error(response.message);
95
- }
96
- },
97
- options: GitHubApiDownloadOptions,
98
- ttl: DownloaderTtl,
99
- },
56
+ blocks: blocks.data,
57
+ commands: commands.data,
58
+ fluids: fluids.data,
59
+ registries: registries.data,
60
+ checksum: `${blocks.checksum}-${commands.checksum}-${fluids.checksum}-${registries.checksum}`,
100
61
  };
101
62
  }
102
- /**
103
- * Download data from a GitHub repository with tags corresponding to Minecraft versions.
104
- * The downloaded data will be cached based on the commit SHA of the respective tag.
105
- *
106
- * If `isLatest` if `true`, instead of finding the tag corresponding to the given version, the default branch will be used.
107
- *
108
- * @returns The URI to the `.tar.gz` file.
109
- */
110
- async function downloadGitHubRepo({ defaultBranch, downloader, getTag, repo, isLatest, owner, version, suffix }) {
111
- const ref = getGitRef({ defaultBranch, getTag, isLatest, version });
112
- const out = {};
113
- await downloader.download({
114
- id: `mc-je/${version}/${repo}${suffix ?? ''}.tar.gz`,
115
- uri: `https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`,
116
- transformer: (b) => b,
117
- cache: getCacheOptionsBasedOnGitHubCommitSha(owner, repo, ref),
118
- options: GitHubApiDownloadOptions,
119
- ttl: DownloaderTtl,
120
- }, out);
121
- return out.cacheUri;
122
- }
123
63
  /* istanbul ignore next */
124
64
  /**
125
65
  * @throws Network/file system errors.
126
- *
127
- * @returns
128
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
129
- * - `uri`: URI to the `.tar.gz` file.
130
66
  */
131
- export async function getVanillaDatapack(downloader, version, isLatest) {
132
- const uri = await downloadGitHubRepo({
133
- defaultBranch: 'data',
134
- downloader,
135
- getTag: (v) => `${v}-data`,
136
- owner: 'misode',
137
- repo: 'mcmeta',
138
- isLatest,
139
- version,
140
- });
141
- return { info: { startDepth: 1 }, uri };
67
+ export async function getVanillaDatapack(externals, logger, version) {
68
+ return {
69
+ type: 'tarball-ram',
70
+ name: 'vanilla-datapack',
71
+ data: new Uint8Array(await (await core.fetchWithCache(externals, logger, `https://api.spyglassmc.com/mcje/versions/${encodeURIComponent(version)}/vanilla-data/tarball`)).arrayBuffer()),
72
+ stripLevel: 0,
73
+ };
142
74
  }
143
75
  /* istanbul ignore next */
144
76
  /**
145
77
  * @throws Network/file system errors.
146
- *
147
- * @returns
148
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
149
- * - `uri`: URI to the `.tar.gz` file.
150
78
  */
151
- export async function getVanillaResourcepack(downloader, version, isLatest) {
152
- const uri = await downloadGitHubRepo({
153
- defaultBranch: 'assets-tiny',
154
- downloader,
155
- getTag: (v) => `${v}-assets-tiny`,
156
- owner: 'misode',
157
- repo: 'mcmeta',
158
- isLatest,
159
- version,
160
- suffix: '-assets',
161
- });
162
- return { info: { startDepth: 1 }, uri };
79
+ export async function getVanillaResourcepack(externals, logger, version) {
80
+ return {
81
+ type: 'tarball-ram',
82
+ name: 'vanilla-assets-tiny',
83
+ data: new Uint8Array(await (await core.fetchWithCache(externals, logger, `https://api.spyglassmc.com/mcje/versions/${encodeURIComponent(version)}/vanilla-assets-tiny/tarball`)).arrayBuffer()),
84
+ stripLevel: 0,
85
+ };
163
86
  }
164
87
  /**
165
88
  * @throws Network/file system errors.
166
- *
167
- * @returns
168
- * - `startDepth`: The amount of level to skip when unzipping the tarball.
169
- * - `uri`: URI to the `.tar.gz` file.
170
89
  */
171
- export async function getVanillaMcdoc(downloader) {
172
- const owner = 'SpyglassMC';
173
- const repo = 'vanilla-mcdoc';
174
- const ref = 'refs/heads/main';
175
- const out = {};
176
- await downloader.download({
177
- id: 'mc-je/vanilla-mcdoc.tar.gz',
178
- uri: `https://api.github.com/repos/${owner}/${repo}/tarball/${ref}`,
179
- transformer: (b) => b,
180
- cache: getCacheOptionsBasedOnGitHubCommitSha(owner, repo, ref),
181
- options: GitHubApiDownloadOptions,
182
- ttl: DownloaderTtl,
183
- }, out);
184
- return { info: { startDepth: 1 }, uri: out.cacheUri };
90
+ export async function getVanillaMcdoc(externals, logger) {
91
+ return {
92
+ type: 'tarball-ram',
93
+ name: 'vanilla-mcdoc',
94
+ data: new Uint8Array(await (await core.fetchWithCache(externals, logger, `https://api.spyglassmc.com/vanilla-mcdoc/tarball`)).arrayBuffer()),
95
+ stripLevel: 0,
96
+ };
185
97
  }
186
98
  //# sourceMappingURL=index.js.map
@@ -1,16 +1,11 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import type { PackInfo, VersionInfo } from './common.js';
3
3
  import { ReleaseVersion } from './common.js';
4
- export declare const NEXT_RELEASE_VERSION = "1.21.9";
4
+ export declare const NEXT_RELEASE_VERSION = "1.21.11";
5
5
  /**
6
6
  * @param inputVersion {@link core.Config.env.gameVersion}
7
7
  */
8
8
  export declare function resolveConfiguredVersion(inputVersion: string, versions: McmetaVersions, packs: PackInfo[], logger: core.Logger): VersionInfo;
9
- export declare function getMcmetaSummaryUris(version: string, isLatest: boolean, source: string): {
10
- blocks: core.RemoteUriString;
11
- commands: core.RemoteUriString;
12
- registries: core.RemoteUriString;
13
- };
14
9
  export declare function symbolRegistrar(summary: McmetaSummary, release: ReleaseVersion): core.SymbolRegistrar;
15
10
  export declare const Fluids: McmetaStates;
16
11
  export interface McmetaVersion {
@@ -1,7 +1,7 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import { ReleaseVersion } from './common.js';
3
3
  // DOCS: Update this when a new snapshot cycle begins
4
- export const NEXT_RELEASE_VERSION = '1.21.9';
4
+ export const NEXT_RELEASE_VERSION = '1.21.11';
5
5
  /**
6
6
  * @param inputVersion {@link core.Config.env.gameVersion}
7
7
  */
@@ -27,7 +27,6 @@ export function resolveConfiguredVersion(inputVersion, versions, packs, logger)
27
27
  id: version.id,
28
28
  name: version.name,
29
29
  release: findReleaseTarget(version),
30
- isLatest: version === versions[0],
31
30
  };
32
31
  }
33
32
  if (versions.length === 0) {
@@ -90,27 +89,6 @@ export function resolveConfiguredVersion(inputVersion, versions, packs, logger)
90
89
  logger.info(`[resolveConfiguredVersion] Using config "${inputVersion}", selecting version ${configVersion?.id}`);
91
90
  return toVersionInfo(configVersion);
92
91
  }
93
- const DataSources = {
94
- fastly: 'https://fastly.jsdelivr.net/gh/${user}/${repo}@${tag}/${path}',
95
- github: 'https://raw.githubusercontent.com/${user}/${repo}/${tag}/${path}',
96
- jsdelivr: 'https://cdn.jsdelivr.net/gh/${user}/${repo}@${tag}/${path}',
97
- };
98
- export function getMcmetaSummaryUris(version, isLatest, source) {
99
- const tag = isLatest ? 'summary' : `${version}-summary`;
100
- function getUri(path) {
101
- const template = DataSources[source.toLowerCase()] ?? source;
102
- const ans = template.replace(/\${user}/g, 'misode').replace(/\${repo}/g, 'mcmeta').replace(/\${tag}/g, tag).replace(/\${path}/g, path);
103
- if (!core.RemoteUriString.is(ans)) {
104
- throw new Error(`Expected a remote URI from data source template but got ${ans}`);
105
- }
106
- return ans;
107
- }
108
- return {
109
- blocks: getUri('blocks/data.json.gz'),
110
- commands: getUri('commands/data.json.gz'),
111
- registries: getUri('registries/data.json.gz'),
112
- };
113
- }
114
92
  export function symbolRegistrar(summary, release) {
115
93
  const McmetaSummaryUri = 'mcmeta://summary/registries.json';
116
94
  /**
package/lib/index.js CHANGED
@@ -13,7 +13,7 @@ export * as json from './json/index.js';
13
13
  export * from './mcdocAttributes.js';
14
14
  export * as mcf from './mcfunction/index.js';
15
15
  export const initialize = async (ctx) => {
16
- const { config, downloader, externals, logger, meta, projectRoots } = ctx;
16
+ const { config, externals, logger, meta, projectRoots } = ctx;
17
17
  async function readPackFormat(uri) {
18
18
  try {
19
19
  const data = await core.fileUtil.readJson(externals, uri);
@@ -54,7 +54,7 @@ export const initialize = async (ctx) => {
54
54
  meta.registerUriBinder(uriBinder);
55
55
  registerUriBuilders(meta);
56
56
  const [versions, packs] = await Promise.all([
57
- getVersions(ctx.externals, ctx.downloader),
57
+ getVersions(externals, logger),
58
58
  findPackMcmetas(),
59
59
  ]);
60
60
  if (!versions) {
@@ -63,16 +63,16 @@ export const initialize = async (ctx) => {
63
63
  }
64
64
  const version = resolveConfiguredVersion(config.env.gameVersion, versions, packs, logger);
65
65
  const release = version.release;
66
- meta.registerDependencyProvider('@vanilla-datapack', () => getVanillaDatapack(downloader, version.id, version.isLatest));
67
- meta.registerDependencyProvider('@vanilla-resourcepack', () => getVanillaResourcepack(downloader, version.id, version.isLatest));
68
- meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(downloader));
69
- const summary = await getMcmetaSummary(ctx.externals, downloader, logger, version.id, version.isLatest, config.env.dataSource, config.env.mcmetaSummaryOverrides);
66
+ meta.registerDependencyProvider('@vanilla-datapack', () => getVanillaDatapack(externals, logger, version.id));
67
+ meta.registerDependencyProvider('@vanilla-resourcepack', () => getVanillaResourcepack(externals, logger, version.id));
68
+ meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(externals, logger));
69
+ const summary = await getMcmetaSummary(ctx.externals, logger, version.id, config.env.mcmetaSummaryOverrides);
70
70
  if (!summary.blocks || !summary.commands || !summary.fluids || !summary.registries) {
71
71
  ctx.logger.error('[je-initialize] Failed loading mcmeta summaries. Expect everything to be broken.');
72
72
  return;
73
73
  }
74
74
  meta.registerSymbolRegistrar('mcmeta-summary', {
75
- checksum: `${summary.checksum}_v3`,
75
+ checksum: `${summary.checksum}-v4`,
76
76
  registrar: symbolRegistrar(summary, release),
77
77
  });
78
78
  meta.registerLinter('nameOfNbtKey', {
@@ -268,7 +268,7 @@ function nbtPathChecker(dispatchedBy) {
268
268
  const particle = (node, ctx) => {
269
269
  const id = core.ResourceLocationNode.toString(node.id, 'short');
270
270
  const release = ctx.project['loadedVersion'];
271
- if (release && ReleaseVersion.cmp(release, '1.20.5') < 0) {
271
+ if (!release || ReleaseVersion.cmp(release, '1.20.5') < 0) {
272
272
  return;
273
273
  }
274
274
  const options = node.children?.find(nbt.NbtCompoundNode.is);
@@ -277,7 +277,7 @@ const particle = (node, ctx) => {
277
277
  // run the type checker anyways to allow an empty compound
278
278
  nbt.checker.index('minecraft:particle', core.ResourceLocation.lengthen(id))(options, ctx);
279
279
  }
280
- else if (ParticleNode.requiresOptions(id)) {
280
+ else if (ParticleNode.requiresOptions(id, release)) {
281
281
  ctx.err.report(localize('expected', localize('nbt.node.compound')), core.Range.create(node.id.range.end, node.id.range.end + 1));
282
282
  }
283
283
  };
@@ -1,5 +1,6 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import type * as nbt from '@spyglassmc/nbt';
3
+ import { ReleaseVersion } from '../../dependency/common.js';
3
4
  import type { NbtParserProperties } from '../tree/argument.js';
4
5
  export interface BlockStatesNode extends core.RecordBaseNode<core.StringNode, core.StringNode> {
5
6
  type: 'mcfunction:block/states';
@@ -86,7 +87,7 @@ export interface EntitySelectorNode extends core.AstNode {
86
87
  export declare namespace EntitySelectorNode {
87
88
  function is<T extends core.DeepReadonly<core.AstNode> | undefined>(node: T): node is core.InheritReadonly<EntitySelectorNode, T>;
88
89
  function mock(range: core.RangeLike, options: core.LiteralOptions): EntitySelectorNode;
89
- const ArgumentKeys: Set<"tag" | "team" | "predicate" | "type" | "level" | "sort" | "advancements" | "nbt" | "distance" | "gamemode" | "limit" | "name" | "scores" | "x" | "y" | "z" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
90
+ const ArgumentKeys: Set<"tag" | "team" | "predicate" | "type" | "level" | "name" | "sort" | "advancements" | "nbt" | "distance" | "gamemode" | "limit" | "scores" | "x" | "y" | "z" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
90
91
  type ArgumentKey = typeof ArgumentKeys extends Set<infer T> ? T : undefined;
91
92
  const enum Result {
92
93
  Ok = 0,
@@ -252,7 +253,7 @@ export interface ObjectiveCriteriaNode extends core.AstNode {
252
253
  }
253
254
  export declare namespace ObjectiveCriteriaNode {
254
255
  const SimpleValues: string[];
255
- const ComplexCategories: Map<string, "block" | "fluid" | "instrument" | "activity" | "armor_material" | "attribute" | "block_entity_type" | "block_predicate_type" | "block_type" | "chunk_status" | "command_argument_type" | "consume_effect_type" | "creative_mode_tab" | "custom_stat" | "data_component_predicate_type" | "data_component_type" | "decorated_pot_pattern" | "decorated_pot_patterns" | "dialog_action_type" | "dialog_body_type" | "dialog_type" | "enchantment_effect_component_type" | "enchantment_entity_effect_type" | "enchantment_level_based_value_type" | "enchantment_location_based_effect_type" | "enchantment_provider_type" | "enchantment_value_effect_type" | "entity_sub_predicate_type" | "entity_type" | "float_provider_type" | "game_event" | "height_provider_type" | "input_control_type" | "int_provider_type" | "item" | "item_sub_predicate_type" | "loot_condition_type" | "loot_function_type" | "loot_nbt_provider_type" | "loot_number_provider_type" | "loot_pool_entry_type" | "loot_score_provider_type" | "map_decoration_type" | "memory_module_type" | "menu" | "mob_effect" | "motive" | "number_format_type" | "particle_type" | "point_of_interest_type" | "pos_rule_test" | "position_source_type" | "potion" | "recipe_book_category" | "recipe_display" | "recipe_serializer" | "recipe_type" | "rule_block_entity_modifier" | "rule_test" | "schedule" | "sensor_type" | "slot_display" | "sound_event" | "spawn_condition_type" | "stat_type" | "test_environment_definition_type" | "test_function" | "test_instance_type" | "trigger_type" | "ticket_type" | "villager_profession" | "villager_type" | "worldgen/biome_source" | "worldgen/block_placer_type" | "worldgen/block_state_provider_type" | "worldgen/carver" | "worldgen/chunk_generator" | "worldgen/decorator" | "worldgen/density_function_type" | "worldgen/feature" | "worldgen/feature_size_type" | "worldgen/foliage_placer_type" | "worldgen/material_condition" | "worldgen/material_rule" | "worldgen/placement_modifier_type" | "worldgen/pool_alias_binding" | "worldgen/root_placer_type" | "worldgen/structure_feature" | "worldgen/structure_piece" | "worldgen/structure_placement" | "worldgen/structure_pool_element" | "worldgen/structure_processor" | "worldgen/structure_type" | "worldgen/surface_builder" | "worldgen/tree_decorator_type" | "worldgen/trunk_placer_type">;
256
+ const ComplexCategories: Map<string, "block" | "fluid" | "instrument" | "activity" | "armor_material" | "attribute" | "block_entity_type" | "block_predicate_type" | "block_type" | "chunk_status" | "command_argument_type" | "consume_effect_type" | "creative_mode_tab" | "custom_stat" | "data_component_predicate_type" | "data_component_type" | "debug_subscription" | "decorated_pot_pattern" | "decorated_pot_patterns" | "dialog_action_type" | "dialog_body_type" | "dialog_type" | "enchantment_effect_component_type" | "enchantment_entity_effect_type" | "enchantment_level_based_value_type" | "enchantment_location_based_effect_type" | "enchantment_provider_type" | "enchantment_value_effect_type" | "entity_sub_predicate_type" | "entity_type" | "float_provider_type" | "game_event" | "height_provider_type" | "incoming_rpc_methods" | "input_control_type" | "int_provider_type" | "item" | "item_sub_predicate_type" | "loot_condition_type" | "loot_function_type" | "loot_nbt_provider_type" | "loot_number_provider_type" | "loot_pool_entry_type" | "loot_score_provider_type" | "map_decoration_type" | "memory_module_type" | "menu" | "mob_effect" | "motive" | "number_format_type" | "outgoing_rpc_methods" | "particle_type" | "permission_check_type" | "permission_type" | "point_of_interest_type" | "pos_rule_test" | "position_source_type" | "potion" | "recipe_book_category" | "recipe_display" | "recipe_serializer" | "recipe_type" | "rule_block_entity_modifier" | "rule_test" | "schedule" | "sensor_type" | "slot_display" | "sound_event" | "spawn_condition_type" | "stat_type" | "test_environment_definition_type" | "test_function" | "test_instance_type" | "trigger_type" | "ticket_type" | "villager_profession" | "villager_type" | "worldgen/biome_source" | "worldgen/block_placer_type" | "worldgen/block_state_provider_type" | "worldgen/carver" | "worldgen/chunk_generator" | "worldgen/decorator" | "worldgen/density_function_type" | "worldgen/feature" | "worldgen/feature_size_type" | "worldgen/foliage_placer_type" | "worldgen/material_condition" | "worldgen/material_rule" | "worldgen/placement_modifier_type" | "worldgen/pool_alias_binding" | "worldgen/root_placer_type" | "worldgen/structure_feature" | "worldgen/structure_piece" | "worldgen/structure_placement" | "worldgen/structure_pool_element" | "worldgen/structure_processor" | "worldgen/structure_type" | "worldgen/surface_builder" | "worldgen/tree_decorator_type" | "worldgen/trunk_placer_type">;
256
257
  const ComplexSep = ":";
257
258
  function mock(range: core.RangeLike): ObjectiveCriteriaNode;
258
259
  }
@@ -266,7 +267,7 @@ export declare namespace ParticleNode {
266
267
  export type SpecialType = typeof SpecialTypes extends Set<infer T> ? T : undefined;
267
268
  export function isSpecialType(type: string | undefined): type is SpecialType;
268
269
  export type OptionType = typeof SpecialTypes extends Set<infer T> ? T : undefined;
269
- export function requiresOptions(type: string | undefined): type is OptionType;
270
+ export function requiresOptions(type: string | undefined, release: ReleaseVersion): type is OptionType;
270
271
  export function is(node: core.AstNode | undefined): node is ParticleNode;
271
272
  export function mock(range: core.RangeLike): ParticleNode;
272
273
  export {};
@@ -346,7 +346,10 @@ export var ParticleNode;
346
346
  'entity_effect',
347
347
  'trail',
348
348
  ]);
349
- function requiresOptions(type) {
349
+ function requiresOptions(type, release) {
350
+ if (type === 'flash' && ReleaseVersion.cmp(release, '1.21.9') >= 0) {
351
+ return true;
352
+ }
350
353
  return OptionTypes.has(type);
351
354
  }
352
355
  ParticleNode.requiresOptions = requiresOptions;
@@ -194,6 +194,23 @@ export function getPatch(release) {
194
194
  unless: ExecuteCondition,
195
195
  },
196
196
  },
197
+ ...(ReleaseVersion.cmp(release, '1.21.9') >= 0
198
+ ? {
199
+ fetchprofile: {
200
+ children: {
201
+ id: {
202
+ children: {
203
+ id: {
204
+ properties: {
205
+ category: 'player_uuid',
206
+ },
207
+ },
208
+ },
209
+ },
210
+ },
211
+ },
212
+ }
213
+ : {}),
197
214
  function: {
198
215
  children: {
199
216
  name: {
@@ -637,6 +654,11 @@ export function getPatch(release) {
637
654
  neutral: Sound,
638
655
  player: Sound,
639
656
  record: Sound,
657
+ ...(ReleaseVersion.cmp(release, '1.21.9') >= 0
658
+ ? {
659
+ ui: Sound,
660
+ }
661
+ : {}),
640
662
  voice: Sound,
641
663
  weather: Sound,
642
664
  },
@@ -731,6 +753,24 @@ export function getPatch(release) {
731
753
  tell: {
732
754
  permission: 0,
733
755
  },
756
+ ...(ReleaseVersion.cmp(release, '1.21.5') >= 0
757
+ ? {
758
+ test: {
759
+ children: {
760
+ create: {
761
+ children: {
762
+ id: {
763
+ properties: {
764
+ category: 'test_instance',
765
+ allowUnknown: true,
766
+ },
767
+ },
768
+ },
769
+ },
770
+ },
771
+ },
772
+ }
773
+ : {}),
734
774
  ...(ReleaseVersion.cmp(release, '1.20.3') >= 0
735
775
  ? {
736
776
  // Added in 23w43a (1.20.3, pack format 22)
@@ -764,6 +804,35 @@ export function getPatch(release) {
764
804
  w: {
765
805
  permission: 0,
766
806
  },
807
+ ...(ReleaseVersion.cmp(release, '1.21.6') >= 0
808
+ ? {
809
+ waypoint: {
810
+ children: {
811
+ modify: {
812
+ children: {
813
+ waypoint: {
814
+ children: {
815
+ style: {
816
+ children: {
817
+ set: {
818
+ children: {
819
+ style: {
820
+ properties: {
821
+ category: 'waypoint_style',
822
+ },
823
+ },
824
+ },
825
+ },
826
+ },
827
+ },
828
+ },
829
+ },
830
+ },
831
+ },
832
+ },
833
+ },
834
+ }
835
+ : {}),
767
836
  whitelist: {
768
837
  permission: 3,
769
838
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/java-edition",
3
- "version": "0.3.45",
3
+ "version": "0.3.47",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -17,12 +17,12 @@
17
17
  "release:dry": "npm publish --dry-run"
18
18
  },
19
19
  "dependencies": {
20
- "@spyglassmc/core": "0.4.34",
21
- "@spyglassmc/json": "0.3.38",
22
- "@spyglassmc/locales": "0.3.18",
23
- "@spyglassmc/mcfunction": "0.2.37",
24
- "@spyglassmc/mcdoc": "0.3.38",
25
- "@spyglassmc/nbt": "0.3.39"
20
+ "@spyglassmc/core": "0.4.36",
21
+ "@spyglassmc/json": "0.3.40",
22
+ "@spyglassmc/locales": "0.3.19",
23
+ "@spyglassmc/mcfunction": "0.2.39",
24
+ "@spyglassmc/mcdoc": "0.3.40",
25
+ "@spyglassmc/nbt": "0.3.41"
26
26
  },
27
27
  "devDependencies": {},
28
28
  "publishConfig": {