@spyglassmc/java-edition 0.1.3 → 0.3.1
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 +11 -17
- package/lib/common/index.js +6 -33
- package/lib/dependency/common.js +6 -9
- package/lib/dependency/index.d.ts +6 -8
- package/lib/dependency/index.js +34 -59
- package/lib/dependency/mcmeta.d.ts +2 -2
- package/lib/dependency/mcmeta.js +8 -37
- package/lib/index.d.ts +3 -3
- package/lib/index.js +21 -48
- package/lib/json/checker/data/advancement.d.ts +13 -13
- package/lib/json/checker/data/advancement.js +263 -266
- 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 +1 -1
- 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 +370 -373
- 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.d.ts +6 -6
- 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 +6 -10
- package/lib/json/checker/util/block_states.d.ts +1 -1
- package/lib/json/checker/util/block_states.js +25 -53
- package/lib/json/checker/util/color.d.ts +1 -1
- package/lib/json/checker/util/color.js +24 -29
- package/lib/json/checker/util/index.d.ts +7 -7
- package/lib/json/checker/util/index.js +7 -23
- package/lib/json/checker/util/nbt.d.ts +1 -1
- package/lib/json/checker/util/nbt.js +23 -28
- 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 +2 -2
- package/lib/json/checker/util/version.js +7 -13
- package/lib/json/index.d.ts +1 -1
- package/lib/json/index.js +4 -31
- package/lib/mcfunction/checker/index.d.ts +1 -1
- package/lib/mcfunction/checker/index.js +24 -53
- package/lib/mcfunction/colorizer/index.d.ts +1 -1
- package/lib/mcfunction/colorizer/index.js +6 -35
- package/lib/mcfunction/common/index.js +7 -33
- package/lib/mcfunction/completer/argument.js +93 -120
- package/lib/mcfunction/completer/index.d.ts +1 -1
- package/lib/mcfunction/completer/index.js +1 -17
- package/lib/mcfunction/index.d.ts +5 -5
- package/lib/mcfunction/index.js +16 -43
- package/lib/mcfunction/inlayHintProvider.js +3 -30
- package/lib/mcfunction/node/argument.d.ts +7 -7
- package/lib/mcfunction/node/argument.js +38 -63
- package/lib/mcfunction/node/index.d.ts +1 -1
- package/lib/mcfunction/node/index.js +1 -17
- package/lib/mcfunction/parser/argument.d.ts +1 -1
- package/lib/mcfunction/parser/argument.js +72 -100
- package/lib/mcfunction/parser/index.d.ts +1 -1
- package/lib/mcfunction/parser/index.js +1 -17
- package/lib/mcfunction/signatureHelpProvider.js +3 -30
- package/lib/mcfunction/tree/argument.js +1 -2
- package/lib/mcfunction/tree/index.d.ts +1 -1
- package/lib/mcfunction/tree/index.js +1 -17
- package/lib/mcfunction/tree/patch.d.ts +1 -1
- package/lib/mcfunction/tree/patch.js +5 -9
- package/package.json +8 -7
|
@@ -1,146 +1,143 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
exports.rule_test = (0, checker_1.as)('rule_test', (0, checker_1.dispatch)('predicate_type', type => (0, checker_1.record)({
|
|
9
|
-
predicate_type: (0, checker_1.resource)('rule_test'),
|
|
10
|
-
...(0, checker_1.pick)(type, {
|
|
1
|
+
import { any, as, boolean, dispatch, extractNested, float, floatRange, intRange, listOf, literal, opt, pick, record, resource, simpleString, when } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
+
import { nbt, versioned } from '../util/index.js';
|
|
3
|
+
import { block_state, HeightmapType, height_provider } from './common.js';
|
|
4
|
+
import { configured_feature_ref, placed_feature_ref } from './feature.js';
|
|
5
|
+
export const rule_test = as('rule_test', dispatch('predicate_type', type => record({
|
|
6
|
+
predicate_type: resource('rule_test'),
|
|
7
|
+
...pick(type, {
|
|
11
8
|
block_match: {
|
|
12
|
-
block:
|
|
9
|
+
block: resource('block'),
|
|
13
10
|
},
|
|
14
11
|
blockstate_match: {
|
|
15
|
-
block_state:
|
|
12
|
+
block_state: block_state,
|
|
16
13
|
},
|
|
17
14
|
random_block_match: {
|
|
18
|
-
block:
|
|
19
|
-
probability:
|
|
15
|
+
block: resource('block'),
|
|
16
|
+
probability: floatRange(0, 1),
|
|
20
17
|
},
|
|
21
18
|
random_blockstate_match: {
|
|
22
|
-
block_state:
|
|
23
|
-
probability:
|
|
19
|
+
block_state: block_state,
|
|
20
|
+
probability: floatRange(0, 1),
|
|
24
21
|
},
|
|
25
22
|
tag_match: {
|
|
26
|
-
tag:
|
|
23
|
+
tag: resource('tag/block'),
|
|
27
24
|
},
|
|
28
25
|
}),
|
|
29
26
|
})));
|
|
30
|
-
|
|
31
|
-
predicate_type:
|
|
32
|
-
...
|
|
27
|
+
export const pos_rule_test = as('pos_rule_test', dispatch('predicate_type', type => record({
|
|
28
|
+
predicate_type: resource('pos_rule_test'),
|
|
29
|
+
...pick(type, {
|
|
33
30
|
axis_aligned_linear_pos: {
|
|
34
|
-
axis:
|
|
35
|
-
min_dist:
|
|
36
|
-
max_dist:
|
|
37
|
-
min_chance:
|
|
38
|
-
max_chance:
|
|
31
|
+
axis: literal(['x', 'y', 'z']),
|
|
32
|
+
min_dist: opt(intRange(0, 255)),
|
|
33
|
+
max_dist: opt(intRange(0, 255)),
|
|
34
|
+
min_chance: opt(floatRange(0, 1)),
|
|
35
|
+
max_chance: opt(floatRange(0, 1)),
|
|
39
36
|
},
|
|
40
37
|
}),
|
|
41
|
-
...
|
|
38
|
+
...when(type, ['axis_aligned_linear_pos', 'linear_pos'], {}),
|
|
42
39
|
})));
|
|
43
|
-
const processor_rule =
|
|
44
|
-
position_predicate:
|
|
45
|
-
input_predicate:
|
|
46
|
-
location_predicate:
|
|
47
|
-
output_state:
|
|
48
|
-
output_nbt:
|
|
40
|
+
const processor_rule = as('processor_rule', dispatch(props => record({
|
|
41
|
+
position_predicate: opt(pos_rule_test, { predicate_type: 'always_true' }),
|
|
42
|
+
input_predicate: rule_test,
|
|
43
|
+
location_predicate: rule_test,
|
|
44
|
+
output_state: block_state,
|
|
45
|
+
output_nbt: opt(nbt({ registry: 'block', id: extractNested('output_state', 'Name', props) })),
|
|
49
46
|
})));
|
|
50
|
-
const processor =
|
|
51
|
-
processor_type:
|
|
52
|
-
...
|
|
47
|
+
const processor = as('processor', dispatch('processor_type', type => record({
|
|
48
|
+
processor_type: resource('worldgen/structure_processor'),
|
|
49
|
+
...pick(type, {
|
|
53
50
|
block_age: {
|
|
54
|
-
mossiness:
|
|
51
|
+
mossiness: float,
|
|
55
52
|
},
|
|
56
53
|
block_ignore: {
|
|
57
|
-
blocks:
|
|
54
|
+
blocks: listOf(block_state),
|
|
58
55
|
},
|
|
59
56
|
block_rot: {
|
|
60
|
-
integrity:
|
|
57
|
+
integrity: floatRange(0, 1),
|
|
61
58
|
},
|
|
62
59
|
gravity: {
|
|
63
|
-
heightmap:
|
|
60
|
+
heightmap: literal(HeightmapType),
|
|
64
61
|
},
|
|
65
62
|
protected_blocks: {
|
|
66
|
-
value:
|
|
63
|
+
value: resource('tag/block'),
|
|
67
64
|
},
|
|
68
65
|
rule: {
|
|
69
|
-
rules:
|
|
66
|
+
rules: listOf(processor_rule),
|
|
70
67
|
},
|
|
71
68
|
}),
|
|
72
69
|
})));
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
processors:
|
|
70
|
+
export const processor_list = as('processor_list', any([
|
|
71
|
+
record({
|
|
72
|
+
processors: listOf(processor),
|
|
76
73
|
}),
|
|
77
|
-
|
|
74
|
+
listOf(processor),
|
|
78
75
|
]));
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
76
|
+
export const processor_list_ref = as('processor_list', any([
|
|
77
|
+
resource('worldgen/processor_list'),
|
|
78
|
+
processor_list,
|
|
82
79
|
]));
|
|
83
|
-
const template_element =
|
|
84
|
-
element_type:
|
|
85
|
-
...
|
|
86
|
-
projection:
|
|
80
|
+
const template_element = as('template_element', dispatch('element_type', (type, _, ctx) => record({
|
|
81
|
+
element_type: resource('worldgen/structure_pool_element'),
|
|
82
|
+
...when(type, ['empty_pool_element'], {}, {
|
|
83
|
+
projection: literal(['rigid', 'terrain_matching']),
|
|
87
84
|
}),
|
|
88
|
-
...
|
|
85
|
+
...pick(type, {
|
|
89
86
|
feature_pool_element: {
|
|
90
|
-
feature:
|
|
87
|
+
feature: versioned(ctx, configured_feature_ref, '1.18', placed_feature_ref),
|
|
91
88
|
},
|
|
92
89
|
legacy_single_pool_element: {
|
|
93
|
-
location:
|
|
94
|
-
processors:
|
|
90
|
+
location: resource('structure'),
|
|
91
|
+
processors: processor_list_ref,
|
|
95
92
|
},
|
|
96
93
|
list_pool_element: {
|
|
97
|
-
elements:
|
|
94
|
+
elements: listOf(template_element),
|
|
98
95
|
},
|
|
99
96
|
single_pool_element: {
|
|
100
|
-
location:
|
|
101
|
-
processors:
|
|
97
|
+
location: resource('structure'),
|
|
98
|
+
processors: processor_list_ref,
|
|
102
99
|
},
|
|
103
100
|
}),
|
|
104
101
|
})));
|
|
105
|
-
|
|
106
|
-
name:
|
|
107
|
-
fallback:
|
|
108
|
-
elements:
|
|
109
|
-
weight:
|
|
102
|
+
export const template_pool = as('template_pool', record({
|
|
103
|
+
name: simpleString,
|
|
104
|
+
fallback: resource('worldgen/template_pool'),
|
|
105
|
+
elements: listOf(record({
|
|
106
|
+
weight: intRange(1, undefined),
|
|
110
107
|
element: template_element,
|
|
111
108
|
})),
|
|
112
109
|
}));
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
110
|
+
export const template_pool_ref = any([
|
|
111
|
+
resource('worldgen/template_pool'),
|
|
112
|
+
template_pool,
|
|
116
113
|
]);
|
|
117
|
-
|
|
118
|
-
type:
|
|
119
|
-
config:
|
|
120
|
-
...
|
|
121
|
-
start_pool:
|
|
122
|
-
size:
|
|
123
|
-
},
|
|
114
|
+
export const configured_structure_feature = as('structure_feature', dispatch('type', type => record({
|
|
115
|
+
type: resource('worldgen/structure_feature'),
|
|
116
|
+
config: record({
|
|
117
|
+
...when(type, ['bastion_remnant', 'pillager_outpost', 'village'], {
|
|
118
|
+
start_pool: template_pool_ref,
|
|
119
|
+
size: intRange(0, 7),
|
|
120
|
+
}, pick(type, {
|
|
124
121
|
buried_treasure: {
|
|
125
|
-
probability:
|
|
122
|
+
probability: floatRange(0, 1),
|
|
126
123
|
},
|
|
127
124
|
mineshaft: {
|
|
128
|
-
type:
|
|
129
|
-
probability:
|
|
125
|
+
type: literal(['normal', 'mesa']),
|
|
126
|
+
probability: floatRange(0, 1),
|
|
130
127
|
},
|
|
131
128
|
nether_fossil: {
|
|
132
|
-
height:
|
|
129
|
+
height: height_provider,
|
|
133
130
|
},
|
|
134
131
|
ocean_ruin: {
|
|
135
|
-
biome_temp:
|
|
136
|
-
large_probability:
|
|
137
|
-
cluster_probability:
|
|
132
|
+
biome_temp: literal(['cold', 'warm']),
|
|
133
|
+
large_probability: floatRange(0, 1),
|
|
134
|
+
cluster_probability: floatRange(0, 1),
|
|
138
135
|
},
|
|
139
136
|
ruined_portal: {
|
|
140
|
-
portal_type:
|
|
137
|
+
portal_type: literal(['standard', 'desert', 'jungle', 'mountain', 'nether', 'ocean', 'swamp']),
|
|
141
138
|
},
|
|
142
139
|
shipwreck: {
|
|
143
|
-
is_beached:
|
|
140
|
+
is_beached: opt(boolean, false),
|
|
144
141
|
},
|
|
145
142
|
})),
|
|
146
143
|
}),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export declare const block_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
2
|
-
export declare const entity_type_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
3
|
-
export declare const fluid_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
4
|
-
export declare const function_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
5
|
-
export declare const game_event_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
6
|
-
export declare const item_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
1
|
+
export declare const block_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
2
|
+
export declare const entity_type_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
3
|
+
export declare const fluid_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
4
|
+
export declare const function_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
5
|
+
export declare const game_event_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
6
|
+
export declare const item_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
7
7
|
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -1,38 +1,35 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(0, primitives_1.record)({
|
|
13
|
-
id: (0, primitives_1.resource)(type, true),
|
|
14
|
-
required: (0, primitives_1.opt)(primitives_1.boolean, true),
|
|
1
|
+
import { ResourceLocation } from '@spyglassmc/core';
|
|
2
|
+
import { JsonObjectNode, JsonStringNode } from '@spyglassmc/json';
|
|
3
|
+
import { any, boolean, opt, record, resource, uniqueListOf } from '@spyglassmc/json/lib/checker/primitives/index.js';
|
|
4
|
+
import { localize } from '@spyglassmc/locales';
|
|
5
|
+
const tag = (type) => record({
|
|
6
|
+
replace: opt(boolean, false),
|
|
7
|
+
values: uniqueListOf(any([
|
|
8
|
+
resource(type, true),
|
|
9
|
+
record({
|
|
10
|
+
id: resource(type, true),
|
|
11
|
+
required: opt(boolean, true),
|
|
15
12
|
}),
|
|
16
13
|
]), {
|
|
17
14
|
items: (node) => {
|
|
18
|
-
if (
|
|
19
|
-
return [
|
|
15
|
+
if (JsonStringNode.is(node)) {
|
|
16
|
+
return [ResourceLocation.shorten(node.value), node];
|
|
20
17
|
}
|
|
21
|
-
if (
|
|
18
|
+
if (JsonObjectNode.is(node)) {
|
|
22
19
|
const id = node.children.find(c => c.key?.value === 'id');
|
|
23
|
-
if (id && id.value &&
|
|
24
|
-
return [
|
|
20
|
+
if (id && id.value && JsonStringNode.is(id.value)) {
|
|
21
|
+
return [ResourceLocation.shorten(id.value.value), id.value];
|
|
25
22
|
}
|
|
26
23
|
}
|
|
27
24
|
return [undefined, node];
|
|
28
25
|
},
|
|
29
|
-
report: (node, ctx) => ctx.err.report(
|
|
26
|
+
report: (node, ctx) => ctx.err.report(localize('json.checker.tag-entry.duplicate'), node, 2 /* ErrorSeverity.Warning */),
|
|
30
27
|
}),
|
|
31
28
|
});
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
29
|
+
export const block_tag = tag('block');
|
|
30
|
+
export const entity_type_tag = tag('entity_type');
|
|
31
|
+
export const fluid_tag = tag('fluid');
|
|
32
|
+
export const function_tag = tag('function');
|
|
33
|
+
export const game_event_tag = tag('game_event');
|
|
34
|
+
export const item_tag = tag('item');
|
|
38
35
|
//# sourceMappingURL=tag.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const text_component: import("@spyglassmc/json/lib/checker").JsonChecker;
|
|
1
|
+
export declare const text_component: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
|
|
2
2
|
//# sourceMappingURL=text_component.d.ts.map
|
|
@@ -1,9 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const core_1 = require("@spyglassmc/core");
|
|
5
|
-
const primitives_1 = require("@spyglassmc/json/lib/checker/primitives");
|
|
6
|
-
const util_1 = require("../util");
|
|
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';
|
|
7
4
|
const Keybinds = [
|
|
8
5
|
'key.jump',
|
|
9
6
|
'key.sneak',
|
|
@@ -40,103 +37,103 @@ const Keybinds = [
|
|
|
40
37
|
'key.fullscreen',
|
|
41
38
|
'key.togglePerspective',
|
|
42
39
|
];
|
|
43
|
-
const text_component_object =
|
|
44
|
-
...
|
|
40
|
+
const text_component_object = as('text_component', (node, ctx) => record({
|
|
41
|
+
...having(node, ctx, {
|
|
45
42
|
text: {
|
|
46
|
-
text:
|
|
43
|
+
text: simpleString,
|
|
47
44
|
},
|
|
48
45
|
translate: {
|
|
49
|
-
translate:
|
|
50
|
-
with:
|
|
46
|
+
translate: simpleString,
|
|
47
|
+
with: opt(listOf(text_component), []),
|
|
51
48
|
},
|
|
52
49
|
selector: {
|
|
53
|
-
selector:
|
|
54
|
-
separator:
|
|
50
|
+
selector: simpleString,
|
|
51
|
+
separator: opt(versioned(ctx, '1.17', text_component)),
|
|
55
52
|
},
|
|
56
53
|
score: {
|
|
57
|
-
score:
|
|
58
|
-
name:
|
|
59
|
-
objective:
|
|
60
|
-
value:
|
|
54
|
+
score: record({
|
|
55
|
+
name: simpleString,
|
|
56
|
+
objective: simpleString,
|
|
57
|
+
value: opt(simpleString),
|
|
61
58
|
}),
|
|
62
59
|
},
|
|
63
60
|
keybind: {
|
|
64
|
-
keybind:
|
|
61
|
+
keybind: literal(Keybinds),
|
|
65
62
|
},
|
|
66
63
|
nbt: () => ({
|
|
67
|
-
nbt:
|
|
68
|
-
...
|
|
64
|
+
nbt: simpleString,
|
|
65
|
+
...having(node, ctx, {
|
|
69
66
|
block: {
|
|
70
|
-
block:
|
|
71
|
-
nbt:
|
|
67
|
+
block: simpleString,
|
|
68
|
+
nbt: nbtPath({ registry: 'block' }),
|
|
72
69
|
},
|
|
73
70
|
entity: {
|
|
74
|
-
entity:
|
|
75
|
-
nbt:
|
|
71
|
+
entity: simpleString,
|
|
72
|
+
nbt: nbtPath({ registry: 'entity_type' /* FIXME: import { getTypesFromEntity } from '../../../../mcfunction/checker'; ids: getTypesFromEntity(somehowGetTheNodeHere, ctx) */ }),
|
|
76
73
|
},
|
|
77
74
|
storage: {
|
|
78
|
-
storage:
|
|
79
|
-
nbt:
|
|
75
|
+
storage: resource('storage'),
|
|
76
|
+
nbt: nbtPath({ registry: 'storage' /* FIXME:, id: extract('storage', props) */ }),
|
|
80
77
|
},
|
|
81
78
|
}),
|
|
82
|
-
interpret:
|
|
83
|
-
separator:
|
|
79
|
+
interpret: opt(boolean, false),
|
|
80
|
+
separator: opt(versioned(ctx, '1.17', text_component)),
|
|
84
81
|
}),
|
|
85
82
|
}),
|
|
86
|
-
color:
|
|
87
|
-
font:
|
|
88
|
-
bold:
|
|
89
|
-
italic:
|
|
90
|
-
underlined:
|
|
91
|
-
strikethrough:
|
|
92
|
-
obfuscated:
|
|
93
|
-
insertion:
|
|
94
|
-
clickEvent:
|
|
95
|
-
action:
|
|
96
|
-
value:
|
|
97
|
-
...
|
|
83
|
+
color: opt(stringColor()),
|
|
84
|
+
font: opt(simpleString),
|
|
85
|
+
bold: opt(boolean),
|
|
86
|
+
italic: opt(boolean),
|
|
87
|
+
underlined: opt(boolean),
|
|
88
|
+
strikethrough: opt(boolean),
|
|
89
|
+
obfuscated: opt(boolean),
|
|
90
|
+
insertion: opt(simpleString),
|
|
91
|
+
clickEvent: opt(dispatch('action', (action) => record({
|
|
92
|
+
action: literal(['open_url', 'open_file', 'run_command', 'suggest_command', 'change_page', 'copy_to_clipboard']),
|
|
93
|
+
value: simpleString,
|
|
94
|
+
...pick(action, {
|
|
98
95
|
run_command: {
|
|
99
|
-
value:
|
|
96
|
+
value: string('command', ctx.meta.getParserLazily('mcfunction:command'), ctx.meta.getChecker('mcfunction:command')),
|
|
100
97
|
},
|
|
101
98
|
change_page: {
|
|
102
|
-
value:
|
|
99
|
+
value: string('number', integer({ pattern: /\d+/, min: 0 })),
|
|
103
100
|
},
|
|
104
101
|
}),
|
|
105
102
|
}))),
|
|
106
|
-
hoverEvent:
|
|
107
|
-
action:
|
|
108
|
-
...
|
|
103
|
+
hoverEvent: opt(dispatch('action', (action, _, ctx) => record({
|
|
104
|
+
action: literal(['show_text', 'show_item', 'show_entity']),
|
|
105
|
+
...pick(action, {
|
|
109
106
|
show_text: {
|
|
110
|
-
value:
|
|
111
|
-
contents:
|
|
107
|
+
value: deprecated(ctx, '1.16', text_component),
|
|
108
|
+
contents: opt(versioned(ctx, '1.16', text_component)),
|
|
112
109
|
},
|
|
113
110
|
show_item: {
|
|
114
|
-
value:
|
|
115
|
-
contents:
|
|
116
|
-
id:
|
|
117
|
-
count:
|
|
118
|
-
tag:
|
|
111
|
+
value: deprecated(ctx, '1.16', nbt({ definition: '::minecraft::util::invitem::InventoryItem' })),
|
|
112
|
+
contents: opt(versioned(ctx, '1.16', dispatch(props => record({
|
|
113
|
+
id: resource('item'),
|
|
114
|
+
count: opt(int),
|
|
115
|
+
tag: opt(nbt({ registry: 'item', id: extract('id', props) })),
|
|
119
116
|
})))),
|
|
120
117
|
},
|
|
121
118
|
show_entity: {
|
|
122
|
-
value:
|
|
123
|
-
name:
|
|
124
|
-
type:
|
|
125
|
-
id:
|
|
119
|
+
value: deprecated(ctx, '1.16', record({
|
|
120
|
+
name: opt(simpleString),
|
|
121
|
+
type: opt(resource('entity_type')),
|
|
122
|
+
id: opt(uuid),
|
|
126
123
|
})),
|
|
127
|
-
contents:
|
|
128
|
-
name:
|
|
129
|
-
type:
|
|
130
|
-
id:
|
|
124
|
+
contents: opt(versioned(ctx, '1.16', record({
|
|
125
|
+
name: opt(text_component),
|
|
126
|
+
type: opt(resource('entity_type')),
|
|
127
|
+
id: opt(uuid),
|
|
131
128
|
}))),
|
|
132
129
|
},
|
|
133
130
|
}),
|
|
134
131
|
}))),
|
|
135
|
-
extra:
|
|
132
|
+
extra: opt(listOf(text_component)),
|
|
136
133
|
})(node, ctx));
|
|
137
|
-
|
|
138
|
-
|
|
134
|
+
export const text_component = as('text_component', any([
|
|
135
|
+
simpleString,
|
|
139
136
|
text_component_object,
|
|
140
|
-
|
|
137
|
+
listOf(ref(() => text_component)),
|
|
141
138
|
]));
|
|
142
139
|
//# sourceMappingURL=text_component.js.map
|
|
@@ -1,28 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
const parts = (0, binder_1.dissectUri)(ctx.doc.uri, ctx);
|
|
8
|
-
if (parts && data_1.Checkers.has(parts.category)) {
|
|
9
|
-
data_1.Checkers.get(parts.category)(node, { ...ctx, context: '' });
|
|
1
|
+
import { dissectUri } from '../../binder/index.js';
|
|
2
|
+
import { Checkers, pack_mcmeta } from './data/index.js';
|
|
3
|
+
export const entry = (node, ctx) => {
|
|
4
|
+
const parts = dissectUri(ctx.doc.uri, ctx);
|
|
5
|
+
if (parts && Checkers.has(parts.category)) {
|
|
6
|
+
Checkers.get(parts.category)(node, { ...ctx, context: '' });
|
|
10
7
|
}
|
|
11
8
|
else if (ctx.doc.uri.endsWith('/pack.mcmeta')) {
|
|
12
|
-
|
|
9
|
+
pack_mcmeta(node, { ...ctx, context: '' });
|
|
13
10
|
}
|
|
14
11
|
else {
|
|
15
12
|
return;
|
|
16
13
|
}
|
|
17
14
|
};
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
meta.registerChecker('json:
|
|
21
|
-
meta.registerChecker('json:
|
|
22
|
-
meta.registerChecker('json:
|
|
23
|
-
meta.registerChecker('json:
|
|
24
|
-
meta.registerChecker('json:
|
|
25
|
-
meta.registerChecker('json:string', exports.entry);
|
|
15
|
+
export function register(meta) {
|
|
16
|
+
meta.registerChecker('json:array', entry);
|
|
17
|
+
meta.registerChecker('json:boolean', entry);
|
|
18
|
+
meta.registerChecker('json:null', entry);
|
|
19
|
+
meta.registerChecker('json:number', entry);
|
|
20
|
+
meta.registerChecker('json:object', entry);
|
|
21
|
+
meta.registerChecker('json:string', entry);
|
|
26
22
|
}
|
|
27
|
-
exports.register = register;
|
|
28
23
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker';
|
|
1
|
+
import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
|
|
2
2
|
export declare function criterionReference(advancement: string): JsonChecker;
|
|
3
3
|
//# sourceMappingURL=advancement.d.ts.map
|
|
@@ -1,20 +1,16 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.criterionReference = void 0;
|
|
4
|
-
const checker_1 = require("@spyglassmc/json/lib/checker");
|
|
5
|
-
function criterionReference(advancement) {
|
|
1
|
+
import { literal, simpleString } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
|
+
export function criterionReference(advancement) {
|
|
6
3
|
return (node, ctx) => {
|
|
7
|
-
// FIXME: Temporary solution to make tests pass when
|
|
8
|
-
if (!ctx.
|
|
9
|
-
|
|
4
|
+
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
5
|
+
if (!ctx.ensureBindingStarted) {
|
|
6
|
+
simpleString(node, ctx);
|
|
10
7
|
return;
|
|
11
8
|
}
|
|
12
9
|
const criteria = Object.values(ctx.symbols.query(ctx.doc, 'advancement', advancement).symbol
|
|
13
10
|
?.members ?? {})
|
|
14
11
|
.filter((m) => m?.subcategory === 'criterion')
|
|
15
12
|
.map(s => s.identifier);
|
|
16
|
-
|
|
13
|
+
literal(criteria)(node, ctx);
|
|
17
14
|
};
|
|
18
15
|
}
|
|
19
|
-
exports.criterionReference = criterionReference;
|
|
20
16
|
//# sourceMappingURL=advancement.js.map
|