@spyglassmc/java-edition 0.1.0 → 0.1.3
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/lib/binder/index.d.ts +3 -3
- package/lib/binder/index.js +2 -2
- package/lib/common/index.js +5 -1
- package/lib/dependency/common.d.ts +8 -5
- package/lib/dependency/common.js +15 -12
- package/lib/dependency/index.d.ts +1 -1
- package/lib/dependency/index.js +11 -7
- package/lib/dependency/mcmeta.d.ts +1 -2
- package/lib/dependency/mcmeta.js +27 -70
- package/lib/index.js +21 -5
- package/lib/json/checker/data/common.d.ts +1 -1
- package/lib/json/checker/data/index.d.ts +1 -1
- package/lib/json/checker/data/tag.js +1 -1
- package/lib/json/checker/util/block_states.js +5 -1
- package/lib/json/checker/util/index.js +5 -1
- package/lib/json/checker/util/nbt.d.ts +1 -2
- package/lib/json/checker/util/version.d.ts +12 -12
- package/lib/json/checker/util/version.js +1 -1
- package/lib/json/index.js +5 -1
- package/lib/mcfunction/checker/index.js +108 -26
- package/lib/mcfunction/colorizer/index.js +5 -1
- package/lib/mcfunction/common/index.js +5 -1
- package/lib/mcfunction/completer/argument.js +10 -6
- package/lib/mcfunction/completer/index.js +5 -1
- package/lib/mcfunction/index.d.ts +2 -2
- package/lib/mcfunction/index.js +13 -22
- package/lib/mcfunction/inlayHintProvider.js +5 -1
- package/lib/mcfunction/node/argument.d.ts +3 -1
- package/lib/mcfunction/node/argument.js +23 -11
- package/lib/mcfunction/node/index.js +5 -1
- package/lib/mcfunction/parser/argument.d.ts +2 -1
- package/lib/mcfunction/parser/argument.js +14 -10
- package/lib/mcfunction/parser/index.js +5 -1
- package/lib/mcfunction/signatureHelpProvider.js +5 -1
- package/lib/mcfunction/tree/index.d.ts +0 -5
- package/lib/mcfunction/tree/index.js +5 -6
- package/lib/mcfunction/tree/patch.d.ts +4 -0
- package/lib/mcfunction/tree/patch.js +752 -0
- package/package.json +7 -7
- package/lib/mcfunction/tree/1.15.d.ts +0 -9
- package/lib/mcfunction/tree/1.15.js +0 -542
- package/lib/mcfunction/tree/1.16.d.ts +0 -10
- package/lib/mcfunction/tree/1.16.js +0 -77
- package/lib/mcfunction/tree/1.17.d.ts +0 -12
- package/lib/mcfunction/tree/1.17.js +0 -166
- package/lib/mcfunction/tree/1.18.d.ts +0 -26
- package/lib/mcfunction/tree/1.18.js +0 -6
- package/lib/mcfunction/tree/1.19.d.ts +0 -26
- package/lib/mcfunction/tree/1.19.js +0 -6
package/lib/binder/index.d.ts
CHANGED
|
@@ -2,12 +2,12 @@ import type { ContextBase, FileCategory, RootUriString, UriBinder } from '@spygl
|
|
|
2
2
|
export declare const Categories: Map<string, {
|
|
3
3
|
category: FileCategory;
|
|
4
4
|
extname: string;
|
|
5
|
-
since?: `1.${
|
|
6
|
-
until?: `1.${
|
|
5
|
+
since?: `1.${number}` | undefined;
|
|
6
|
+
until?: `1.${number}` | undefined;
|
|
7
7
|
}>;
|
|
8
8
|
export declare function getRels(uri: string, rootUris: readonly RootUriString[]): Generator<string, undefined, unknown>;
|
|
9
9
|
export declare function dissectUri(uri: string, ctx: ContextBase): {
|
|
10
|
-
category: "function" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/
|
|
10
|
+
category: "function" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/activity" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/chunk_status" | "tag/custom_stat" | "tag/enchantment" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/int_provider_type" | "tag/item" | "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/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/particle_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/sound_event" | "tag/stat_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/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/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/template_pool" | "advancement" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure";
|
|
11
11
|
namespace: string;
|
|
12
12
|
identifier: string;
|
|
13
13
|
} | undefined;
|
package/lib/binder/index.js
CHANGED
|
@@ -93,9 +93,9 @@ const uriBinder = (uris, ctx) => {
|
|
|
93
93
|
};
|
|
94
94
|
exports.uriBinder = uriBinder;
|
|
95
95
|
function matchVersion(target, since, until) {
|
|
96
|
-
if (since && dependency_1.
|
|
96
|
+
if (since && dependency_1.ReleaseVersion.cmp(target, since) < 0)
|
|
97
97
|
return false;
|
|
98
|
-
if (until && dependency_1.
|
|
98
|
+
if (until && dependency_1.ReleaseVersion.cmp(until, target) < 0)
|
|
99
99
|
return false;
|
|
100
100
|
return true;
|
|
101
101
|
}
|
package/lib/common/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
export declare type
|
|
2
|
-
export declare namespace
|
|
1
|
+
export declare type ReleaseVersion = `1.${number}`;
|
|
2
|
+
export declare namespace ReleaseVersion {
|
|
3
3
|
/**
|
|
4
4
|
* @returns
|
|
5
5
|
* * `-1` if `a` is older than `b`.
|
|
6
6
|
* * `0` if `a` is the same as `b`.
|
|
7
7
|
* * `1` if `a` is newer than `b`.
|
|
8
8
|
*/
|
|
9
|
-
function cmp(a:
|
|
9
|
+
function cmp(a: ReleaseVersion, b: ReleaseVersion): number;
|
|
10
10
|
}
|
|
11
11
|
export interface VersionInfo {
|
|
12
|
-
|
|
12
|
+
release: ReleaseVersion;
|
|
13
13
|
id: string;
|
|
14
14
|
name: string;
|
|
15
15
|
isLatest: boolean;
|
|
16
16
|
}
|
|
17
|
-
|
|
17
|
+
/**
|
|
18
|
+
* A map from `pack_format` numbers to a RegExp. The latest version whose `release_target` matches the RegExp should be used.
|
|
19
|
+
*/
|
|
20
|
+
export declare const PackVersionMap: Record<number, RegExp | undefined>;
|
|
18
21
|
export interface PackMcmeta {
|
|
19
22
|
pack: {
|
|
20
23
|
pack_format: number;
|
package/lib/dependency/common.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.PackMcmeta = exports.PackVersionMap = exports.
|
|
4
|
-
var
|
|
5
|
-
(function (
|
|
3
|
+
exports.PackMcmeta = exports.PackVersionMap = exports.ReleaseVersion = void 0;
|
|
4
|
+
var ReleaseVersion;
|
|
5
|
+
(function (ReleaseVersion) {
|
|
6
6
|
/**
|
|
7
7
|
* @returns
|
|
8
8
|
* * `-1` if `a` is older than `b`.
|
|
@@ -10,18 +10,21 @@ var MajorVersion;
|
|
|
10
10
|
* * `1` if `a` is newer than `b`.
|
|
11
11
|
*/
|
|
12
12
|
function cmp(a, b) {
|
|
13
|
-
return Math.sign(Number(a) - Number(b));
|
|
13
|
+
return Math.sign(Number(a.slice(2)) - Number(b.slice(2)));
|
|
14
14
|
}
|
|
15
|
-
|
|
16
|
-
})(
|
|
15
|
+
ReleaseVersion.cmp = cmp;
|
|
16
|
+
})(ReleaseVersion = exports.ReleaseVersion || (exports.ReleaseVersion = {}));
|
|
17
17
|
// DOCS: Update here when format_version is changed.
|
|
18
|
+
/**
|
|
19
|
+
* A map from `pack_format` numbers to a RegExp. The latest version whose `release_target` matches the RegExp should be used.
|
|
20
|
+
*/
|
|
18
21
|
exports.PackVersionMap = {
|
|
19
|
-
5:
|
|
20
|
-
6:
|
|
21
|
-
7:
|
|
22
|
-
8:
|
|
23
|
-
9:
|
|
24
|
-
10:
|
|
22
|
+
5: /^1\.15.*$/,
|
|
23
|
+
6: /^1\.16.*$/,
|
|
24
|
+
7: /^1\.17.*$/,
|
|
25
|
+
8: /^1\.18(\.1)?$/,
|
|
26
|
+
9: /^1\.18.*$/,
|
|
27
|
+
10: /^1\.19.*$/,
|
|
25
28
|
};
|
|
26
29
|
var PackMcmeta;
|
|
27
30
|
(function (PackMcmeta) {
|
|
@@ -26,5 +26,5 @@ export declare function getMcmetaSummary(downloader: core.Downloader, logger: co
|
|
|
26
26
|
* - `startDepth`: The amount of level to skip when unzipping the tarball.
|
|
27
27
|
* - `uri`: URI to the `.tar.gz` file.
|
|
28
28
|
*/
|
|
29
|
-
export declare function
|
|
29
|
+
export declare function getVanillaMcdoc(downloader: core.Downloader, version: string, isLatest: boolean): Promise<core.Dependency>;
|
|
30
30
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/dependency/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -22,7 +26,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
26
|
return result;
|
|
23
27
|
};
|
|
24
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
25
|
-
exports.
|
|
29
|
+
exports.getVanillaMcdoc = exports.getMcmetaSummary = exports.getVersions = void 0;
|
|
26
30
|
__exportStar(require("./common"), exports);
|
|
27
31
|
__exportStar(require("./mcmeta"), exports);
|
|
28
32
|
const core = __importStar(require("@spyglassmc/core"));
|
|
@@ -154,19 +158,19 @@ async function downloadGitHubRepo({ defaultBranch, downloader, getTag, repo, isL
|
|
|
154
158
|
* - `startDepth`: The amount of level to skip when unzipping the tarball.
|
|
155
159
|
* - `uri`: URI to the `.tar.gz` file.
|
|
156
160
|
*/
|
|
157
|
-
async function
|
|
161
|
+
async function getVanillaMcdoc(downloader, version, isLatest) {
|
|
158
162
|
return {
|
|
159
163
|
info: { startDepth: 1 },
|
|
160
164
|
uri: await downloadGitHubRepo({
|
|
161
|
-
defaultBranch: '
|
|
165
|
+
defaultBranch: 'main',
|
|
162
166
|
downloader,
|
|
163
167
|
getTag: v => v,
|
|
164
168
|
isLatest,
|
|
165
|
-
owner: '
|
|
166
|
-
repo: '
|
|
169
|
+
owner: 'SpyglassMC',
|
|
170
|
+
repo: 'vanila-mcdoc',
|
|
167
171
|
version,
|
|
168
172
|
}),
|
|
169
173
|
};
|
|
170
174
|
}
|
|
171
|
-
exports.
|
|
175
|
+
exports.getVanillaMcdoc = getVanillaMcdoc;
|
|
172
176
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as core from '@spyglassmc/core';
|
|
2
|
-
import type {
|
|
3
|
-
export declare function getMajorVersion(version: McmetaVersion): MajorVersion;
|
|
2
|
+
import type { PackMcmeta, VersionInfo } from './common';
|
|
4
3
|
/**
|
|
5
4
|
* @param inputVersion {@link Config.env.gameVersion}
|
|
6
5
|
*/
|
package/lib/dependency/mcmeta.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -19,14 +23,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
19
23
|
return result;
|
|
20
24
|
};
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.Fluids = exports.symbolRegistrar = exports.getMcmetaSummaryUris = exports.resolveConfiguredVersion =
|
|
26
|
+
exports.Fluids = exports.symbolRegistrar = exports.getMcmetaSummaryUris = exports.resolveConfiguredVersion = void 0;
|
|
23
27
|
const core = __importStar(require("@spyglassmc/core"));
|
|
24
28
|
const common_1 = require("./common");
|
|
25
|
-
function getMajorVersion(version) {
|
|
26
|
-
const dotIndex = version.release_target.indexOf('.', 2);
|
|
27
|
-
return (dotIndex > 2 ? version.release_target.slice(0, dotIndex) : version.release_target);
|
|
28
|
-
}
|
|
29
|
-
exports.getMajorVersion = getMajorVersion;
|
|
30
29
|
/**
|
|
31
30
|
* @param inputVersion {@link Config.env.gameVersion}
|
|
32
31
|
*/
|
|
@@ -39,7 +38,7 @@ function resolveConfiguredVersion(inputVersion, { packMcmeta, versions }) {
|
|
|
39
38
|
return {
|
|
40
39
|
id: version.id,
|
|
41
40
|
name: version.name,
|
|
42
|
-
|
|
41
|
+
release: version.release_target,
|
|
43
42
|
isLatest: index === 0,
|
|
44
43
|
};
|
|
45
44
|
}
|
|
@@ -50,9 +49,9 @@ function resolveConfiguredVersion(inputVersion, { packMcmeta, versions }) {
|
|
|
50
49
|
versions = versions.sort((a, b) => b.data_version - a.data_version);
|
|
51
50
|
if (inputVersion === 'auto') {
|
|
52
51
|
if (packMcmeta) {
|
|
53
|
-
const
|
|
54
|
-
if (
|
|
55
|
-
return toVersionInfo(versions.findIndex(v =>
|
|
52
|
+
const regex = common_1.PackVersionMap[packMcmeta.pack.pack_format];
|
|
53
|
+
if (regex) {
|
|
54
|
+
return toVersionInfo(versions.findIndex(v => regex.test(v.release_target)));
|
|
56
55
|
}
|
|
57
56
|
}
|
|
58
57
|
return toVersionInfo(0);
|
|
@@ -66,12 +65,24 @@ function resolveConfiguredVersion(inputVersion, { packMcmeta, versions }) {
|
|
|
66
65
|
return toVersionInfo(versions.findIndex(v => inputVersion === v.id.toLowerCase() || inputVersion === v.name.toLowerCase()));
|
|
67
66
|
}
|
|
68
67
|
exports.resolveConfiguredVersion = resolveConfiguredVersion;
|
|
68
|
+
const DataSources = {
|
|
69
|
+
fastly: 'https://fastly.jsdelivr.net/gh/${user}/${repo}@${tag}/${path}',
|
|
70
|
+
github: 'https://raw.githubusercontent.com/${user}/${repo}/${tag}/${path}',
|
|
71
|
+
jsdelivr: 'https://cdn.jsdelivr.net/gh/${user}/${repo}@${tag}/${path}',
|
|
72
|
+
};
|
|
69
73
|
function getMcmetaSummaryUris(version, isLatest, source) {
|
|
70
74
|
const tag = isLatest ? 'summary' : `${version}-summary`;
|
|
71
75
|
function getUri(path) {
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
76
|
+
const template = DataSources[source.toLowerCase()] ?? source;
|
|
77
|
+
const ans = template
|
|
78
|
+
.replace(/\${user}/g, 'misode')
|
|
79
|
+
.replace(/\${repo}/g, 'mcmeta')
|
|
80
|
+
.replace(/\${tag}/g, tag)
|
|
81
|
+
.replace(/\${path}/g, path);
|
|
82
|
+
if (!core.RemoteUriString.is(ans)) {
|
|
83
|
+
throw new Error(`Expected a remote URI from data source template but got ${ans}`);
|
|
84
|
+
}
|
|
85
|
+
return ans;
|
|
75
86
|
}
|
|
76
87
|
return {
|
|
77
88
|
blocks: getUri('blocks/data.json.gz'),
|
|
@@ -82,16 +93,13 @@ function getMcmetaSummaryUris(version, isLatest, source) {
|
|
|
82
93
|
exports.getMcmetaSummaryUris = getMcmetaSummaryUris;
|
|
83
94
|
function symbolRegistrar(summary) {
|
|
84
95
|
const McmetaSummaryUri = 'mcmeta://summary/registries.json';
|
|
85
|
-
const SoundsBaseUri = 'https://misode.github.io/sounds/';
|
|
86
|
-
const WikiBaseUri = 'https://minecraft.fandom.com/wiki/';
|
|
87
|
-
const getWikiPageName = (id) => id === 'empty' ? 'Air' : id.split('_').map(v => `${v.charAt(0).toUpperCase()}${v.slice(1)}`).join('_');
|
|
88
96
|
/**
|
|
89
97
|
* Add states of blocks or fluids to the symbol table.
|
|
90
98
|
*/
|
|
91
99
|
function addStatesSymbols(category, states, symbols) {
|
|
92
100
|
const capitalizedCategory = `${category[0].toUpperCase()}${category.slice(1)}`;
|
|
93
101
|
for (const [id, [properties, defaults]] of Object.entries(states)) {
|
|
94
|
-
const uri =
|
|
102
|
+
const uri = McmetaSummaryUri;
|
|
95
103
|
symbols
|
|
96
104
|
.query(uri, category, core.ResourceLocation.lengthen(id))
|
|
97
105
|
.onEach(Object.entries(properties), ([state, values], blockQuery) => {
|
|
@@ -127,62 +135,11 @@ function symbolRegistrar(summary) {
|
|
|
127
135
|
function isCategory(str) {
|
|
128
136
|
return (core.FileCategories.includes(str) || core.RegistryCategories.includes(str));
|
|
129
137
|
}
|
|
130
|
-
const getUri = (registryId, entryId) => {
|
|
131
|
-
/* istanbul ignore next */
|
|
132
|
-
switch (registryId) {
|
|
133
|
-
case 'attribute':
|
|
134
|
-
return `${WikiBaseUri}Attribute#Attributes`;
|
|
135
|
-
case 'block':
|
|
136
|
-
case 'enchantment':
|
|
137
|
-
case 'entity_type':
|
|
138
|
-
case 'fluid':
|
|
139
|
-
case 'item':
|
|
140
|
-
case 'mob_effect':
|
|
141
|
-
return `${WikiBaseUri}${getWikiPageName(entryId)}`;
|
|
142
|
-
case 'block_entity_type':
|
|
143
|
-
return `${WikiBaseUri}${getWikiPageName(entryId)}#Block_data`;
|
|
144
|
-
case 'custom_stat':
|
|
145
|
-
return `${WikiBaseUri}Statistics#List_of_custom_statistic_names`;
|
|
146
|
-
case 'game_event':
|
|
147
|
-
return `${WikiBaseUri}Game_event`;
|
|
148
|
-
case 'loot_condition_type':
|
|
149
|
-
return `${WikiBaseUri}Predicate#JSON_structure`;
|
|
150
|
-
case 'loot_function_type':
|
|
151
|
-
return `${WikiBaseUri}Item_modifier#JSON_structure`;
|
|
152
|
-
case 'loot_number_provider_type':
|
|
153
|
-
case 'loot_score_provider_type':
|
|
154
|
-
return `${WikiBaseUri}Loot_table#Number_Providers`;
|
|
155
|
-
case 'loot_pool_entry_type':
|
|
156
|
-
return `${WikiBaseUri}Loot_table#Tags`;
|
|
157
|
-
case 'motive':
|
|
158
|
-
return `${WikiBaseUri}Painting#Canvases`;
|
|
159
|
-
case 'potion':
|
|
160
|
-
return `${WikiBaseUri}Potion#Item_data`;
|
|
161
|
-
case 'particle_type':
|
|
162
|
-
return `${WikiBaseUri}Java_Edition_data_values#Particles`;
|
|
163
|
-
case 'recipe_serializer':
|
|
164
|
-
return `${WikiBaseUri}Recipe#${entryId}`;
|
|
165
|
-
case 'sound_event':
|
|
166
|
-
return `${SoundsBaseUri}?sound=${entryId}`;
|
|
167
|
-
case 'stat_type':
|
|
168
|
-
return `${WikiBaseUri}Statistics#Statistic_types_and_names`;
|
|
169
|
-
case 'villager_profession':
|
|
170
|
-
return `${WikiBaseUri}Villager#Villager_profession`;
|
|
171
|
-
case 'villager_type':
|
|
172
|
-
return `${WikiBaseUri}Villager#Villager_type`;
|
|
173
|
-
case 'worldgen/biome_source':
|
|
174
|
-
return `${WikiBaseUri}Java_Edition_data_values#Biome_sources`;
|
|
175
|
-
case 'worldgen/chunk_generator':
|
|
176
|
-
return `${WikiBaseUri}Java_Edition_data_values#Chunk_generators`;
|
|
177
|
-
default:
|
|
178
|
-
return McmetaSummaryUri;
|
|
179
|
-
}
|
|
180
|
-
};
|
|
181
138
|
for (const [registryId, registry] of Object.entries(registries)) {
|
|
182
139
|
if (isCategory(registryId)) {
|
|
183
140
|
for (const entryId of registry) {
|
|
184
141
|
symbols
|
|
185
|
-
.query(
|
|
142
|
+
.query(McmetaSummaryUri, registryId, core.ResourceLocation.lengthen(entryId))
|
|
186
143
|
.enter({ usage: { type: 'declaration' } });
|
|
187
144
|
}
|
|
188
145
|
}
|
package/lib/index.js
CHANGED
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -21,6 +25,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
21
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
26
|
exports.initialize = exports.mcf = exports.json = exports.dependency = void 0;
|
|
23
27
|
const core = __importStar(require("@spyglassmc/core"));
|
|
28
|
+
const mcdoc = __importStar(require("@spyglassmc/mcdoc"));
|
|
24
29
|
const nbt = __importStar(require("@spyglassmc/nbt"));
|
|
25
30
|
const binder_1 = require("./binder");
|
|
26
31
|
const dependency_1 = require("./dependency");
|
|
@@ -54,8 +59,8 @@ const initialize = async (ctx) => {
|
|
|
54
59
|
return;
|
|
55
60
|
}
|
|
56
61
|
const packMcmeta = await getPackMcmeta();
|
|
57
|
-
const {
|
|
58
|
-
meta.registerDependencyProvider('@
|
|
62
|
+
const { release, id: version, isLatest } = (0, dependency_1.resolveConfiguredVersion)(config.env.gameVersion, { packMcmeta, versions });
|
|
63
|
+
meta.registerDependencyProvider('@vanilla-mcdoc', () => (0, dependency_1.getVanillaMcdoc)(downloader, version, isLatest));
|
|
59
64
|
const summary = await (0, dependency_1.getMcmetaSummary)(downloader, logger, version, isLatest, config.env.dataSource, config.env.mcmetaSummaryOverrides);
|
|
60
65
|
if (!summary.blocks || !summary.commands || !summary.fluids || !summary.registries) {
|
|
61
66
|
ctx.logger.error('[je-initialize] Failed loading mcmeta summaries. Expect everything to be broken.');
|
|
@@ -65,11 +70,22 @@ const initialize = async (ctx) => {
|
|
|
65
70
|
checksum: summary.checksum,
|
|
66
71
|
registrar: (0, dependency_1.symbolRegistrar)(summary),
|
|
67
72
|
});
|
|
73
|
+
meta.registerLinter('nameOfNbtKey', {
|
|
74
|
+
configValidator: core.linter.configValidator.nameConvention,
|
|
75
|
+
linter: core.linter.nameConvention('value'),
|
|
76
|
+
nodePredicate: n => (
|
|
77
|
+
// nbt compound keys without mcdoc definition.
|
|
78
|
+
(!n.symbol && n.parent?.parent?.type === 'nbt:compound' && core.PairNode.is(n.parent) && n.type === 'string' && n.parent.key === n) ||
|
|
79
|
+
// nbt path keys without mcdoc definition.
|
|
80
|
+
(!n.symbol && n.parent?.type === 'nbt:path' && n.type === 'string') ||
|
|
81
|
+
// mcdoc compound key definition outside of `::minecraft` modules.
|
|
82
|
+
(mcdoc.StructFieldNode.is(n.parent) && mcdoc.StructKeyNode.is(n) && !n.symbol?.path[0]?.startsWith('::minecraft'))),
|
|
83
|
+
});
|
|
68
84
|
jeJson.initialize(ctx);
|
|
69
|
-
jeMcf.initialize(ctx, summary.commands,
|
|
85
|
+
jeMcf.initialize(ctx, summary.commands, release);
|
|
70
86
|
nbt.initialize(ctx);
|
|
71
87
|
return {
|
|
72
|
-
loadedVersion:
|
|
88
|
+
loadedVersion: release,
|
|
73
89
|
};
|
|
74
90
|
};
|
|
75
91
|
exports.initialize = initialize;
|
|
@@ -13,7 +13,7 @@ export declare const vertical_anchor: JsonChecker;
|
|
|
13
13
|
export declare const height_provider: JsonChecker;
|
|
14
14
|
export declare const floatProvider: (min?: number | undefined, max?: number | undefined) => JsonChecker;
|
|
15
15
|
export declare const intProvider: (min?: number | undefined, max?: number | undefined) => JsonChecker;
|
|
16
|
-
export declare const uniformInt: (min?: number
|
|
16
|
+
export declare const uniformInt: (min?: number, max?: number, maxSpread?: number) => JsonChecker;
|
|
17
17
|
export declare const inclusiveRange: (min?: number | undefined, max?: number | undefined) => JsonChecker;
|
|
18
18
|
export declare const noise_parameters: JsonChecker;
|
|
19
19
|
export declare const HeightmapType: string[];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
|
|
2
2
|
export declare const pack_mcmeta: JsonChecker;
|
|
3
|
-
export declare const Checkers: Map<"function" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/
|
|
3
|
+
export declare const Checkers: Map<"function" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/activity" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/chunk_status" | "tag/custom_stat" | "tag/enchantment" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/int_provider_type" | "tag/item" | "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/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/particle_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/sound_event" | "tag/stat_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/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/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/template_pool" | "advancement" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure", JsonChecker>;
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -26,7 +26,7 @@ const tag = (type) => (0, primitives_1.record)({
|
|
|
26
26
|
}
|
|
27
27
|
return [undefined, node];
|
|
28
28
|
},
|
|
29
|
-
report: (node, ctx) => ctx.err.report((0, lib_2.localize)('json.checker.tag-entry.duplicate'), node, 2 /* Warning */),
|
|
29
|
+
report: (node, ctx) => ctx.err.report((0, lib_2.localize)('json.checker.tag-entry.duplicate'), node, 2 /* ErrorSeverity.Warning */),
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
32
32
|
exports.block_tag = tag('block');
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
3
|
if (k2 === undefined) k2 = k;
|
|
4
|
-
Object.
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
5
9
|
}) : (function(o, m, k, k2) {
|
|
6
10
|
if (k2 === undefined) k2 = k;
|
|
7
11
|
o[k2] = m[k];
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
|
|
2
|
-
import type { ExtendableRootRegistry } from '@spyglassmc/nbtdoc';
|
|
3
2
|
interface DefinitionOptions {
|
|
4
3
|
definition: `::${string}::${string}`;
|
|
5
4
|
}
|
|
6
5
|
interface RegistryOptions {
|
|
7
|
-
registry:
|
|
6
|
+
registry: string;
|
|
8
7
|
id?: string | undefined;
|
|
9
8
|
idOrTag?: string | undefined;
|
|
10
9
|
ids?: readonly string[] | undefined;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import type { JsonChecker, JsonCheckerContext, record } from '@spyglassmc/json/lib/checker';
|
|
2
|
-
import {
|
|
2
|
+
import { ReleaseVersion } from '../../../dependency';
|
|
3
3
|
declare type CheckerRecord = Parameters<typeof record>[0];
|
|
4
|
-
export declare function versioned(ctx: JsonCheckerContext, version:
|
|
5
|
-
export declare function versioned(ctx: JsonCheckerContext, version:
|
|
6
|
-
export declare function versioned(ctx: JsonCheckerContext, version:
|
|
7
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: string[], version:
|
|
8
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: JsonChecker | undefined, version:
|
|
9
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: CheckerRecord | undefined, version:
|
|
10
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: string[], version:
|
|
11
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: JsonChecker, version:
|
|
12
|
-
export declare function versioned(ctx: JsonCheckerContext, checker: CheckerRecord, version:
|
|
13
|
-
export declare function renamed(ctx: JsonCheckerContext, from: string, version:
|
|
14
|
-
export declare function deprecated(ctx: JsonCheckerContext, version:
|
|
4
|
+
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: string[]): string[];
|
|
5
|
+
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: JsonChecker | undefined): JsonChecker | undefined;
|
|
6
|
+
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: CheckerRecord | undefined): CheckerRecord | undefined;
|
|
7
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: string[], version: ReleaseVersion): string[];
|
|
8
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: JsonChecker | undefined, version: ReleaseVersion): JsonChecker | undefined;
|
|
9
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: CheckerRecord | undefined, version: ReleaseVersion): CheckerRecord | undefined;
|
|
10
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: string[], version: ReleaseVersion, checker2: string[]): string[];
|
|
11
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: JsonChecker, version: ReleaseVersion, checker2: JsonChecker): JsonChecker;
|
|
12
|
+
export declare function versioned(ctx: JsonCheckerContext, checker: CheckerRecord, version: ReleaseVersion, checker2: CheckerRecord): CheckerRecord;
|
|
13
|
+
export declare function renamed(ctx: JsonCheckerContext, from: string, version: ReleaseVersion, to: string, checker: JsonChecker): CheckerRecord | undefined;
|
|
14
|
+
export declare function deprecated(ctx: JsonCheckerContext, version: ReleaseVersion, checker: JsonChecker | undefined): JsonChecker | {
|
|
15
15
|
checker: JsonChecker;
|
|
16
16
|
opt?: boolean | undefined;
|
|
17
17
|
def?: (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | (string | number | boolean | any | {
|
|
@@ -7,7 +7,7 @@ function getVersion(ctx) {
|
|
|
7
7
|
return ctx.project['loadedVersion'];
|
|
8
8
|
}
|
|
9
9
|
function cmpVersion(ctx, target) {
|
|
10
|
-
return dependency_1.
|
|
10
|
+
return dependency_1.ReleaseVersion.cmp(getVersion(ctx), target);
|
|
11
11
|
}
|
|
12
12
|
function versioned(ctx, arg1, arg2, arg3) {
|
|
13
13
|
if (typeof arg1 === 'string') {
|
package/lib/json/index.js
CHANGED
|
@@ -2,7 +2,11 @@
|
|
|
2
2
|
/* istanbul ignore file */
|
|
3
3
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
4
4
|
if (k2 === undefined) k2 = k;
|
|
5
|
-
Object.
|
|
5
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
6
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
7
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
8
|
+
}
|
|
9
|
+
Object.defineProperty(o, k2, desc);
|
|
6
10
|
}) : (function(o, m, k, k2) {
|
|
7
11
|
if (k2 === undefined) k2 = k;
|
|
8
12
|
o[k2] = m[k];
|