@spyglassmc/java-edition 0.3.2 → 0.3.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/binder/index.js +20 -4
- package/lib/dependency/common.d.ts +1 -1
- package/lib/dependency/mcmeta.d.ts +3 -3
- package/lib/dependency/mcmeta.js +5 -2
- package/lib/index.js +4 -1
- package/lib/json/checker/data/common.js +14 -3
- package/lib/json/checker/data/feature.js +9 -5
- package/lib/json/checker/data/loot_table.js +24 -4
- package/lib/json/checker/data/structure.js +4 -2
- package/lib/json/checker/data/text_component.js +11 -4
- package/lib/json/checker/index.js +2 -1
- package/lib/json/checker/util/advancement.js +2 -1
- package/lib/json/checker/util/nbt.d.ts +1 -1
- package/lib/json/checker/util/nbt.js +2 -1
- package/lib/json/checker/util/version.d.ts +1 -1
- package/lib/mcfunction/checker/index.js +4 -4
- package/lib/mcfunction/index.js +13 -1
- package/lib/mcfunction/node/argument.d.ts +4 -4
- package/lib/mcfunction/parser/argument.js +37 -14
- package/lib/mcfunction/signatureHelpProvider.js +3 -1
- package/lib/mcfunction/tree/argument.d.ts +1 -1
- package/package.json +7 -7
package/lib/binder/index.js
CHANGED
|
@@ -85,19 +85,35 @@ export const Categories = (() => {
|
|
|
85
85
|
],
|
|
86
86
|
[
|
|
87
87
|
'worldgen/noise_settings',
|
|
88
|
-
{
|
|
88
|
+
{
|
|
89
|
+
category: 'worldgen/noise_settings',
|
|
90
|
+
extname: '.json',
|
|
91
|
+
since: '1.16',
|
|
92
|
+
},
|
|
89
93
|
],
|
|
90
94
|
[
|
|
91
95
|
'worldgen/placed_feature',
|
|
92
|
-
{
|
|
96
|
+
{
|
|
97
|
+
category: 'worldgen/placed_feature',
|
|
98
|
+
extname: '.json',
|
|
99
|
+
since: '1.18',
|
|
100
|
+
},
|
|
93
101
|
],
|
|
94
102
|
[
|
|
95
103
|
'worldgen/processor_list',
|
|
96
|
-
{
|
|
104
|
+
{
|
|
105
|
+
category: 'worldgen/processor_list',
|
|
106
|
+
extname: '.json',
|
|
107
|
+
since: '1.16',
|
|
108
|
+
},
|
|
97
109
|
],
|
|
98
110
|
[
|
|
99
111
|
'worldgen/template_pool',
|
|
100
|
-
{
|
|
112
|
+
{
|
|
113
|
+
category: 'worldgen/template_pool',
|
|
114
|
+
extname: '.json',
|
|
115
|
+
since: '1.16',
|
|
116
|
+
},
|
|
101
117
|
],
|
|
102
118
|
]);
|
|
103
119
|
for (const registry of TaggableResourceLocationCategories) {
|
|
@@ -28,7 +28,7 @@ export interface McmetaVersion {
|
|
|
28
28
|
release_time: string;
|
|
29
29
|
sha1: string;
|
|
30
30
|
}
|
|
31
|
-
export
|
|
31
|
+
export type McmetaVersions = McmetaVersion[];
|
|
32
32
|
export interface McmetaSummary {
|
|
33
33
|
blocks: McmetaStates;
|
|
34
34
|
commands: McmetaCommands;
|
|
@@ -45,7 +45,7 @@ export interface McmetaStates {
|
|
|
45
45
|
}
|
|
46
46
|
];
|
|
47
47
|
}
|
|
48
|
-
export
|
|
48
|
+
export type McmetaCommands = RootTreeNode;
|
|
49
49
|
interface BaseTreeNode {
|
|
50
50
|
type: string;
|
|
51
51
|
children?: {
|
|
@@ -70,7 +70,7 @@ export interface RootTreeNode extends BaseTreeNode {
|
|
|
70
70
|
[command: string]: LiteralTreeNode;
|
|
71
71
|
};
|
|
72
72
|
}
|
|
73
|
-
export
|
|
73
|
+
export type CommandTreeNode = ArgumentTreeNode | LiteralTreeNode | RootTreeNode;
|
|
74
74
|
export interface McmetaRegistries {
|
|
75
75
|
[id: string]: string[];
|
|
76
76
|
}
|
package/lib/dependency/mcmeta.js
CHANGED
|
@@ -93,7 +93,10 @@ export function symbolRegistrar(summary) {
|
|
|
93
93
|
stateQuery.amend({
|
|
94
94
|
data: {
|
|
95
95
|
relations: {
|
|
96
|
-
default: {
|
|
96
|
+
default: {
|
|
97
|
+
category,
|
|
98
|
+
path: valueQuery.path,
|
|
99
|
+
},
|
|
97
100
|
},
|
|
98
101
|
},
|
|
99
102
|
});
|
|
@@ -143,5 +146,5 @@ export const Fluids = {
|
|
|
143
146
|
lava: [{ falling: ['false', 'true'] }, { falling: 'false' }],
|
|
144
147
|
water: [{ falling: ['false', 'true'] }, { falling: 'false' }],
|
|
145
148
|
};
|
|
146
|
-
|
|
149
|
+
// #endregion
|
|
147
150
|
//# sourceMappingURL=mcmeta.js.map
|
package/lib/index.js
CHANGED
|
@@ -33,7 +33,10 @@ export const initialize = async (ctx) => {
|
|
|
33
33
|
return;
|
|
34
34
|
}
|
|
35
35
|
const packMcmeta = await getPackMcmeta();
|
|
36
|
-
const { release, id: version, isLatest, } = resolveConfiguredVersion(config.env.gameVersion, {
|
|
36
|
+
const { release, id: version, isLatest, } = resolveConfiguredVersion(config.env.gameVersion, {
|
|
37
|
+
packMcmeta,
|
|
38
|
+
versions,
|
|
39
|
+
});
|
|
37
40
|
meta.registerDependencyProvider('@vanilla-mcdoc', () => getVanillaMcdoc(downloader));
|
|
38
41
|
const summary = await getMcmetaSummary(ctx.externals, downloader, logger, version, isLatest, config.env.dataSource, config.env.mcmetaSummaryOverrides);
|
|
39
42
|
if (!summary.blocks ||
|
|
@@ -9,7 +9,8 @@ function smallestEncompassingPowerOfTwo(n) {
|
|
|
9
9
|
n |= n >> 16;
|
|
10
10
|
return n + 1;
|
|
11
11
|
}
|
|
12
|
-
const BITS_FOR_Y = 64 -
|
|
12
|
+
const BITS_FOR_Y = 64 -
|
|
13
|
+
2 * (1 + Math.log2(smallestEncompassingPowerOfTwo(30000000))); // 12
|
|
13
14
|
export const Y_SIZE = (1 << BITS_FOR_Y) - 32; // 4064
|
|
14
15
|
export const MAX_Y = (Y_SIZE >> 1) - 1; // 2031
|
|
15
16
|
export const MIN_Y = MAX_Y - Y_SIZE + 1; // -2031
|
|
@@ -49,7 +50,12 @@ export const score_provider = any([
|
|
|
49
50
|
type: resource('loot_score_provider_type'),
|
|
50
51
|
...pick(type, {
|
|
51
52
|
context: {
|
|
52
|
-
target: literal([
|
|
53
|
+
target: literal([
|
|
54
|
+
'this',
|
|
55
|
+
'killer',
|
|
56
|
+
'player_killer',
|
|
57
|
+
'direct_killer',
|
|
58
|
+
]),
|
|
53
59
|
},
|
|
54
60
|
fixed: {
|
|
55
61
|
name: simpleString, // TODO: score holder, no selector
|
|
@@ -63,7 +69,12 @@ export const nbt_provider = any([
|
|
|
63
69
|
type: resource('loot_nbt_provider_type'),
|
|
64
70
|
...pick(type, {
|
|
65
71
|
context: {
|
|
66
|
-
target: literal([
|
|
72
|
+
target: literal([
|
|
73
|
+
'this',
|
|
74
|
+
'killer',
|
|
75
|
+
'killer_player',
|
|
76
|
+
'block_entity',
|
|
77
|
+
]),
|
|
67
78
|
},
|
|
68
79
|
storage: {
|
|
69
80
|
source: resource('storage'),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { JsonArrayNode, JsonObjectNode } from '@spyglassmc/json';
|
|
2
2
|
import { any, as, boolean, dispatch, extract, float, floatRange, int, intRange, listOf, literal, opt, pick, record, ref, resource, simpleString, } from '@spyglassmc/json/lib/checker/primitives/index.js';
|
|
3
3
|
import { renamed, versioned } from '../util/index.js';
|
|
4
|
-
import { block_state, Direction, floatProvider, fluid_state,
|
|
4
|
+
import { block_state, Direction, floatProvider, fluid_state, height_provider, HeightmapType, inclusiveRange, intProvider, noise_parameters, uniformInt, Y_SIZE, } from './common.js';
|
|
5
5
|
import { processor_list_ref, rule_test } from './structure.js';
|
|
6
6
|
function intersection(...values) {
|
|
7
7
|
return [
|
|
@@ -38,18 +38,21 @@ function blockProviderProperties(node, ctx) {
|
|
|
38
38
|
switch (extract('type', node.children)?.replace(/^minecraft:/, '')) {
|
|
39
39
|
case 'dual_noise_provider':
|
|
40
40
|
case 'noise_provider':
|
|
41
|
-
const states = node.children.find((p) => p.key?.value === 'states')
|
|
41
|
+
const states = node.children.find((p) => p.key?.value === 'states')
|
|
42
|
+
?.value;
|
|
42
43
|
return blockStateIntProperties(states, ctx);
|
|
43
44
|
case 'noise_threshold':
|
|
44
45
|
const lowStates = node.children.find((p) => p.key?.value === 'low_states')?.value;
|
|
45
46
|
const highStates = node.children.find((p) => p.key?.value === 'high_states')?.value;
|
|
46
47
|
return intersection(blockStateIntProperties(lowStates, ctx), blockStateIntProperties(highStates, ctx));
|
|
47
48
|
case 'randomized_int_state_provider':
|
|
48
|
-
const source = node.children.find((p) => p.key?.value === 'source')
|
|
49
|
+
const source = node.children.find((p) => p.key?.value === 'source')
|
|
50
|
+
?.value;
|
|
49
51
|
return blockProviderProperties(source, ctx);
|
|
50
52
|
case 'rotated_block_provider':
|
|
51
53
|
case 'simple_state_provider':
|
|
52
|
-
const state = node.children.find((p) => p.key?.value === 'state')
|
|
54
|
+
const state = node.children.find((p) => p.key?.value === 'state')
|
|
55
|
+
?.value;
|
|
53
56
|
return blockStateIntProperties(state, ctx);
|
|
54
57
|
case 'weighted_state_provider':
|
|
55
58
|
const entries = node.children.find((p) => p.key?.value === 'entries')?.value;
|
|
@@ -57,7 +60,8 @@ function blockProviderProperties(node, ctx) {
|
|
|
57
60
|
const values = entries.children
|
|
58
61
|
.map((n) => n.value &&
|
|
59
62
|
JsonObjectNode.is(n.value) &&
|
|
60
|
-
n.value.children.find((p) => p.key?.value === 'data')
|
|
63
|
+
n.value.children.find((p) => p.key?.value === 'data')
|
|
64
|
+
?.value)
|
|
61
65
|
.filter((n) => n)
|
|
62
66
|
.map((n) => blockStateIntProperties(n, ctx));
|
|
63
67
|
return intersection(...values);
|
|
@@ -60,11 +60,21 @@ export const predicate = as('predicate', dispatch('condition', (condition, props
|
|
|
60
60
|
predicate: damage_source_predicate,
|
|
61
61
|
},
|
|
62
62
|
entity_properties: {
|
|
63
|
-
entity: literal([
|
|
63
|
+
entity: literal([
|
|
64
|
+
'this',
|
|
65
|
+
'killer',
|
|
66
|
+
'killer_player',
|
|
67
|
+
'direct_killer',
|
|
68
|
+
]),
|
|
64
69
|
predicate: entity_predicate,
|
|
65
70
|
},
|
|
66
71
|
entity_scores: {
|
|
67
|
-
entity: literal([
|
|
72
|
+
entity: literal([
|
|
73
|
+
'this',
|
|
74
|
+
'killer',
|
|
75
|
+
'killer_player',
|
|
76
|
+
'direct_killer',
|
|
77
|
+
]),
|
|
68
78
|
scores: object(literal('objective'), () => int_bounds),
|
|
69
79
|
},
|
|
70
80
|
inverted: {
|
|
@@ -136,7 +146,12 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
|
|
|
136
146
|
}),
|
|
137
147
|
},
|
|
138
148
|
copy_name: {
|
|
139
|
-
source: literal([
|
|
149
|
+
source: literal([
|
|
150
|
+
'this',
|
|
151
|
+
'killer',
|
|
152
|
+
'killer_player',
|
|
153
|
+
'block_entity',
|
|
154
|
+
]),
|
|
140
155
|
},
|
|
141
156
|
copy_nbt: {
|
|
142
157
|
source: nbt_provider,
|
|
@@ -165,7 +180,12 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
|
|
|
165
180
|
skip_existing_chunks: opt(boolean, true),
|
|
166
181
|
},
|
|
167
182
|
fill_player_head: {
|
|
168
|
-
entity: literal([
|
|
183
|
+
entity: literal([
|
|
184
|
+
'this',
|
|
185
|
+
'killer',
|
|
186
|
+
'killer_player',
|
|
187
|
+
'direct_killer',
|
|
188
|
+
]),
|
|
169
189
|
},
|
|
170
190
|
limit_count: {
|
|
171
191
|
limit: int_bounds,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
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
2
|
import { nbt, versioned } from '../util/index.js';
|
|
3
|
-
import { block_state,
|
|
3
|
+
import { block_state, height_provider, HeightmapType } from './common.js';
|
|
4
4
|
import { configured_feature_ref, placed_feature_ref } from './feature.js';
|
|
5
5
|
export const rule_test = as('rule_test', dispatch('predicate_type', (type) => record({
|
|
6
6
|
predicate_type: resource('rule_test'),
|
|
@@ -38,7 +38,9 @@ export const pos_rule_test = as('pos_rule_test', dispatch('predicate_type', (typ
|
|
|
38
38
|
...when(type, ['axis_aligned_linear_pos', 'linear_pos'], {}),
|
|
39
39
|
})));
|
|
40
40
|
const processor_rule = as('processor_rule', dispatch((props) => record({
|
|
41
|
-
position_predicate: opt(pos_rule_test, {
|
|
41
|
+
position_predicate: opt(pos_rule_test, {
|
|
42
|
+
predicate_type: 'always_true',
|
|
43
|
+
}),
|
|
42
44
|
input_predicate: rule_test,
|
|
43
45
|
location_predicate: rule_test,
|
|
44
46
|
output_state: block_state,
|
|
@@ -70,13 +70,13 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
70
70
|
entity: {
|
|
71
71
|
entity: simpleString,
|
|
72
72
|
nbt: nbtPath({
|
|
73
|
-
registry: 'entity_type' /* FIXME: import { getTypesFromEntity } from '../../../../mcfunction/checker'; ids: getTypesFromEntity(somehowGetTheNodeHere, ctx)
|
|
73
|
+
registry: 'entity_type', /* FIXME: import { getTypesFromEntity } from '../../../../mcfunction/checker'; ids: getTypesFromEntity(somehowGetTheNodeHere, ctx) */
|
|
74
74
|
}),
|
|
75
75
|
},
|
|
76
76
|
storage: {
|
|
77
77
|
storage: resource('storage'),
|
|
78
78
|
nbt: nbtPath({
|
|
79
|
-
registry: 'storage' /* FIXME:, id: extract('storage', props)
|
|
79
|
+
registry: 'storage', /* FIXME:, id: extract('storage', props) */
|
|
80
80
|
}),
|
|
81
81
|
},
|
|
82
82
|
}),
|
|
@@ -125,7 +125,10 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
125
125
|
contents: opt(versioned(ctx, '1.16', dispatch((props) => record({
|
|
126
126
|
id: resource('item'),
|
|
127
127
|
count: opt(int),
|
|
128
|
-
tag: opt(nbt({
|
|
128
|
+
tag: opt(nbt({
|
|
129
|
+
registry: 'item',
|
|
130
|
+
id: extract('id', props),
|
|
131
|
+
})),
|
|
129
132
|
})))),
|
|
130
133
|
},
|
|
131
134
|
show_entity: {
|
|
@@ -144,5 +147,9 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
144
147
|
}))),
|
|
145
148
|
extra: opt(listOf(text_component)),
|
|
146
149
|
})(node, ctx));
|
|
147
|
-
export const text_component = as('text_component', any([
|
|
150
|
+
export const text_component = as('text_component', any([
|
|
151
|
+
simpleString,
|
|
152
|
+
text_component_object,
|
|
153
|
+
listOf(ref(() => text_component)),
|
|
154
|
+
]));
|
|
148
155
|
//# sourceMappingURL=text_component.js.map
|
|
@@ -116,7 +116,8 @@ export function object(typeDef) {
|
|
|
116
116
|
export function fieldValue(type) {
|
|
117
117
|
const isInRange = (value, { kind, min = -Infinity, max = Infinity }) => {
|
|
118
118
|
const comparator = (a, b, exclusive) => exclusive ? a < b : a <= b;
|
|
119
|
-
return (comparator(min, value, kind & 0b10) &&
|
|
119
|
+
return (comparator(min, value, kind & 0b10) &&
|
|
120
|
+
comparator(value, max, kind & 0b01));
|
|
120
121
|
};
|
|
121
122
|
const ExpectedTypes = {
|
|
122
123
|
boolean: 'json:boolean',
|
|
@@ -6,7 +6,8 @@ export function criterionReference(advancement) {
|
|
|
6
6
|
simpleString(node, ctx);
|
|
7
7
|
return;
|
|
8
8
|
}
|
|
9
|
-
const criteria = Object.values(ctx.symbols.query(ctx.doc, 'advancement', advancement).symbol
|
|
9
|
+
const criteria = Object.values(ctx.symbols.query(ctx.doc, 'advancement', advancement).symbol
|
|
10
|
+
?.members ??
|
|
10
11
|
{})
|
|
11
12
|
.filter((m) => m?.subcategory === 'criterion')
|
|
12
13
|
.map((s) => s.identifier);
|
|
@@ -9,7 +9,7 @@ interface RegistryOptions {
|
|
|
9
9
|
ids?: readonly string[] | undefined;
|
|
10
10
|
tag?: string | undefined;
|
|
11
11
|
}
|
|
12
|
-
|
|
12
|
+
type Options = DefinitionOptions | RegistryOptions;
|
|
13
13
|
export declare function nbt(options: Options): JsonChecker;
|
|
14
14
|
export declare function nbtPath(options: RegistryOptions): JsonChecker;
|
|
15
15
|
export {};
|
|
@@ -56,7 +56,8 @@ function getIds({ registry, id, idOrTag, ids, tag }, ctx) {
|
|
|
56
56
|
idOrTag.startsWith('#') ? (tag = idOrTag.slice(1)) : (id = idOrTag);
|
|
57
57
|
}
|
|
58
58
|
if (tag &&
|
|
59
|
-
(registry === 'block' || registry === 'item' ||
|
|
59
|
+
(registry === 'block' || registry === 'item' ||
|
|
60
|
+
registry === 'entity_type')) {
|
|
60
61
|
ids = getTagValues(`tag/${registry}`, tag, ctx);
|
|
61
62
|
}
|
|
62
63
|
else if (id) {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { JsonChecker, JsonCheckerContext, record } from '@spyglassmc/json/lib/checker/index.js';
|
|
2
2
|
import { ReleaseVersion } from '../../../dependency/index.js';
|
|
3
|
-
|
|
3
|
+
type CheckerRecord = Parameters<typeof record>[0];
|
|
4
4
|
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: string[]): string[];
|
|
5
5
|
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: JsonChecker | undefined): JsonChecker | undefined;
|
|
6
6
|
export declare function versioned(ctx: JsonCheckerContext, version: ReleaseVersion, checker: CheckerRecord | undefined): CheckerRecord | undefined;
|
|
@@ -124,7 +124,7 @@ const rootCommand = (nodes, index, ctx) => {
|
|
|
124
124
|
summonNbt(nodes, index + 1, ctx);
|
|
125
125
|
}
|
|
126
126
|
};
|
|
127
|
-
|
|
127
|
+
// #region Checkers for argument nodes
|
|
128
128
|
const block = (node, ctx) => {
|
|
129
129
|
if (!node.nbt) {
|
|
130
130
|
return;
|
|
@@ -149,8 +149,8 @@ const item = (node, ctx) => {
|
|
|
149
149
|
const particle = (node, ctx) => {
|
|
150
150
|
core.checker.dispatchSync(node, ctx);
|
|
151
151
|
};
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
// #endregion
|
|
153
|
+
// #region Checkers for command argument structure.
|
|
154
154
|
/**
|
|
155
155
|
* - `block <targetPos: block_pos> <nbt: nbt_compound_tag>`
|
|
156
156
|
* - `entity <target: entity> <nbt: nbt_compound_tag>`
|
|
@@ -231,7 +231,7 @@ const summonNbt = (nodes, index, ctx) => {
|
|
|
231
231
|
nbt.checker.index('entity_type', core.ResourceLocationNode.toString(typeNode, 'full'))(nbtNode, ctx);
|
|
232
232
|
}
|
|
233
233
|
};
|
|
234
|
-
|
|
234
|
+
// #endregion
|
|
235
235
|
export const getTypesFromEntity = (entity, ctx) => {
|
|
236
236
|
if (entity.playerName !== undefined || entity.selector?.playersOnly) {
|
|
237
237
|
return ['minecraft:player'];
|
package/lib/mcfunction/index.js
CHANGED
|
@@ -19,7 +19,19 @@ export const initialize = (ctx, commands, releaseVersion) => {
|
|
|
19
19
|
extensions: ['.mcfunction'],
|
|
20
20
|
parser: mcf.entry(releaseVersion, parser.argument),
|
|
21
21
|
completer: mcf.completer.entry(releaseVersion, completer.getMockNodes),
|
|
22
|
-
triggerCharacters: [
|
|
22
|
+
triggerCharacters: [
|
|
23
|
+
' ',
|
|
24
|
+
'[',
|
|
25
|
+
'=',
|
|
26
|
+
'!',
|
|
27
|
+
',',
|
|
28
|
+
'{',
|
|
29
|
+
':',
|
|
30
|
+
'/',
|
|
31
|
+
'.',
|
|
32
|
+
'"',
|
|
33
|
+
"'",
|
|
34
|
+
],
|
|
23
35
|
});
|
|
24
36
|
meta.registerParser('mcfunction:block_predicate', parser.blockPredicate);
|
|
25
37
|
meta.registerParser('mcfunction:component', parser.component);
|
|
@@ -18,7 +18,7 @@ export declare namespace BlockNode {
|
|
|
18
18
|
function mock(range: core.RangeLike, isPredicate: boolean): BlockNode;
|
|
19
19
|
}
|
|
20
20
|
export declare const CoordinateNotations: readonly ["", "~", "^"];
|
|
21
|
-
export
|
|
21
|
+
export type CoordinateNodeNotation = typeof CoordinateNotations[number];
|
|
22
22
|
export interface CoordinateNode extends core.FloatBaseNode {
|
|
23
23
|
type: 'mcfunction:coordinate';
|
|
24
24
|
notation: CoordinateNodeNotation;
|
|
@@ -55,12 +55,12 @@ export declare namespace EntitySelectorArgumentsNode {
|
|
|
55
55
|
function is(node: core.AstNode): node is EntitySelectorArgumentsNode;
|
|
56
56
|
}
|
|
57
57
|
export declare const EntitySelectorVariables: readonly ["a", "e", "p", "r", "s"];
|
|
58
|
-
export
|
|
58
|
+
export type EntitySelectorVariable = typeof EntitySelectorVariables[number];
|
|
59
59
|
export declare namespace EntitySelectorVariable {
|
|
60
60
|
function is(value: string): value is EntitySelectorVariable;
|
|
61
61
|
}
|
|
62
62
|
export declare const EntitySelectorAtVariables: ("@a" | "@e" | "@p" | "@r" | "@s")[];
|
|
63
|
-
export
|
|
63
|
+
export type EntitySelectorAtVariable = typeof EntitySelectorAtVariables[number];
|
|
64
64
|
export declare namespace EntitySelectorAtVariable {
|
|
65
65
|
function is(value: string): value is EntitySelectorAtVariable;
|
|
66
66
|
}
|
|
@@ -80,7 +80,7 @@ export interface EntitySelectorNode extends core.AstNode {
|
|
|
80
80
|
export declare namespace EntitySelectorNode {
|
|
81
81
|
function is<T extends core.DeepReadonly<core.AstNode> | undefined>(node: T): node is core.NodeIsHelper<EntitySelectorNode, T>;
|
|
82
82
|
function mock(range: core.RangeLike): EntitySelectorNode;
|
|
83
|
-
const ArgumentKeys: Set<"predicate" | "tag" | "team" | "type" | "level" | "advancements" | "nbt" | "name" | "distance" | "gamemode" | "limit" | "scores" | "
|
|
83
|
+
const ArgumentKeys: Set<"predicate" | "tag" | "team" | "type" | "level" | "advancements" | "sort" | "nbt" | "name" | "distance" | "gamemode" | "limit" | "scores" | "x" | "y" | "z" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
|
|
84
84
|
type ArgumentKey = typeof ArgumentKeys extends Set<infer T> ? T : undefined;
|
|
85
85
|
const enum Result {
|
|
86
86
|
Ok = 0,
|
|
@@ -400,7 +400,9 @@ function range(type, min, max, cycleable) {
|
|
|
400
400
|
: res.children.filter(core.IntegerNode.is);
|
|
401
401
|
const sepNode = res.children.find(core.LiteralNode.is);
|
|
402
402
|
const ans = {
|
|
403
|
-
type: type === 'float'
|
|
403
|
+
type: type === 'float'
|
|
404
|
+
? 'mcfunction:float_range'
|
|
405
|
+
: 'mcfunction:int_range',
|
|
404
406
|
range: res.range,
|
|
405
407
|
children: res.children,
|
|
406
408
|
value: sepNode
|
|
@@ -452,7 +454,10 @@ function selector() {
|
|
|
452
454
|
typeLimited = playersOnly;
|
|
453
455
|
function invertable(parser) {
|
|
454
456
|
return core.map(core.sequence([
|
|
455
|
-
core.optional(core.failOnEmpty(core.literal({
|
|
457
|
+
core.optional(core.failOnEmpty(core.literal({
|
|
458
|
+
pool: ['!'],
|
|
459
|
+
colorTokenType: 'keyword',
|
|
460
|
+
}))),
|
|
456
461
|
(src) => {
|
|
457
462
|
src.skipSpace();
|
|
458
463
|
return undefined;
|
|
@@ -476,7 +481,9 @@ function selector() {
|
|
|
476
481
|
...core.BrigadierStringOptions,
|
|
477
482
|
value: {
|
|
478
483
|
parser: core.literal({
|
|
479
|
-
pool: [
|
|
484
|
+
pool: [
|
|
485
|
+
...EntitySelectorNode.ArgumentKeys,
|
|
486
|
+
],
|
|
480
487
|
colorTokenType: 'property',
|
|
481
488
|
}),
|
|
482
489
|
type: 'literal',
|
|
@@ -505,7 +512,8 @@ function selector() {
|
|
|
505
512
|
pair: {
|
|
506
513
|
key: unquotedString,
|
|
507
514
|
sep: '=',
|
|
508
|
-
value: core
|
|
515
|
+
value: core
|
|
516
|
+
.boolean,
|
|
509
517
|
end: ',',
|
|
510
518
|
trailingEnd: true,
|
|
511
519
|
},
|
|
@@ -540,8 +548,8 @@ function selector() {
|
|
|
540
548
|
return core.map(range('float', 0), (res, _, ctx) => {
|
|
541
549
|
dimensionLimited = true;
|
|
542
550
|
// x, y, z, dx, dy, dz take precedence over distance, so we use ??= instead of = to ensure it won't override the result.
|
|
543
|
-
chunkLimited ??=
|
|
544
|
-
|
|
551
|
+
chunkLimited ??= !playersOnly &&
|
|
552
|
+
res.value[1] !== undefined;
|
|
545
553
|
if (hasKey(key.value)) {
|
|
546
554
|
ctx.err.report(localize('duplicate-key', localeQuote(key.value)), key);
|
|
547
555
|
}
|
|
@@ -549,7 +557,8 @@ function selector() {
|
|
|
549
557
|
});
|
|
550
558
|
case 'gamemode':
|
|
551
559
|
return core.map(invertable(core.string({
|
|
552
|
-
unquotable: core
|
|
560
|
+
unquotable: core
|
|
561
|
+
.BrigadierUnquotableOption,
|
|
553
562
|
value: {
|
|
554
563
|
type: 'literal',
|
|
555
564
|
parser: core.literal('adventure', 'creative', 'spectator', 'survival'),
|
|
@@ -594,7 +603,9 @@ function selector() {
|
|
|
594
603
|
case 'nbt':
|
|
595
604
|
return invertable(nbt.parser.compound);
|
|
596
605
|
case 'predicate':
|
|
597
|
-
return invertable(core.resourceLocation({
|
|
606
|
+
return invertable(core.resourceLocation({
|
|
607
|
+
category: 'predicate',
|
|
608
|
+
}));
|
|
598
609
|
case 'scores':
|
|
599
610
|
return core.map(core.record({
|
|
600
611
|
start: '{',
|
|
@@ -625,7 +636,8 @@ function selector() {
|
|
|
625
636
|
});
|
|
626
637
|
case 'sort':
|
|
627
638
|
return core.map(core.string({
|
|
628
|
-
unquotable: core
|
|
639
|
+
unquotable: core
|
|
640
|
+
.BrigadierUnquotableOption,
|
|
629
641
|
value: {
|
|
630
642
|
type: 'literal',
|
|
631
643
|
parser: core.literal('arbitrary', 'furthest', 'nearest', 'random'),
|
|
@@ -640,7 +652,14 @@ function selector() {
|
|
|
640
652
|
return res;
|
|
641
653
|
});
|
|
642
654
|
case 'tag':
|
|
643
|
-
return invertable(tag([
|
|
655
|
+
return invertable(tag([
|
|
656
|
+
'[',
|
|
657
|
+
'=',
|
|
658
|
+
',',
|
|
659
|
+
']',
|
|
660
|
+
'{',
|
|
661
|
+
'}',
|
|
662
|
+
]));
|
|
644
663
|
case 'team':
|
|
645
664
|
return core.map(invertable(team('reference', [
|
|
646
665
|
'[',
|
|
@@ -670,9 +689,11 @@ function selector() {
|
|
|
670
689
|
ctx.err.report(localize('mcfunction.parser.entity-selector.arguments.not-applicable', localeQuote(key.value)), key);
|
|
671
690
|
}
|
|
672
691
|
}
|
|
673
|
-
else if (!res.inverted &&
|
|
692
|
+
else if (!res.inverted &&
|
|
693
|
+
!res.value.isTag) {
|
|
674
694
|
typeLimited = true;
|
|
675
|
-
if (core.ResourceLocationNode
|
|
695
|
+
if (core.ResourceLocationNode
|
|
696
|
+
.toString(res.value, 'short') === 'player') {
|
|
676
697
|
playersOnly = true;
|
|
677
698
|
}
|
|
678
699
|
}
|
|
@@ -824,7 +845,8 @@ function symbol(options, terminators = []) {
|
|
|
824
845
|
function objective(usageType, terminators = []) {
|
|
825
846
|
return validateLength(unquotableSymbol({ category: 'objective', usageType }, terminators), ObjectiveMaxLength, 'mcfunction.parser.objective.too-long');
|
|
826
847
|
}
|
|
827
|
-
const objectiveCriteria = core
|
|
848
|
+
const objectiveCriteria = core
|
|
849
|
+
.map(core.any([
|
|
828
850
|
core.sequence([
|
|
829
851
|
core.stopBefore(core.resourceLocation({
|
|
830
852
|
category: 'stat_type',
|
|
@@ -834,7 +856,8 @@ const objectiveCriteria = core.map(core.any([
|
|
|
834
856
|
{
|
|
835
857
|
get: (res) => {
|
|
836
858
|
if (core.ResourceLocationNode.is(res.children[0])) {
|
|
837
|
-
const category = ObjectiveCriteriaNode.ComplexCategories
|
|
859
|
+
const category = ObjectiveCriteriaNode.ComplexCategories
|
|
860
|
+
.get(core.ResourceLocationNode.toString(res.children[0], 'short'));
|
|
838
861
|
if (category) {
|
|
839
862
|
return core.resourceLocation({
|
|
840
863
|
category,
|
|
@@ -37,7 +37,9 @@ export function signatureHelpProvider(commandTreeName) {
|
|
|
37
37
|
};
|
|
38
38
|
ans.signatures = options.map((v) => {
|
|
39
39
|
const part1 = v[selectedIndex];
|
|
40
|
-
const part2 = selectedIndex + 1 < v.length
|
|
40
|
+
const part2 = selectedIndex + 1 < v.length
|
|
41
|
+
? ` ${v[selectedIndex + 1]}`
|
|
42
|
+
: '';
|
|
41
43
|
const label = `${part1}${part2}`;
|
|
42
44
|
return {
|
|
43
45
|
label,
|
|
@@ -175,5 +175,5 @@ export interface MinecraftVec3ArgumentTreeNode extends mcf.ArgumentTreeNode {
|
|
|
175
175
|
export interface SpyglassmcTagArgumentTreeNode extends mcf.ArgumentTreeNode {
|
|
176
176
|
parser: 'spyglassmc:tag';
|
|
177
177
|
}
|
|
178
|
-
export
|
|
178
|
+
export type ArgumentTreeNode = BrigadierBoolArgumentTreeNode | BrigadierDoubleArgumentTreeNode | BrigadierFloatArgumentTreeNode | BrigadierIntegerArgumentTreeNode | BrigadierLongArgumentTreeNode | BrigadierStringArgumentTreeNode | MinecraftAngleArgumentTreeNode | MinecraftBlockPosArgumentTreeNode | MinecraftBlockPredicateArgumentTreeNode | MinecraftBlockStateArgumentTreeNode | MinecraftColorArgumentTreeNode | MinecraftColumnPosArgumentTreeNode | MinecraftComponentArgumentTreeNode | MinecraftDimensionArgumentTreeNode | MinecraftEntityArgumentTreeNode | MinecraftEntityAnchorArgumentTreeNode | MinecraftEntitySummonArgumentTreeNode | MinecraftFloatRangeArgumentTreeNode | MinecraftFunctionArgumentTreeNode | MinecraftGameProfileArgumentTreeNode | MinecraftIntRangeArgumentTreeNode | MinecraftItemEnchantmentArgumentTreeNode | MinecraftItemPredicateArgumentTreeNode | MinecraftItemSlotArgumentTreeNode | MinecraftItemStackArgumentTreeNode | MinecraftMessageArgumentTreeNode | MinecraftMobEffectArgumentTreeNode | MinecraftNbtCompoundTagArgumentTreeNode | MinecraftNbtPathArgumentTreeNode | MinecraftNbtTagArgumentTreeNode | MinecraftObjectiveArgumentTreeNode | MinecraftObjectiveCriteriaArgumentTreeNode | MinecraftOperationArgumentTreeNode | MinecraftParticleArgumentTreeNode | MinecraftResourceArgumentTreeNode | MinecraftResourceLocationArgumentTreeNode | MinecraftResourceOrTagArgumentTreeNode | MinecraftRotationArgumentTreeNode | MinecraftScoreHolderArgumentTreeNode | MinecraftScoreboardSlotArgumentTreeNode | MinecraftSwizzleArgumentTreeNode | MinecraftTeamArgumentTreeNode | MinecraftTimeArgumentTreeNode | MinecraftUuidArgumentTreeNode | MinecraftVec2ArgumentTreeNode | MinecraftVec3ArgumentTreeNode | SpyglassmcTagArgumentTreeNode;
|
|
179
179
|
//# sourceMappingURL=argument.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/java-edition",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.3",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|
|
@@ -17,12 +17,12 @@
|
|
|
17
17
|
"release:dry": "npm publish --dry-run"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@spyglassmc/core": "0.4.
|
|
21
|
-
"@spyglassmc/json": "0.3.
|
|
22
|
-
"@spyglassmc/locales": "0.3.
|
|
23
|
-
"@spyglassmc/mcfunction": "0.2.
|
|
24
|
-
"@spyglassmc/mcdoc": "0.3.
|
|
25
|
-
"@spyglassmc/nbt": "0.3.
|
|
20
|
+
"@spyglassmc/core": "0.4.2",
|
|
21
|
+
"@spyglassmc/json": "0.3.3",
|
|
22
|
+
"@spyglassmc/locales": "0.3.2",
|
|
23
|
+
"@spyglassmc/mcfunction": "0.2.4",
|
|
24
|
+
"@spyglassmc/mcdoc": "0.3.3",
|
|
25
|
+
"@spyglassmc/nbt": "0.3.3"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"fast-glob": "^3.2.5",
|