@spyglassmc/java-edition 0.1.1 → 0.2.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/lib/binder/index.d.ts +3 -3
- package/lib/binder/index.js +11 -17
- package/lib/common/index.js +4 -28
- package/lib/dependency/common.d.ts +8 -5
- package/lib/dependency/common.js +18 -18
- package/lib/dependency/index.d.ts +6 -6
- package/lib/dependency/index.js +21 -48
- package/lib/dependency/mcmeta.d.ts +2 -3
- package/lib/dependency/mcmeta.js +28 -100
- package/lib/index.d.ts +3 -3
- package/lib/index.js +27 -50
- package/lib/json/checker/data/advancement.d.ts +13 -13
- package/lib/json/checker/data/advancement.js +259 -262
- package/lib/json/checker/data/biome.d.ts +3 -3
- package/lib/json/checker/data/biome.js +98 -101
- package/lib/json/checker/data/common.d.ts +2 -2
- package/lib/json/checker/data/common.js +145 -152
- package/lib/json/checker/data/dimension.d.ts +3 -3
- package/lib/json/checker/data/dimension.js +148 -151
- package/lib/json/checker/data/feature.d.ts +8 -8
- package/lib/json/checker/data/feature.js +369 -372
- package/lib/json/checker/data/index.d.ts +2 -2
- package/lib/json/checker/data/index.js +36 -39
- package/lib/json/checker/data/loot_table.d.ts +7 -7
- package/lib/json/checker/data/loot_table.js +125 -128
- package/lib/json/checker/data/recipe.d.ts +1 -1
- package/lib/json/checker/data/recipe.js +25 -28
- package/lib/json/checker/data/structure.d.ts +7 -7
- package/lib/json/checker/data/structure.js +80 -83
- package/lib/json/checker/data/tag.js +23 -26
- package/lib/json/checker/data/text_component.d.ts +1 -1
- package/lib/json/checker/data/text_component.js +61 -64
- package/lib/json/checker/index.js +14 -19
- package/lib/json/checker/util/advancement.d.ts +1 -1
- package/lib/json/checker/util/advancement.js +4 -8
- package/lib/json/checker/util/block_states.d.ts +1 -1
- package/lib/json/checker/util/block_states.js +21 -45
- package/lib/json/checker/util/color.d.ts +1 -1
- package/lib/json/checker/util/color.js +20 -25
- package/lib/json/checker/util/index.d.ts +7 -7
- package/lib/json/checker/util/index.js +7 -19
- package/lib/json/checker/util/nbt.d.ts +2 -3
- package/lib/json/checker/util/nbt.js +17 -22
- package/lib/json/checker/util/recipe.d.ts +1 -1
- package/lib/json/checker/util/recipe.js +4 -8
- package/lib/json/checker/util/uuid.d.ts +1 -1
- package/lib/json/checker/util/uuid.js +4 -7
- package/lib/json/checker/util/version.d.ts +13 -13
- package/lib/json/checker/util/version.js +7 -13
- package/lib/json/index.d.ts +1 -1
- package/lib/json/index.js +4 -27
- package/lib/mcfunction/checker/index.d.ts +1 -1
- package/lib/mcfunction/checker/index.js +79 -103
- package/lib/mcfunction/colorizer/index.d.ts +1 -1
- package/lib/mcfunction/colorizer/index.js +6 -31
- package/lib/mcfunction/common/index.js +7 -29
- package/lib/mcfunction/completer/argument.js +95 -119
- package/lib/mcfunction/completer/index.d.ts +1 -1
- package/lib/mcfunction/completer/index.js +1 -13
- package/lib/mcfunction/index.d.ts +6 -6
- package/lib/mcfunction/index.js +19 -54
- package/lib/mcfunction/inlayHintProvider.js +3 -26
- package/lib/mcfunction/node/argument.d.ts +3 -3
- package/lib/mcfunction/node/argument.js +47 -69
- package/lib/mcfunction/node/index.d.ts +1 -1
- package/lib/mcfunction/node/index.js +1 -13
- package/lib/mcfunction/parser/argument.d.ts +1 -1
- package/lib/mcfunction/parser/argument.js +76 -101
- package/lib/mcfunction/parser/index.d.ts +1 -1
- package/lib/mcfunction/parser/index.js +1 -13
- package/lib/mcfunction/signatureHelpProvider.js +3 -26
- package/lib/mcfunction/tree/argument.js +1 -2
- package/lib/mcfunction/tree/index.d.ts +1 -6
- package/lib/mcfunction/tree/index.js +1 -18
- package/lib/mcfunction/tree/patch.d.ts +4 -0
- package/lib/mcfunction/tree/patch.js +748 -0
- package/package.json +8 -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/index.js
CHANGED
|
@@ -1,88 +1,65 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
});
|
|
14
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
-
if (mod && mod.__esModule) return mod;
|
|
16
|
-
var result = {};
|
|
17
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
-
__setModuleDefault(result, mod);
|
|
19
|
-
return result;
|
|
20
|
-
};
|
|
21
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
-
exports.initialize = exports.mcf = exports.json = exports.dependency = void 0;
|
|
23
|
-
const core = __importStar(require("@spyglassmc/core"));
|
|
24
|
-
const nbt = __importStar(require("@spyglassmc/nbt"));
|
|
25
|
-
const nbtdoc = __importStar(require("@spyglassmc/nbtdoc"));
|
|
26
|
-
const binder_1 = require("./binder");
|
|
27
|
-
const dependency_1 = require("./dependency");
|
|
28
|
-
const jeJson = __importStar(require("./json"));
|
|
29
|
-
const jeMcf = __importStar(require("./mcfunction"));
|
|
30
|
-
exports.dependency = __importStar(require("./dependency"));
|
|
31
|
-
exports.json = __importStar(require("./json"));
|
|
32
|
-
exports.mcf = __importStar(require("./mcfunction"));
|
|
33
|
-
const initialize = async (ctx) => {
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
|
+
import * as mcdoc from '@spyglassmc/mcdoc';
|
|
3
|
+
import * as nbt from '@spyglassmc/nbt';
|
|
4
|
+
import { uriBinder } from './binder/index.js';
|
|
5
|
+
import { getMcmetaSummary, getVanillaMcdoc, getVersions, PackMcmeta, resolveConfiguredVersion, symbolRegistrar } from './dependency/index.js';
|
|
6
|
+
import * as jeJson from './json/index.js';
|
|
7
|
+
import * as jeMcf from './mcfunction/index.js';
|
|
8
|
+
export * as dependency from './dependency/index.js';
|
|
9
|
+
export * as json from './json/index.js';
|
|
10
|
+
export * as mcf from './mcfunction/index.js';
|
|
11
|
+
export const initialize = async (ctx) => {
|
|
12
|
+
const { config, downloader, externals, logger, meta, projectRoot } = ctx;
|
|
34
13
|
async function getPackMcmeta() {
|
|
35
14
|
let ans;
|
|
36
15
|
const uri = `${projectRoot}pack.mcmeta`;
|
|
37
16
|
try {
|
|
38
|
-
const data = await core.fileUtil.readJson(uri);
|
|
39
|
-
|
|
17
|
+
const data = await core.fileUtil.readJson(externals, uri);
|
|
18
|
+
PackMcmeta.assert(data);
|
|
40
19
|
ans = data;
|
|
41
20
|
}
|
|
42
21
|
catch (e) {
|
|
43
|
-
if (!
|
|
22
|
+
if (!externals.error.isKind(e, 'ENOENT')) {
|
|
44
23
|
// `pack.mcmeta` exists but broken. Log an error.
|
|
45
24
|
logger.error(`[je.initialize] Failed loading pack.mcmeta “${uri}”`, e);
|
|
46
25
|
}
|
|
47
26
|
}
|
|
48
27
|
return ans;
|
|
49
28
|
}
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
const versions = await (0, dependency_1.getVersions)(ctx.downloader);
|
|
29
|
+
meta.registerUriBinder(uriBinder);
|
|
30
|
+
const versions = await getVersions(ctx.externals, ctx.downloader);
|
|
53
31
|
if (!versions) {
|
|
54
32
|
ctx.logger.error('[je-initialize] Failed loading game version list. Expect everything to be broken.');
|
|
55
33
|
return;
|
|
56
34
|
}
|
|
57
35
|
const packMcmeta = await getPackMcmeta();
|
|
58
|
-
const {
|
|
59
|
-
meta.registerDependencyProvider('@
|
|
60
|
-
const summary = await (
|
|
36
|
+
const { release, id: version, isLatest } = resolveConfiguredVersion(config.env.gameVersion, { packMcmeta, versions });
|
|
37
|
+
meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(externals, downloader, version, isLatest));
|
|
38
|
+
const summary = await getMcmetaSummary(ctx.externals, downloader, logger, version, isLatest, config.env.dataSource, config.env.mcmetaSummaryOverrides);
|
|
61
39
|
if (!summary.blocks || !summary.commands || !summary.fluids || !summary.registries) {
|
|
62
40
|
ctx.logger.error('[je-initialize] Failed loading mcmeta summaries. Expect everything to be broken.');
|
|
63
41
|
return;
|
|
64
42
|
}
|
|
65
43
|
meta.registerSymbolRegistrar('mcmeta-summary', {
|
|
66
44
|
checksum: summary.checksum,
|
|
67
|
-
registrar:
|
|
45
|
+
registrar: symbolRegistrar(summary),
|
|
68
46
|
});
|
|
69
47
|
meta.registerLinter('nameOfNbtKey', {
|
|
70
48
|
configValidator: core.linter.configValidator.nameConvention,
|
|
71
49
|
linter: core.linter.nameConvention('value'),
|
|
72
50
|
nodePredicate: n => (
|
|
73
|
-
// nbt compound keys without
|
|
51
|
+
// nbt compound keys without mcdoc definition.
|
|
74
52
|
(!n.symbol && n.parent?.parent?.type === 'nbt:compound' && core.PairNode.is(n.parent) && n.type === 'string' && n.parent.key === n) ||
|
|
75
|
-
// nbt path keys without
|
|
53
|
+
// nbt path keys without mcdoc definition.
|
|
76
54
|
(!n.symbol && n.parent?.type === 'nbt:path' && n.type === 'string') ||
|
|
77
|
-
//
|
|
78
|
-
(
|
|
55
|
+
// mcdoc compound key definition outside of `::minecraft` modules.
|
|
56
|
+
(mcdoc.StructFieldNode.is(n.parent) && mcdoc.StructKeyNode.is(n) && !n.symbol?.path[0]?.startsWith('::minecraft'))),
|
|
79
57
|
});
|
|
80
58
|
jeJson.initialize(ctx);
|
|
81
|
-
jeMcf.initialize(ctx, summary.commands,
|
|
59
|
+
jeMcf.initialize(ctx, summary.commands, release);
|
|
82
60
|
nbt.initialize(ctx);
|
|
83
61
|
return {
|
|
84
|
-
loadedVersion:
|
|
62
|
+
loadedVersion: release,
|
|
85
63
|
};
|
|
86
64
|
};
|
|
87
|
-
exports.initialize = initialize;
|
|
88
65
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
export declare const item_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
2
|
-
export declare const block_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
3
|
-
export declare const fluid_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
4
|
-
export declare const location_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
5
|
-
export declare const distance_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
6
|
-
export declare const mob_effect_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
7
|
-
export declare const statistic_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
8
|
-
export declare const player_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
9
|
-
export declare const entity_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
10
|
-
export declare const damage_source_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
11
|
-
export declare const damage_predicate: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
12
|
-
export declare const criterion: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
13
|
-
export declare const advancement: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
1
|
+
export declare const item_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
2
|
+
export declare const block_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
3
|
+
export declare const fluid_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
4
|
+
export declare const location_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
5
|
+
export declare const distance_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
6
|
+
export declare const mob_effect_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
7
|
+
export declare const statistic_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
8
|
+
export declare const player_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
9
|
+
export declare const entity_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
10
|
+
export declare const damage_source_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
11
|
+
export declare const damage_predicate: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
12
|
+
export declare const criterion: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
13
|
+
export declare const advancement: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
14
14
|
//# sourceMappingURL=advancement.d.ts.map
|