@spyglassmc/java-edition 0.3.8 → 0.3.9

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.
Files changed (35) hide show
  1. package/lib/binder/index.d.ts +11 -9
  2. package/lib/binder/index.js +149 -150
  3. package/lib/common/index.js +6 -9
  4. package/lib/dependency/common.d.ts +5 -0
  5. package/lib/dependency/common.js +8 -0
  6. package/lib/dependency/index.js +7 -17
  7. package/lib/dependency/mcmeta.d.ts +6 -12
  8. package/lib/dependency/mcmeta.js +21 -38
  9. package/lib/index.d.ts +1 -0
  10. package/lib/index.js +74 -32
  11. package/lib/json/checker/index.d.ts +3 -10
  12. package/lib/json/checker/index.js +36 -244
  13. package/lib/json/index.d.ts +0 -1
  14. package/lib/json/index.js +0 -3
  15. package/lib/mcfunction/checker/index.d.ts +0 -2
  16. package/lib/mcfunction/checker/index.js +254 -183
  17. package/lib/mcfunction/common/index.d.ts +4 -2
  18. package/lib/mcfunction/common/index.js +56 -52
  19. package/lib/mcfunction/completer/argument.js +112 -57
  20. package/lib/mcfunction/index.d.ts +3 -2
  21. package/lib/mcfunction/index.js +18 -19
  22. package/lib/mcfunction/inlayHintProvider.js +2 -3
  23. package/lib/mcfunction/mcdocAttributes.d.ts +4 -0
  24. package/lib/mcfunction/mcdocAttributes.js +71 -0
  25. package/lib/mcfunction/node/argument.d.ts +115 -12
  26. package/lib/mcfunction/node/argument.js +131 -63
  27. package/lib/mcfunction/parser/argument.d.ts +14 -4
  28. package/lib/mcfunction/parser/argument.js +380 -212
  29. package/lib/mcfunction/signatureHelpProvider.d.ts +2 -1
  30. package/lib/mcfunction/signatureHelpProvider.js +10 -18
  31. package/lib/mcfunction/tree/argument.d.ts +68 -1
  32. package/lib/mcfunction/tree/patch.js +279 -77
  33. package/lib/mcfunction/tree/patchValidator.d.ts +7 -0
  34. package/lib/mcfunction/tree/patchValidator.js +25 -0
  35. package/package.json +8 -9
@@ -1,5 +1,6 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import type * as nbt from '@spyglassmc/nbt';
3
+ import type { NbtParserProperties } from '../tree/argument.js';
3
4
  export interface BlockStatesNode extends core.RecordBaseNode<core.StringNode, core.StringNode> {
4
5
  type: 'mcfunction:block/states';
5
6
  }
@@ -12,6 +13,7 @@ export interface BlockNode extends core.AstNode {
12
13
  id: core.ResourceLocationNode;
13
14
  states?: BlockStatesNode;
14
15
  nbt?: nbt.NbtCompoundNode;
16
+ isPredicate: boolean;
15
17
  }
16
18
  export declare namespace BlockNode {
17
19
  function is(node: core.DeepReadonly<core.AstNode> | undefined): node is BlockNode;
@@ -54,15 +56,19 @@ export interface EntitySelectorArgumentsNode extends core.RecordBaseNode<core.St
54
56
  export declare namespace EntitySelectorArgumentsNode {
55
57
  function is(node: core.AstNode): node is EntitySelectorArgumentsNode;
56
58
  }
57
- export declare const EntitySelectorVariables: readonly ["a", "e", "p", "r", "s"];
59
+ declare const EntitySelectorVariables: readonly ["a", "e", "p", "r", "s", "n"];
58
60
  export type EntitySelectorVariable = typeof EntitySelectorVariables[number];
59
61
  export declare namespace EntitySelectorVariable {
60
62
  function is(value: string): value is EntitySelectorVariable;
61
63
  }
62
- export declare const EntitySelectorAtVariables: ("@a" | "@e" | "@p" | "@r" | "@s")[];
64
+ declare const EntitySelectorAtVariables: ("@a" | "@e" | "@p" | "@r" | "@s" | "@n")[];
63
65
  export type EntitySelectorAtVariable = typeof EntitySelectorAtVariables[number];
64
66
  export declare namespace EntitySelectorAtVariable {
65
67
  function is(value: string): value is EntitySelectorAtVariable;
68
+ /**
69
+ * Should be used to get a list of available selectors for the current version.
70
+ */
71
+ function filterAvailable(ctx: core.ContextBase): ("@a" | "@e" | "@p" | "@r" | "@s" | "@n")[];
66
72
  }
67
73
  export interface EntitySelectorNode extends core.AstNode {
68
74
  type: 'mcfunction:entity_selector';
@@ -79,8 +85,8 @@ export interface EntitySelectorNode extends core.AstNode {
79
85
  }
80
86
  export declare namespace EntitySelectorNode {
81
87
  function is<T extends core.DeepReadonly<core.AstNode> | undefined>(node: T): node is core.InheritReadonly<EntitySelectorNode, T>;
82
- function mock(range: core.RangeLike): EntitySelectorNode;
83
- const ArgumentKeys: Set<"predicate" | "tag" | "team" | "type" | "level" | "advancements" | "sort" | "distance" | "gamemode" | "limit" | "name" | "nbt" | "scores" | "x" | "y" | "z" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
88
+ function mock(range: core.RangeLike, options: core.LiteralOptions): EntitySelectorNode;
89
+ const ArgumentKeys: Set<"tag" | "team" | "predicate" | "type" | "level" | "advancements" | "nbt" | "sort" | "distance" | "gamemode" | "limit" | "name" | "scores" | "x" | "y" | "z" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
84
90
  type ArgumentKey = typeof ArgumentKeys extends Set<infer T> ? T : undefined;
85
91
  const enum Result {
86
92
  Ok = 0,
@@ -104,15 +110,85 @@ export interface FloatRangeNode extends core.AstNode {
104
110
  children: (core.FloatNode | core.LiteralNode)[];
105
111
  value: [number | undefined, number | undefined];
106
112
  }
107
- export interface ItemNode extends core.AstNode {
108
- type: 'mcfunction:item';
109
- children: (core.ResourceLocationNode | nbt.NbtCompoundNode)[];
113
+ export interface ItemStackNode extends core.AstNode {
114
+ type: 'mcfunction:item_stack';
115
+ children: (core.ResourceLocationNode | ComponentListNode | nbt.NbtCompoundNode)[];
110
116
  id: core.ResourceLocationNode;
117
+ components?: ComponentListNode;
118
+ nbt?: nbt.NbtCompoundNode;
119
+ }
120
+ export declare namespace ItemStackNode {
121
+ function is(node: core.AstNode | undefined): node is ItemStackNode;
122
+ function mock(range: core.RangeLike): ItemStackNode;
123
+ }
124
+ export interface ComponentListNode extends core.AstNode {
125
+ type: 'mcfunction:component_list';
126
+ children: core.PairNode<core.ResourceLocationNode, nbt.NbtNode>[];
127
+ }
128
+ export declare namespace ComponentListNode {
129
+ function is(node: core.AstNode): node is ComponentListNode;
130
+ }
131
+ export interface ItemPredicateNode extends core.AstNode {
132
+ type: 'mcfunction:item_predicate';
133
+ children: (core.ResourceLocationNode | core.LiteralNode | ComponentTestsNode | nbt.NbtCompoundNode)[];
134
+ id: core.ResourceLocationNode | core.LiteralNode;
135
+ tests?: ComponentTestsNode;
111
136
  nbt?: nbt.NbtCompoundNode;
112
137
  }
113
- export declare namespace ItemNode {
114
- function is(node: core.AstNode | undefined): node is ItemNode;
115
- function mock(range: core.RangeLike, isPredicate: boolean): ItemNode;
138
+ export declare namespace ItemPredicateNode {
139
+ function is(node: core.AstNode | undefined): node is ItemPredicateNode;
140
+ function mock(range: core.RangeLike): ItemPredicateNode;
141
+ }
142
+ export interface ComponentTestsNode extends core.AstNode {
143
+ type: 'mcfunction:component_tests';
144
+ children?: [ComponentTestsAnyOfNode];
145
+ }
146
+ export declare namespace ComponentTestsNode {
147
+ function is(node: core.AstNode): node is ComponentTestsNode;
148
+ }
149
+ export interface ComponentTestsAnyOfNode extends core.AstNode {
150
+ type: 'mcfunction:component_tests_any_of';
151
+ children: ComponentTestsAllOfNode[];
152
+ }
153
+ export declare namespace ComponentTestsAnyOfNode {
154
+ function is(node: core.AstNode): node is ComponentTestsAnyOfNode;
155
+ }
156
+ export interface ComponentTestsAllOfNode extends core.AstNode {
157
+ type: 'mcfunction:component_tests_all_of';
158
+ children: ComponentTestNode[];
159
+ }
160
+ export declare namespace ComponentTestsAllOfNode {
161
+ function is(node: core.AstNode): node is ComponentTestsAllOfNode;
162
+ }
163
+ export type ComponentTestNode = ComponentTestExactNode | ComponentTestExistsNode | ComponentTestSubpredicateNode;
164
+ export interface ComponentTestBaseNode extends core.AstNode {
165
+ negated: boolean;
166
+ }
167
+ export interface ComponentTestExactNode extends ComponentTestBaseNode {
168
+ type: 'mcfunction:component_test_exact';
169
+ children: (core.ResourceLocationNode | nbt.NbtNode)[];
170
+ key: core.ResourceLocationNode;
171
+ value?: nbt.NbtNode;
172
+ }
173
+ export declare namespace ComponentTestExactNode {
174
+ function is(node: core.AstNode): node is ComponentTestExactNode;
175
+ }
176
+ export interface ComponentTestExistsNode extends ComponentTestBaseNode {
177
+ type: 'mcfunction:component_test_exists';
178
+ children: [core.ResourceLocationNode];
179
+ key: core.ResourceLocationNode;
180
+ }
181
+ export declare namespace ComponentTestExistsNode {
182
+ function is(node: core.AstNode): node is ComponentTestExistsNode;
183
+ }
184
+ export interface ComponentTestSubpredicateNode extends ComponentTestBaseNode {
185
+ type: 'mcfunction:component_test_sub_predicate';
186
+ children: (core.ResourceLocationNode | nbt.NbtNode)[];
187
+ key: core.ResourceLocationNode;
188
+ value?: nbt.NbtNode;
189
+ }
190
+ export declare namespace ComponentTestSubpredicateNode {
191
+ function is(node: core.AstNode): node is ComponentTestSubpredicateNode;
116
192
  }
117
193
  export interface IntRangeNode extends core.AstNode {
118
194
  type: 'mcfunction:int_range';
@@ -126,6 +202,30 @@ export interface MessageNode extends core.AstNode {
126
202
  type: 'mcfunction:message';
127
203
  children: (core.StringNode | EntitySelectorNode)[];
128
204
  }
205
+ export interface NbtNode extends core.AstNode {
206
+ type: 'mcfunction:nbt';
207
+ children: [nbt.NbtNode];
208
+ properties?: NbtParserProperties;
209
+ }
210
+ export declare namespace NbtNode {
211
+ function is(node: core.AstNode): node is NbtNode;
212
+ }
213
+ export interface NbtPathNode extends core.AstNode {
214
+ type: 'mcfunction:nbt_path';
215
+ children: [nbt.NbtPathNode];
216
+ properties?: NbtParserProperties;
217
+ }
218
+ export declare namespace NbtPathNode {
219
+ function is(node: core.AstNode): node is NbtPathNode;
220
+ }
221
+ export interface NbtResourceNode extends core.AstNode {
222
+ type: 'mcfunction:nbt_resource';
223
+ children: [nbt.NbtNode];
224
+ category: string;
225
+ }
226
+ export declare namespace NbtResourceNode {
227
+ function is(node: core.AstNode): node is NbtResourceNode;
228
+ }
129
229
  export interface ObjectiveCriteriaNode extends core.AstNode {
130
230
  type: 'mcfunction:objective_criteria';
131
231
  children?: [core.ResourceLocationNode, core.ResourceLocationNode];
@@ -133,19 +233,21 @@ export interface ObjectiveCriteriaNode extends core.AstNode {
133
233
  }
134
234
  export declare namespace ObjectiveCriteriaNode {
135
235
  const SimpleValues: string[];
136
- const ComplexCategories: Map<string, "block" | "fluid" | "activity" | "attribute" | "block_entity_type" | "block_predicate_type" | "chunk_status" | "custom_stat" | "enchantment" | "entity_type" | "float_provider_type" | "game_event" | "height_provider_type" | "int_provider_type" | "item" | "loot_condition_type" | "loot_function_type" | "loot_nbt_provider_type" | "loot_number_provider_type" | "loot_pool_entry_type" | "loot_score_provider_type" | "memory_module_type" | "menu" | "mob_effect" | "motive" | "particle_type" | "point_of_interest_type" | "pos_rule_test" | "position_source_type" | "potion" | "recipe_serializer" | "recipe_type" | "rule_test" | "schedule" | "sensor_type" | "sound_event" | "stat_type" | "villager_profession" | "villager_type" | "worldgen/biome_source" | "worldgen/block_placer_type" | "worldgen/block_state_provider_type" | "worldgen/carver" | "worldgen/chunk_generator" | "worldgen/decorator" | "worldgen/feature" | "worldgen/feature_size_type" | "worldgen/foliage_placer_type" | "worldgen/material_condition" | "worldgen/material_rule" | "worldgen/placement_modifier_type" | "worldgen/structure_feature" | "worldgen/structure_piece" | "worldgen/structure_pool_element" | "worldgen/structure_processor" | "worldgen/surface_builder" | "worldgen/tree_decorator_type" | "worldgen/trunk_placer_type">;
236
+ const ComplexCategories: Map<string, "block" | "fluid" | "activity" | "armor_material" | "attribute" | "block_entity_type" | "block_predicate_type" | "block_type" | "cat_variant" | "chunk_status" | "command_argument_type" | "creative_mode_tab" | "custom_stat" | "data_component_type" | "decorated_pot_pattern" | "enchantment_effect_component_type" | "enchantment_entity_effect_type" | "enchantment_level_based_value_type" | "enchantment_location_based_effect_type" | "enchantment_provider_type" | "enchantment_value_effect_type" | "entity_sub_predicate_type" | "entity_type" | "float_provider_type" | "frog_variant" | "game_event" | "height_provider_type" | "instrument" | "int_provider_type" | "item" | "item_sub_predicate_type" | "loot_condition_type" | "loot_function_type" | "loot_nbt_provider_type" | "loot_number_provider_type" | "loot_pool_entry_type" | "loot_score_provider_type" | "map_decoration_type" | "memory_module_type" | "menu" | "mob_effect" | "motive" | "number_format_type" | "particle_type" | "point_of_interest_type" | "pos_rule_test" | "position_source_type" | "potion" | "recipe_serializer" | "recipe_type" | "rule_block_entity_modifier" | "rule_test" | "schedule" | "sensor_type" | "sound_event" | "stat_type" | "trigger_type" | "villager_profession" | "villager_type" | "worldgen/biome_source" | "worldgen/block_placer_type" | "worldgen/block_state_provider_type" | "worldgen/carver" | "worldgen/chunk_generator" | "worldgen/decorator" | "worldgen/density_function_type" | "worldgen/feature" | "worldgen/feature_size_type" | "worldgen/foliage_placer_type" | "worldgen/material_condition" | "worldgen/material_rule" | "worldgen/placement_modifier_type" | "worldgen/pool_alias_binding" | "worldgen/root_placer_type" | "worldgen/structure_feature" | "worldgen/structure_piece" | "worldgen/structure_placement" | "worldgen/structure_pool_element" | "worldgen/structure_processor" | "worldgen/structure_type" | "worldgen/surface_builder" | "worldgen/tree_decorator_type" | "worldgen/trunk_placer_type">;
137
237
  const ComplexSep = ":";
138
238
  function mock(range: core.RangeLike): ObjectiveCriteriaNode;
139
239
  }
140
240
  export interface ParticleNode extends core.AstNode {
141
241
  type: 'mcfunction:particle';
142
- children?: (core.FloatNode | core.IntegerNode | core.ResourceLocationNode | BlockNode | ItemNode | VectorNode)[];
242
+ children?: (core.ResourceLocationNode | core.FloatNode | core.IntegerNode | BlockNode | ItemStackNode | VectorNode | nbt.NbtCompoundNode)[];
143
243
  id: core.ResourceLocationNode;
144
244
  }
145
245
  export declare namespace ParticleNode {
146
246
  const SpecialTypes: Set<"block" | "item" | "block_marker" | "dust" | "dust_color_transition" | "falling_dust" | "sculk_charge" | "shriek" | "vibration">;
147
247
  export type SpecialType = typeof SpecialTypes extends Set<infer T> ? T : undefined;
148
248
  export function isSpecialType(type: string | undefined): type is SpecialType;
249
+ export type OptionType = typeof SpecialTypes extends Set<infer T> ? T : undefined;
250
+ export function requiresOptions(type: string | undefined): type is OptionType;
149
251
  export function is(node: core.AstNode | undefined): node is ParticleNode;
150
252
  export function mock(range: core.RangeLike): ParticleNode;
151
253
  export {};
@@ -186,4 +288,5 @@ export declare namespace VectorNode {
186
288
  }
187
289
  function mock(range: core.RangeLike, options: Options): VectorNode;
188
290
  }
291
+ export {};
189
292
  //# sourceMappingURL=argument.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import * as core from '@spyglassmc/core';
2
+ import { ReleaseVersion } from '../../dependency/common.js';
2
3
  export var BlockStatesNode;
3
4
  (function (BlockStatesNode) {
4
5
  /* istanbul ignore next */
@@ -14,15 +15,13 @@ export var BlockNode;
14
15
  }
15
16
  BlockNode.is = is;
16
17
  function mock(range, isPredicate) {
17
- const id = core.ResourceLocationNode.mock(range, {
18
- category: 'block',
19
- allowTag: isPredicate,
20
- });
18
+ const id = core.ResourceLocationNode.mock(range, { category: 'block', allowTag: isPredicate });
21
19
  return {
22
20
  type: 'mcfunction:block',
23
21
  range: core.Range.get(range),
24
22
  children: [id],
25
23
  id,
24
+ isPredicate: false,
26
25
  };
27
26
  }
28
27
  BlockNode.mock = mock;
@@ -31,12 +30,7 @@ export const CoordinateNotations = ['', '~', '^'];
31
30
  export var CoordinateNode;
32
31
  (function (CoordinateNode) {
33
32
  function mock(range) {
34
- return {
35
- type: 'mcfunction:coordinate',
36
- range: core.Range.get(range),
37
- notation: '',
38
- value: 0,
39
- };
33
+ return { type: 'mcfunction:coordinate', range: core.Range.get(range), notation: '', value: 0 };
40
34
  }
41
35
  CoordinateNode.mock = mock;
42
36
  /**
@@ -53,12 +47,11 @@ export var EntitySelectorArgumentsNode;
53
47
  (function (EntitySelectorArgumentsNode) {
54
48
  /* istanbul ignore next */
55
49
  function is(node) {
56
- return (node.type ===
57
- 'mcfunction:entity_selector/arguments');
50
+ return (node.type === 'mcfunction:entity_selector/arguments');
58
51
  }
59
52
  EntitySelectorArgumentsNode.is = is;
60
53
  })(EntitySelectorArgumentsNode || (EntitySelectorArgumentsNode = {}));
61
- export const EntitySelectorVariables = ['a', 'e', 'p', 'r', 's'];
54
+ const EntitySelectorVariables = ['a', 'e', 'p', 'r', 's', 'n'];
62
55
  export var EntitySelectorVariable;
63
56
  (function (EntitySelectorVariable) {
64
57
  /* istanbul ignore next */
@@ -67,7 +60,7 @@ export var EntitySelectorVariable;
67
60
  }
68
61
  EntitySelectorVariable.is = is;
69
62
  })(EntitySelectorVariable || (EntitySelectorVariable = {}));
70
- export const EntitySelectorAtVariables = EntitySelectorVariables.map((v) => `@${v}`);
63
+ const EntitySelectorAtVariables = EntitySelectorVariables.map((v) => `@${v}`);
71
64
  export var EntitySelectorAtVariable;
72
65
  (function (EntitySelectorAtVariable) {
73
66
  /* istanbul ignore next */
@@ -75,20 +68,24 @@ export var EntitySelectorAtVariable;
75
68
  return EntitySelectorAtVariables.includes(value);
76
69
  }
77
70
  EntitySelectorAtVariable.is = is;
71
+ /**
72
+ * Should be used to get a list of available selectors for the current version.
73
+ */
74
+ function filterAvailable(ctx) {
75
+ const release = ctx.project['loadedVersion'];
76
+ return EntitySelectorAtVariables.filter(variable => !(variable === '@n' && release && ReleaseVersion.cmp(release, '1.21') < 0));
77
+ }
78
+ EntitySelectorAtVariable.filterAvailable = filterAvailable;
78
79
  })(EntitySelectorAtVariable || (EntitySelectorAtVariable = {}));
79
80
  export var EntitySelectorNode;
80
81
  (function (EntitySelectorNode) {
81
82
  /* istanbul ignore next */
82
83
  function is(node) {
83
- return (node?.type ===
84
- 'mcfunction:entity_selector');
84
+ return (node?.type === 'mcfunction:entity_selector');
85
85
  }
86
86
  EntitySelectorNode.is = is;
87
- function mock(range) {
88
- const literal = core.LiteralNode.mock(range, {
89
- pool: EntitySelectorAtVariables,
90
- colorTokenType: 'keyword',
91
- });
87
+ function mock(range, options) {
88
+ const literal = core.LiteralNode.mock(range, options);
92
89
  return {
93
90
  type: 'mcfunction:entity_selector',
94
91
  range: core.Range.get(range),
@@ -122,9 +119,8 @@ export var EntitySelectorNode;
122
119
  ]);
123
120
  function canKeyExist(selector, argument, key) {
124
121
  const hasKey = (key) => !!argument.children.find((p) => p.key?.value === key);
125
- const hasNonInvertedKey = (key) => !!argument.children.find((p) => p.key?.value === key &&
126
- !p.value
127
- ?.inverted);
122
+ const hasNonInvertedKey = (key) => !!argument.children.find((p) => p.key?.value === key
123
+ && !p.value?.inverted);
128
124
  switch (key) {
129
125
  case 'advancements':
130
126
  case 'distance':
@@ -152,9 +148,7 @@ export var EntitySelectorNode;
152
148
  : 0 /* Result.Ok */;
153
149
  case 'type':
154
150
  return selector.typeLimited
155
- ? hasKey(key)
156
- ? 1 /* Result.Duplicated */
157
- : 2 /* Result.NotApplicable */
151
+ ? hasKey(key) ? 1 /* Result.Duplicated */ : 2 /* Result.NotApplicable */
158
152
  : 0 /* Result.Ok */;
159
153
  }
160
154
  return 0 /* Result.Ok */;
@@ -168,26 +162,80 @@ export var EntityNode;
168
162
  }
169
163
  EntityNode.is = is;
170
164
  })(EntityNode || (EntityNode = {}));
171
- export var ItemNode;
172
- (function (ItemNode) {
165
+ export var ItemStackNode;
166
+ (function (ItemStackNode) {
173
167
  function is(node) {
174
- return node?.type === 'mcfunction:item';
168
+ return node?.type === 'mcfunction:item_stack';
175
169
  }
176
- ItemNode.is = is;
177
- function mock(range, isPredicate) {
178
- const id = core.ResourceLocationNode.mock(range, {
179
- category: 'item',
180
- allowTag: isPredicate,
181
- });
182
- return {
183
- type: 'mcfunction:item',
184
- range: core.Range.get(range),
185
- children: [id],
186
- id,
187
- };
170
+ ItemStackNode.is = is;
171
+ function mock(range) {
172
+ const id = core.ResourceLocationNode.mock(range, { category: 'item' });
173
+ return { type: 'mcfunction:item_stack', range: core.Range.get(range), children: [id], id };
174
+ }
175
+ ItemStackNode.mock = mock;
176
+ })(ItemStackNode || (ItemStackNode = {}));
177
+ export var ComponentListNode;
178
+ (function (ComponentListNode) {
179
+ function is(node) {
180
+ return node.type === 'mcfunction:component_list';
181
+ }
182
+ ComponentListNode.is = is;
183
+ })(ComponentListNode || (ComponentListNode = {}));
184
+ export var ItemPredicateNode;
185
+ (function (ItemPredicateNode) {
186
+ function is(node) {
187
+ return node?.type === 'mcfunction:item_predicate';
188
+ }
189
+ ItemPredicateNode.is = is;
190
+ function mock(range) {
191
+ const id = core.ResourceLocationNode.mock(range, { category: 'item', allowTag: true });
192
+ return { type: 'mcfunction:item_predicate', range: core.Range.get(range), children: [id], id };
193
+ }
194
+ ItemPredicateNode.mock = mock;
195
+ })(ItemPredicateNode || (ItemPredicateNode = {}));
196
+ export var ComponentTestsNode;
197
+ (function (ComponentTestsNode) {
198
+ function is(node) {
199
+ return node.type === 'mcfunction:component_tests';
200
+ }
201
+ ComponentTestsNode.is = is;
202
+ })(ComponentTestsNode || (ComponentTestsNode = {}));
203
+ export var ComponentTestsAnyOfNode;
204
+ (function (ComponentTestsAnyOfNode) {
205
+ function is(node) {
206
+ return node.type === 'mcfunction:component_tests_any_of';
207
+ }
208
+ ComponentTestsAnyOfNode.is = is;
209
+ })(ComponentTestsAnyOfNode || (ComponentTestsAnyOfNode = {}));
210
+ export var ComponentTestsAllOfNode;
211
+ (function (ComponentTestsAllOfNode) {
212
+ function is(node) {
213
+ return node.type === 'mcfunction:component_tests_all_of';
214
+ }
215
+ ComponentTestsAllOfNode.is = is;
216
+ })(ComponentTestsAllOfNode || (ComponentTestsAllOfNode = {}));
217
+ export var ComponentTestExactNode;
218
+ (function (ComponentTestExactNode) {
219
+ function is(node) {
220
+ return node.type === 'mcfunction:component_test_exact';
221
+ }
222
+ ComponentTestExactNode.is = is;
223
+ })(ComponentTestExactNode || (ComponentTestExactNode = {}));
224
+ export var ComponentTestExistsNode;
225
+ (function (ComponentTestExistsNode) {
226
+ function is(node) {
227
+ return node.type === 'mcfunction:component_test_exists';
228
+ }
229
+ ComponentTestExistsNode.is = is;
230
+ })(ComponentTestExistsNode || (ComponentTestExistsNode = {}));
231
+ export var ComponentTestSubpredicateNode;
232
+ (function (ComponentTestSubpredicateNode) {
233
+ function is(node) {
234
+ return node.type
235
+ === 'mcfunction:component_test_sub_predicate';
188
236
  }
189
- ItemNode.mock = mock;
190
- })(ItemNode || (ItemNode = {}));
237
+ ComponentTestSubpredicateNode.is = is;
238
+ })(ComponentTestSubpredicateNode || (ComponentTestSubpredicateNode = {}));
191
239
  export var IntRangeNode;
192
240
  (function (IntRangeNode) {
193
241
  function mock(range) {
@@ -200,6 +248,30 @@ export var IntRangeNode;
200
248
  }
201
249
  IntRangeNode.mock = mock;
202
250
  })(IntRangeNode || (IntRangeNode = {}));
251
+ export var NbtNode;
252
+ (function (NbtNode) {
253
+ /* istanbul ignore next */
254
+ function is(node) {
255
+ return node.type === 'mcfunction:nbt';
256
+ }
257
+ NbtNode.is = is;
258
+ })(NbtNode || (NbtNode = {}));
259
+ export var NbtPathNode;
260
+ (function (NbtPathNode) {
261
+ /* istanbul ignore next */
262
+ function is(node) {
263
+ return node.type === 'mcfunction:nbt_path';
264
+ }
265
+ NbtPathNode.is = is;
266
+ })(NbtPathNode || (NbtPathNode = {}));
267
+ export var NbtResourceNode;
268
+ (function (NbtResourceNode) {
269
+ /* istanbul ignore next */
270
+ function is(node) {
271
+ return node.type === 'mcfunction:nbt_resource';
272
+ }
273
+ NbtResourceNode.is = is;
274
+ })(NbtResourceNode || (NbtResourceNode = {}));
203
275
  export var ObjectiveCriteriaNode;
204
276
  (function (ObjectiveCriteriaNode) {
205
277
  ObjectiveCriteriaNode.SimpleValues = [
@@ -228,15 +300,13 @@ export var ObjectiveCriteriaNode;
228
300
  ]);
229
301
  ObjectiveCriteriaNode.ComplexSep = ':';
230
302
  function mock(range) {
231
- return {
232
- type: 'mcfunction:objective_criteria',
233
- range: core.Range.get(range),
234
- };
303
+ return { type: 'mcfunction:objective_criteria', range: core.Range.get(range) };
235
304
  }
236
305
  ObjectiveCriteriaNode.mock = mock;
237
306
  })(ObjectiveCriteriaNode || (ObjectiveCriteriaNode = {}));
238
307
  export var ParticleNode;
239
308
  (function (ParticleNode) {
309
+ // until 1.20.5
240
310
  const SpecialTypes = new Set([
241
311
  'block',
242
312
  'block_marker',
@@ -252,20 +322,23 @@ export var ParticleNode;
252
322
  return SpecialTypes.has(type);
253
323
  }
254
324
  ParticleNode.isSpecialType = isSpecialType;
325
+ // since 1.20.5
326
+ const OptionTypes = new Set([
327
+ ...SpecialTypes,
328
+ 'dust_pillar',
329
+ 'entity_effect',
330
+ ]);
331
+ function requiresOptions(type) {
332
+ return OptionTypes.has(type);
333
+ }
334
+ ParticleNode.requiresOptions = requiresOptions;
255
335
  function is(node) {
256
336
  return node?.type === 'mcfunction:particle';
257
337
  }
258
338
  ParticleNode.is = is;
259
339
  function mock(range) {
260
- const id = core.ResourceLocationNode.mock(range, {
261
- category: 'particle_type',
262
- });
263
- return {
264
- type: 'mcfunction:particle',
265
- range: core.Range.get(range),
266
- children: [id],
267
- id,
268
- };
340
+ const id = core.ResourceLocationNode.mock(range, { category: 'particle_type' });
341
+ return { type: 'mcfunction:particle', range: core.Range.get(range), children: [id], id };
269
342
  }
270
343
  ParticleNode.mock = mock;
271
344
  })(ParticleNode || (ParticleNode = {}));
@@ -284,12 +357,7 @@ export var ScoreHolderNode;
284
357
  })(ScoreHolderNode || (ScoreHolderNode = {}));
285
358
  export var TimeNode;
286
359
  (function (TimeNode) {
287
- TimeNode.UnitToTicks = new Map([
288
- ['', 1],
289
- ['t', 1],
290
- ['s', 20],
291
- ['d', 24000],
292
- ]);
360
+ TimeNode.UnitToTicks = new Map([['', 1], ['t', 1], ['s', 20], ['d', 24000]]);
293
361
  TimeNode.Units = [...TimeNode.UnitToTicks.keys()];
294
362
  })(TimeNode || (TimeNode = {}));
295
363
  export var VectorNode;
@@ -1,16 +1,26 @@
1
1
  import * as core from '@spyglassmc/core';
2
2
  import * as json from '@spyglassmc/json';
3
3
  import * as mcf from '@spyglassmc/mcfunction';
4
- import type { BlockNode, ParticleNode } from '../node/index.js';
4
+ import type { BlockNode, EntityNode, ParticleNode, ScoreHolderNode, UuidNode } from '../node/index.js';
5
+ import { EntitySelectorNode } from '../node/index.js';
5
6
  /**
6
7
  * @returns The parser for the specified argument tree node. All argument parsers used in the `mcfunction` package
7
8
  * fail on empty input.
8
9
  */
9
10
  export declare const argument: mcf.ArgumentParserGetter;
10
11
  export declare const blockPredicate: core.InfallibleParser<BlockNode>;
11
- export declare const component: core.Parser<json.JsonNode>;
12
+ export declare function entity(amount: 'multiple' | 'single', type: 'entities' | 'players'): core.Parser<EntityNode>;
13
+ export declare const itemSlots: core.InfallibleParser<core.LiteralNode>;
14
+ export declare function jsonParser(typeRef: `::${string}::${string}`): core.Parser<json.TypedJsonNode>;
12
15
  export declare const particle: core.InfallibleParser<ParticleNode>;
13
- export declare const scoreHolderFakeName: core.Parser<core.SymbolNode>;
14
- export declare function tag(terminators?: string[]): core.InfallibleParser<core.SymbolNode>;
16
+ /**
17
+ * Failure when not beginning with `@[parse]`
18
+ */
19
+ export declare function selector(ignoreInvalidPrefix?: boolean): core.Parser<EntitySelectorNode>;
20
+ export declare function scoreHolderFakeName(usageType: core.SymbolUsageType): core.Parser<core.SymbolNode>;
21
+ export declare function scoreHolder(usageType: core.SymbolUsageType, amount: 'multiple' | 'single'): core.Parser<ScoreHolderNode>;
22
+ export declare function objective(usageType?: core.SymbolUsageType, terminators?: string[]): core.InfallibleParser<core.SymbolNode>;
23
+ export declare function tag(usageType?: core.SymbolUsageType, terminators?: string[]): core.InfallibleParser<core.SymbolNode>;
15
24
  export declare function team(usageType?: core.SymbolUsageType, terminators?: string[]): core.InfallibleParser<core.SymbolNode>;
25
+ export declare const uuid: core.InfallibleParser<UuidNode>;
16
26
  //# sourceMappingURL=argument.d.ts.map