@spyglassmc/java-edition 0.3.2 → 0.3.4
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 +1 -1
- package/lib/binder/index.js +21 -5
- package/lib/dependency/common.d.ts +1 -5
- package/lib/dependency/common.js +0 -15
- package/lib/dependency/index.d.ts +8 -0
- package/lib/dependency/index.js +23 -1
- package/lib/dependency/mcmeta.d.ts +4 -4
- package/lib/dependency/mcmeta.js +50 -17
- package/lib/index.js +6 -1
- package/lib/json/checker/index.js +2 -1
- package/lib/mcfunction/checker/index.js +5 -6
- package/lib/mcfunction/common/index.d.ts +4 -0
- package/lib/mcfunction/common/index.js +25 -0
- package/lib/mcfunction/completer/argument.js +10 -1
- package/lib/mcfunction/index.js +13 -1
- package/lib/mcfunction/inlayHintProvider.js +2 -1
- package/lib/mcfunction/node/argument.d.ts +5 -5
- package/lib/mcfunction/parser/argument.js +56 -24
- package/lib/mcfunction/signatureHelpProvider.js +3 -1
- package/lib/mcfunction/tree/argument.d.ts +19 -1
- package/lib/mcfunction/tree/patch.js +39 -1
- package/package.json +7 -7
- package/lib/json/checker/data/advancement.d.ts +0 -14
- package/lib/json/checker/data/advancement.js +0 -458
- package/lib/json/checker/data/biome.d.ts +0 -4
- package/lib/json/checker/data/biome.js +0 -148
- package/lib/json/checker/data/common.d.ts +0 -22
- package/lib/json/checker/data/common.js +0 -267
- package/lib/json/checker/data/dimension.d.ts +0 -4
- package/lib/json/checker/data/dimension.js +0 -224
- package/lib/json/checker/data/feature.d.ts +0 -9
- package/lib/json/checker/data/feature.js +0 -744
- package/lib/json/checker/data/index.d.ts +0 -4
- package/lib/json/checker/data/index.js +0 -40
- package/lib/json/checker/data/loot_table.d.ts +0 -8
- package/lib/json/checker/data/loot_table.js +0 -275
- package/lib/json/checker/data/recipe.d.ts +0 -2
- package/lib/json/checker/data/recipe.js +0 -50
- package/lib/json/checker/data/structure.d.ts +0 -8
- package/lib/json/checker/data/structure.js +0 -153
- package/lib/json/checker/data/tag.d.ts +0 -7
- package/lib/json/checker/data/tag.js +0 -35
- package/lib/json/checker/data/text_component.d.ts +0 -2
- package/lib/json/checker/data/text_component.js +0 -148
- package/lib/json/checker/util/advancement.d.ts +0 -3
- package/lib/json/checker/util/advancement.js +0 -16
- package/lib/json/checker/util/block_states.d.ts +0 -13
- package/lib/json/checker/util/block_states.js +0 -63
- package/lib/json/checker/util/color.d.ts +0 -4
- package/lib/json/checker/util/color.js +0 -65
- package/lib/json/checker/util/index.d.ts +0 -8
- package/lib/json/checker/util/index.js +0 -8
- package/lib/json/checker/util/nbt.d.ts +0 -16
- package/lib/json/checker/util/nbt.js +0 -67
- package/lib/json/checker/util/recipe.d.ts +0 -6
- package/lib/json/checker/util/recipe.js +0 -13
- package/lib/json/checker/util/uuid.d.ts +0 -2
- package/lib/json/checker/util/uuid.js +0 -9
- package/lib/json/checker/util/version.d.ts +0 -46
- package/lib/json/checker/util/version.js +0 -48
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
import { integer } from '@spyglassmc/core';
|
|
2
|
-
import { any, as, boolean, dispatch, extract, having, int, listOf, literal, opt, pick, record, ref, resource, simpleString, string, } from '@spyglassmc/json/lib/checker/primitives/index.js';
|
|
3
|
-
import { deprecated, nbt, nbtPath, stringColor, uuid, versioned, } from '../util/index.js';
|
|
4
|
-
const Keybinds = [
|
|
5
|
-
'key.jump',
|
|
6
|
-
'key.sneak',
|
|
7
|
-
'key.sprint',
|
|
8
|
-
'key.left',
|
|
9
|
-
'key.right',
|
|
10
|
-
'key.back',
|
|
11
|
-
'key.forward',
|
|
12
|
-
'key.attack',
|
|
13
|
-
'key.pickItem',
|
|
14
|
-
'key.use',
|
|
15
|
-
'key.drop',
|
|
16
|
-
'key.hotbar.1',
|
|
17
|
-
'key.hotbar.2',
|
|
18
|
-
'key.hotbar.3',
|
|
19
|
-
'key.hotbar.4',
|
|
20
|
-
'key.hotbar.5',
|
|
21
|
-
'key.hotbar.6',
|
|
22
|
-
'key.hotbar.7',
|
|
23
|
-
'key.hotbar.8',
|
|
24
|
-
'key.hotbar.9',
|
|
25
|
-
'key.inventory',
|
|
26
|
-
'key.swapOffhand',
|
|
27
|
-
'key.loadToolbarActivator',
|
|
28
|
-
'key.saveToolbarActivator',
|
|
29
|
-
'key.playerlist',
|
|
30
|
-
'key.chat',
|
|
31
|
-
'key.command',
|
|
32
|
-
'key.socialInteractions',
|
|
33
|
-
'key.advancements',
|
|
34
|
-
'key.spectatorOutlines',
|
|
35
|
-
'key.screenshot',
|
|
36
|
-
'key.smoothCamera',
|
|
37
|
-
'key.fullscreen',
|
|
38
|
-
'key.togglePerspective',
|
|
39
|
-
];
|
|
40
|
-
const text_component_object = as('text_component', (node, ctx) => record({
|
|
41
|
-
...having(node, ctx, {
|
|
42
|
-
text: {
|
|
43
|
-
text: simpleString,
|
|
44
|
-
},
|
|
45
|
-
translate: {
|
|
46
|
-
translate: simpleString,
|
|
47
|
-
with: opt(listOf(text_component), []),
|
|
48
|
-
},
|
|
49
|
-
selector: {
|
|
50
|
-
selector: simpleString,
|
|
51
|
-
separator: opt(versioned(ctx, '1.17', text_component)),
|
|
52
|
-
},
|
|
53
|
-
score: {
|
|
54
|
-
score: record({
|
|
55
|
-
name: simpleString,
|
|
56
|
-
objective: simpleString,
|
|
57
|
-
value: opt(simpleString),
|
|
58
|
-
}),
|
|
59
|
-
},
|
|
60
|
-
keybind: {
|
|
61
|
-
keybind: literal(Keybinds),
|
|
62
|
-
},
|
|
63
|
-
nbt: () => ({
|
|
64
|
-
nbt: simpleString,
|
|
65
|
-
...having(node, ctx, {
|
|
66
|
-
block: {
|
|
67
|
-
block: simpleString,
|
|
68
|
-
nbt: nbtPath({ registry: 'block' }),
|
|
69
|
-
},
|
|
70
|
-
entity: {
|
|
71
|
-
entity: simpleString,
|
|
72
|
-
nbt: nbtPath({
|
|
73
|
-
registry: 'entity_type' /* FIXME: import { getTypesFromEntity } from '../../../../mcfunction/checker'; ids: getTypesFromEntity(somehowGetTheNodeHere, ctx) */,
|
|
74
|
-
}),
|
|
75
|
-
},
|
|
76
|
-
storage: {
|
|
77
|
-
storage: resource('storage'),
|
|
78
|
-
nbt: nbtPath({
|
|
79
|
-
registry: 'storage' /* FIXME:, id: extract('storage', props) */,
|
|
80
|
-
}),
|
|
81
|
-
},
|
|
82
|
-
}),
|
|
83
|
-
interpret: opt(boolean, false),
|
|
84
|
-
separator: opt(versioned(ctx, '1.17', text_component)),
|
|
85
|
-
}),
|
|
86
|
-
}),
|
|
87
|
-
color: opt(stringColor()),
|
|
88
|
-
font: opt(simpleString),
|
|
89
|
-
bold: opt(boolean),
|
|
90
|
-
italic: opt(boolean),
|
|
91
|
-
underlined: opt(boolean),
|
|
92
|
-
strikethrough: opt(boolean),
|
|
93
|
-
obfuscated: opt(boolean),
|
|
94
|
-
insertion: opt(simpleString),
|
|
95
|
-
clickEvent: opt(dispatch('action', (action) => record({
|
|
96
|
-
action: literal([
|
|
97
|
-
'open_url',
|
|
98
|
-
'open_file',
|
|
99
|
-
'run_command',
|
|
100
|
-
'suggest_command',
|
|
101
|
-
'change_page',
|
|
102
|
-
'copy_to_clipboard',
|
|
103
|
-
]),
|
|
104
|
-
value: simpleString,
|
|
105
|
-
...pick(action, {
|
|
106
|
-
run_command: {
|
|
107
|
-
value: string('command', ctx.meta.getParserLazily('mcfunction:command'), ctx.meta.getChecker('mcfunction:command')),
|
|
108
|
-
},
|
|
109
|
-
change_page: {
|
|
110
|
-
value: string('number', integer({ pattern: /\d+/, min: 0 })),
|
|
111
|
-
},
|
|
112
|
-
}),
|
|
113
|
-
}))),
|
|
114
|
-
hoverEvent: opt(dispatch('action', (action, _, ctx) => record({
|
|
115
|
-
action: literal(['show_text', 'show_item', 'show_entity']),
|
|
116
|
-
...pick(action, {
|
|
117
|
-
show_text: {
|
|
118
|
-
value: deprecated(ctx, '1.16', text_component),
|
|
119
|
-
contents: opt(versioned(ctx, '1.16', text_component)),
|
|
120
|
-
},
|
|
121
|
-
show_item: {
|
|
122
|
-
value: deprecated(ctx, '1.16', nbt({
|
|
123
|
-
definition: '::minecraft::util::invitem::InventoryItem',
|
|
124
|
-
})),
|
|
125
|
-
contents: opt(versioned(ctx, '1.16', dispatch((props) => record({
|
|
126
|
-
id: resource('item'),
|
|
127
|
-
count: opt(int),
|
|
128
|
-
tag: opt(nbt({ registry: 'item', id: extract('id', props) })),
|
|
129
|
-
})))),
|
|
130
|
-
},
|
|
131
|
-
show_entity: {
|
|
132
|
-
value: deprecated(ctx, '1.16', record({
|
|
133
|
-
name: opt(simpleString),
|
|
134
|
-
type: opt(resource('entity_type')),
|
|
135
|
-
id: opt(uuid),
|
|
136
|
-
})),
|
|
137
|
-
contents: opt(versioned(ctx, '1.16', record({
|
|
138
|
-
name: opt(text_component),
|
|
139
|
-
type: opt(resource('entity_type')),
|
|
140
|
-
id: opt(uuid),
|
|
141
|
-
}))),
|
|
142
|
-
},
|
|
143
|
-
}),
|
|
144
|
-
}))),
|
|
145
|
-
extra: opt(listOf(text_component)),
|
|
146
|
-
})(node, ctx));
|
|
147
|
-
export const text_component = as('text_component', any([simpleString, text_component_object, listOf(ref(() => text_component))]));
|
|
148
|
-
//# sourceMappingURL=text_component.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { literal, simpleString } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
-
export function criterionReference(advancement) {
|
|
3
|
-
return (node, ctx) => {
|
|
4
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
5
|
-
if (!ctx.ensureBindingStarted) {
|
|
6
|
-
simpleString(node, ctx);
|
|
7
|
-
return;
|
|
8
|
-
}
|
|
9
|
-
const criteria = Object.values(ctx.symbols.query(ctx.doc, 'advancement', advancement).symbol?.members ??
|
|
10
|
-
{})
|
|
11
|
-
.filter((m) => m?.subcategory === 'criterion')
|
|
12
|
-
.map((s) => s.identifier);
|
|
13
|
-
literal(criteria)(node, ctx);
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
//# sourceMappingURL=advancement.js.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
|
|
2
|
-
interface Options {
|
|
3
|
-
category?: 'block' | 'fluid';
|
|
4
|
-
id?: string | undefined;
|
|
5
|
-
ids?: readonly string[] | undefined;
|
|
6
|
-
tag?: string | undefined;
|
|
7
|
-
mixedTypes?: boolean;
|
|
8
|
-
requireAll?: boolean;
|
|
9
|
-
}
|
|
10
|
-
export declare function blockStateMap({ category, id, ids, tag, mixedTypes, requireAll, }: Options): JsonChecker;
|
|
11
|
-
export declare function blockStateList({ category, id, ids, tag, }: Options): JsonChecker;
|
|
12
|
-
export {};
|
|
13
|
-
//# sourceMappingURL=block_states.d.ts.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import * as core from '@spyglassmc/core';
|
|
2
|
-
import { any, boolean, intRange, listOf, literal, object, opt, record, simpleString, } from '@spyglassmc/json/lib/checker/index.js';
|
|
3
|
-
import { getTagValues } from '../../../common/index.js';
|
|
4
|
-
export function blockStateMap({ category, id, ids, tag, mixedTypes, requireAll, }) {
|
|
5
|
-
return (node, ctx) => {
|
|
6
|
-
if (tag) {
|
|
7
|
-
ids = getTagValues(`tag/${category ?? 'block'}`, tag, ctx);
|
|
8
|
-
}
|
|
9
|
-
else if (id) {
|
|
10
|
-
ids = [id];
|
|
11
|
-
}
|
|
12
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
13
|
-
if (!ids?.length || !ctx.ensureBindingStarted) {
|
|
14
|
-
const values = mixedTypes
|
|
15
|
-
? any([boolean, simpleString, intBounds()])
|
|
16
|
-
: simpleString;
|
|
17
|
-
object(simpleString, () => (requireAll ? values : opt(values)))(node, ctx);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
const states = core.getStates(category ?? 'block', ids, ctx);
|
|
21
|
-
object(Object.keys(states), (state) => {
|
|
22
|
-
const values = states[state] ?? [];
|
|
23
|
-
const checkers = [literal(values)];
|
|
24
|
-
if (mixedTypes && values.length) {
|
|
25
|
-
if (['true', 'false'].includes(values[0])) {
|
|
26
|
-
checkers.push(boolean);
|
|
27
|
-
}
|
|
28
|
-
else if (values[0].match(/^\d+$/)) {
|
|
29
|
-
checkers.push(intBounds(parseInt(values[0]), parseInt(values[values.length - 1])));
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
const checker = checkers.length > 1 ? any(checkers) : checkers[0];
|
|
33
|
-
return requireAll ? checker : opt(checker);
|
|
34
|
-
})(node, ctx);
|
|
35
|
-
};
|
|
36
|
-
}
|
|
37
|
-
export function blockStateList({ category, id, ids, tag, }) {
|
|
38
|
-
return (node, ctx) => {
|
|
39
|
-
if (tag) {
|
|
40
|
-
ids = getTagValues(`tag/${category ?? 'block'}`, tag, ctx);
|
|
41
|
-
}
|
|
42
|
-
else if (id) {
|
|
43
|
-
ids = [id];
|
|
44
|
-
}
|
|
45
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
46
|
-
if (!ids?.length || !ctx.ensureBindingStarted) {
|
|
47
|
-
listOf(simpleString)(node, ctx);
|
|
48
|
-
return;
|
|
49
|
-
}
|
|
50
|
-
const states = core.getStates(category ?? 'block', ids, ctx);
|
|
51
|
-
listOf(literal(Object.keys(states)))(node, ctx);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function intBounds(min = undefined, max = undefined) {
|
|
55
|
-
return any([
|
|
56
|
-
intRange(min, max),
|
|
57
|
-
record({
|
|
58
|
-
min: opt(intRange(min, max)),
|
|
59
|
-
max: opt(intRange(min, max)),
|
|
60
|
-
}),
|
|
61
|
-
]);
|
|
62
|
-
}
|
|
63
|
-
//# sourceMappingURL=block_states.js.map
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { Color, ColorFormat, Failure, parseStringValue, Range, } from '@spyglassmc/core';
|
|
2
|
-
import { JsonNumberNode, JsonStringNode } from '@spyglassmc/json';
|
|
3
|
-
import { localize } from '@spyglassmc/locales';
|
|
4
|
-
export function stringColor() {
|
|
5
|
-
const HexPattern = /^[0-9a-f]{1,6}$/i;
|
|
6
|
-
const parser = (src, ctx) => {
|
|
7
|
-
let value = 0;
|
|
8
|
-
const start = src.cursor;
|
|
9
|
-
if (src.trySkip('#')) {
|
|
10
|
-
const remaining = src.readRemaining();
|
|
11
|
-
if (remaining.match(HexPattern)) {
|
|
12
|
-
value = parseInt(remaining, 16);
|
|
13
|
-
}
|
|
14
|
-
else {
|
|
15
|
-
ctx.err.report(localize('expected', localize('json.checker.string.hex-color')), Range.create(start, src));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
const remaining = src.readRemaining();
|
|
20
|
-
if (Color.NamedColors.has(remaining)) {
|
|
21
|
-
value = Color.NamedColors.get(remaining);
|
|
22
|
-
}
|
|
23
|
-
else {
|
|
24
|
-
ctx.err.report(localize('expected', Color.ColorNames), Range.create(start, src));
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
return Color.fromCompositeInt(value);
|
|
28
|
-
};
|
|
29
|
-
return (node, ctx) => {
|
|
30
|
-
node.expectation = [
|
|
31
|
-
{
|
|
32
|
-
type: 'json:string',
|
|
33
|
-
typedoc: 'String("Color")',
|
|
34
|
-
pool: Color.ColorNames,
|
|
35
|
-
},
|
|
36
|
-
];
|
|
37
|
-
if (!JsonStringNode.is(node)) {
|
|
38
|
-
ctx.err.report(localize('expected', localize('string')), node);
|
|
39
|
-
}
|
|
40
|
-
else {
|
|
41
|
-
const result = parseStringValue(parser, node.value, node.valueMap, ctx);
|
|
42
|
-
if (result !== Failure) {
|
|
43
|
-
node.color = {
|
|
44
|
-
value: result,
|
|
45
|
-
format: [ColorFormat.HexRGB],
|
|
46
|
-
range: { start: node.range.start + 1, end: node.range.end - 1 },
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
export function intColor() {
|
|
53
|
-
return (node, ctx) => {
|
|
54
|
-
if (!JsonNumberNode.is(node) || !Number.isInteger(node.value)) {
|
|
55
|
-
ctx.err.report(localize('expected', localize('integer')), node);
|
|
56
|
-
}
|
|
57
|
-
else {
|
|
58
|
-
node.color = {
|
|
59
|
-
value: Color.fromCompositeInt(node.value),
|
|
60
|
-
format: [ColorFormat.CompositeInt],
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
};
|
|
64
|
-
}
|
|
65
|
-
//# sourceMappingURL=color.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
|
|
2
|
-
interface DefinitionOptions {
|
|
3
|
-
definition: `::${string}::${string}`;
|
|
4
|
-
}
|
|
5
|
-
interface RegistryOptions {
|
|
6
|
-
registry: string;
|
|
7
|
-
id?: string | undefined;
|
|
8
|
-
idOrTag?: string | undefined;
|
|
9
|
-
ids?: readonly string[] | undefined;
|
|
10
|
-
tag?: string | undefined;
|
|
11
|
-
}
|
|
12
|
-
declare type Options = DefinitionOptions | RegistryOptions;
|
|
13
|
-
export declare function nbt(options: Options): JsonChecker;
|
|
14
|
-
export declare function nbtPath(options: RegistryOptions): JsonChecker;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=nbt.d.ts.map
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
import { ResourceLocation } from '@spyglassmc/core';
|
|
2
|
-
import { simpleString, string } from '@spyglassmc/json/lib/checker/index.js';
|
|
3
|
-
import { checker as nbtChecker } from '@spyglassmc/nbt';
|
|
4
|
-
import { getTagValues } from '../../../common/index.js';
|
|
5
|
-
export function nbt(options) {
|
|
6
|
-
if (isDefinitionOptions(options)) {
|
|
7
|
-
return definitionNbt(options);
|
|
8
|
-
}
|
|
9
|
-
else {
|
|
10
|
-
return registryNbt(options);
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
function isDefinitionOptions(options) {
|
|
14
|
-
return typeof options.definition === 'string';
|
|
15
|
-
}
|
|
16
|
-
function definitionNbt({ definition }) {
|
|
17
|
-
return (node, ctx) => {
|
|
18
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
19
|
-
if (!ctx.ensureBindingStarted) {
|
|
20
|
-
simpleString(node, ctx);
|
|
21
|
-
return;
|
|
22
|
-
}
|
|
23
|
-
const parser = ctx.meta.getParserLazily('nbt:compound');
|
|
24
|
-
const checker = nbtChecker.definition(definition);
|
|
25
|
-
string('nbt', parser, checker)(node, ctx);
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function registryNbt(options) {
|
|
29
|
-
return (node, ctx) => {
|
|
30
|
-
const ids = getIds(options, ctx);
|
|
31
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
32
|
-
if (!ctx.ensureBindingStarted) {
|
|
33
|
-
simpleString(node, ctx);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
const parser = ctx.meta.getParser('nbt:compound');
|
|
37
|
-
const checker = nbtChecker.index(options.registry, ids);
|
|
38
|
-
string('nbt', parser, checker)(node, ctx);
|
|
39
|
-
};
|
|
40
|
-
}
|
|
41
|
-
export function nbtPath(options) {
|
|
42
|
-
return (node, ctx) => {
|
|
43
|
-
const ids = getIds(options, ctx);
|
|
44
|
-
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
45
|
-
if (!ctx.ensureBindingStarted) {
|
|
46
|
-
simpleString(node, ctx);
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
const parser = ctx.meta.getParser('nbt:path');
|
|
50
|
-
const checker = nbtChecker.path(options.registry, ids);
|
|
51
|
-
string('nbt_path', parser, checker)(node, ctx);
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
function getIds({ registry, id, idOrTag, ids, tag }, ctx) {
|
|
55
|
-
if (idOrTag) {
|
|
56
|
-
idOrTag.startsWith('#') ? (tag = idOrTag.slice(1)) : (id = idOrTag);
|
|
57
|
-
}
|
|
58
|
-
if (tag &&
|
|
59
|
-
(registry === 'block' || registry === 'item' || registry === 'entity_type')) {
|
|
60
|
-
ids = getTagValues(`tag/${registry}`, tag, ctx);
|
|
61
|
-
}
|
|
62
|
-
else if (id) {
|
|
63
|
-
ids = [id];
|
|
64
|
-
}
|
|
65
|
-
return ids?.map(ResourceLocation.lengthen);
|
|
66
|
-
}
|
|
67
|
-
//# sourceMappingURL=nbt.js.map
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import type { PairNode } from '@spyglassmc/core';
|
|
2
|
-
import type { JsonNode, JsonStringNode } from '@spyglassmc/json';
|
|
3
|
-
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
|
|
4
|
-
export declare const recipeGroup: JsonChecker;
|
|
5
|
-
export declare function patternKeys(props: PairNode<JsonStringNode, JsonNode>[]): string[];
|
|
6
|
-
//# sourceMappingURL=recipe.d.ts.map
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { symbol } from '@spyglassmc/core';
|
|
2
|
-
import { string } from '@spyglassmc/json/lib/checker/index.js';
|
|
3
|
-
export const recipeGroup = string('recipe_group', symbol('recipe_group'));
|
|
4
|
-
export function patternKeys(props) {
|
|
5
|
-
return [
|
|
6
|
-
...new Set((props.find((p) => p.key?.value === 'pattern' && p.value?.type === 'json:array')?.value?.children ?? [])
|
|
7
|
-
.map((n) => n.value)
|
|
8
|
-
.filter((n) => n && n.type === 'json:string')
|
|
9
|
-
.flatMap((n) => [...n.value])
|
|
10
|
-
.filter((v) => v !== ' ')),
|
|
11
|
-
];
|
|
12
|
-
}
|
|
13
|
-
//# sourceMappingURL=recipe.js.map
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { string } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
-
import { localize } from '@spyglassmc/locales';
|
|
3
|
-
const UuidRegex = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
|
|
4
|
-
export const uuid = string(undefined, undefined, (node, ctx) => {
|
|
5
|
-
if (!node.value.match(UuidRegex)) {
|
|
6
|
-
ctx.err.report(localize('expected', localize('uuid')), node);
|
|
7
|
-
}
|
|
8
|
-
});
|
|
9
|
-
//# sourceMappingURL=uuid.js.map
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import type { JsonChecker, JsonCheckerContext, record } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
-
import { ReleaseVersion } from '../../../dependency/index.js';
|
|
3
|
-
declare type CheckerRecord = Parameters<typeof record>[0];
|
|
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
|
-
checker: JsonChecker;
|
|
16
|
-
opt?: boolean | undefined;
|
|
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 | {
|
|
18
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
19
|
-
} | null)[] | {
|
|
20
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
21
|
-
} | null)[] | {
|
|
22
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
23
|
-
} | null)[] | {
|
|
24
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
25
|
-
} | null)[] | {
|
|
26
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
27
|
-
} | null)[] | {
|
|
28
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
29
|
-
} | null)[] | {
|
|
30
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
31
|
-
} | null)[] | {
|
|
32
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
33
|
-
} | null)[] | {
|
|
34
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
35
|
-
} | null)[] | {
|
|
36
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
37
|
-
} | null)[] | {
|
|
38
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
39
|
-
} | null)[] | {
|
|
40
|
-
[key: string]: string | number | boolean | any | any | null;
|
|
41
|
-
} | null) | undefined;
|
|
42
|
-
deprecated?: boolean | undefined;
|
|
43
|
-
context?: string | undefined;
|
|
44
|
-
} | undefined;
|
|
45
|
-
export {};
|
|
46
|
-
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { deprecate } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
-
import { ReleaseVersion } from '../../../dependency/index.js';
|
|
3
|
-
function getVersion(ctx) {
|
|
4
|
-
return ctx.project['loadedVersion'];
|
|
5
|
-
}
|
|
6
|
-
function cmpVersion(ctx, target) {
|
|
7
|
-
return ReleaseVersion.cmp(getVersion(ctx), target);
|
|
8
|
-
}
|
|
9
|
-
export function versioned(ctx, arg1, arg2, arg3) {
|
|
10
|
-
if (typeof arg1 === 'string') {
|
|
11
|
-
const check = cmpVersion(ctx, arg1) >= 0;
|
|
12
|
-
if (arg2 === undefined) {
|
|
13
|
-
return arg2;
|
|
14
|
-
}
|
|
15
|
-
else if (Array.isArray(arg2)) {
|
|
16
|
-
return check ? arg2 : [];
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
return check ? arg2 : undefined;
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
else {
|
|
23
|
-
const check = cmpVersion(ctx, arg2) < 0;
|
|
24
|
-
if (arg1 === undefined) {
|
|
25
|
-
return arg1;
|
|
26
|
-
}
|
|
27
|
-
else if (Array.isArray(arg1)) {
|
|
28
|
-
return check ? arg1 : arg3 ?? [];
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return check ? arg1 : arg3 ?? undefined;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
export function renamed(ctx, from, version, to, checker) {
|
|
36
|
-
return versioned(ctx, {
|
|
37
|
-
[from]: checker,
|
|
38
|
-
}, version, {
|
|
39
|
-
[to]: checker,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
export function deprecated(ctx, version, checker) {
|
|
43
|
-
if (cmpVersion(ctx, version) < 0) {
|
|
44
|
-
return checker;
|
|
45
|
-
}
|
|
46
|
-
return deprecate(checker);
|
|
47
|
-
}
|
|
48
|
-
//# sourceMappingURL=version.js.map
|