@spyglassmc/java-edition 0.3.23 → 0.3.25
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.
|
@@ -318,7 +318,7 @@ const scoreHolder = (node, ctx) => {
|
|
|
318
318
|
}
|
|
319
319
|
else {
|
|
320
320
|
ans = completer.symbol(node.fakeName ?? SymbolNode.mock(node, { category: 'score_holder' }), ctx);
|
|
321
|
-
ans.push(...selector(EntitySelectorNode.mock(node, { pool: EntitySelectorAtVariable.filterAvailable(ctx) }), ctx));
|
|
321
|
+
ans.push(...completer.literal(LiteralNode.mock(node, { pool: ['*'] }), ctx), ...selector(EntitySelectorNode.mock(node, { pool: EntitySelectorAtVariable.filterAvailable(ctx) }), ctx));
|
|
322
322
|
}
|
|
323
323
|
return ans;
|
|
324
324
|
};
|
|
@@ -71,7 +71,7 @@ export function registerMcdocAttributes(meta, rootTreeNode) {
|
|
|
71
71
|
}),
|
|
72
72
|
});
|
|
73
73
|
mcdoc.runtime.registerAttribute(meta, 'item_slots', () => undefined, {
|
|
74
|
-
stringParser: () =>
|
|
74
|
+
stringParser: (_, __, ctx) => core.literal({ pool: getItemSlotsArgumentValues(ctx) }),
|
|
75
75
|
stringMocker: (_, __, ctx) => core.LiteralNode.mock(ctx.offset, { pool: getItemSlotsArgumentValues(ctx) }),
|
|
76
76
|
});
|
|
77
77
|
mcdoc.runtime.registerAttribute(meta, 'uuid', () => undefined, {
|
|
@@ -11,7 +11,6 @@ export declare const argument: mcf.ArgumentParserGetter;
|
|
|
11
11
|
export declare const blockPredicate: core.InfallibleParser<BlockNode>;
|
|
12
12
|
export declare function criterion(advancement: core.FullResourceLocation, usageType?: core.SymbolUsageType, terminators?: string[]): core.InfallibleParser<core.SymbolNode>;
|
|
13
13
|
export declare function entity(amount: 'multiple' | 'single', type: 'entities' | 'players'): core.Parser<EntityNode>;
|
|
14
|
-
export declare const itemSlots: core.InfallibleParser<core.LiteralNode>;
|
|
15
14
|
export declare function jsonParser(typeRef: `::${string}::${string}`): core.Parser<json.TypedJsonNode>;
|
|
16
15
|
export declare const particle: core.InfallibleParser<ParticleNode>;
|
|
17
16
|
/**
|
|
@@ -78,7 +78,7 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
78
78
|
case 'minecraft:block_state':
|
|
79
79
|
return wrap(blockState);
|
|
80
80
|
case 'minecraft:color':
|
|
81
|
-
return wrap(core.map(
|
|
81
|
+
return wrap(core.map(commandLiteral({ pool: ColorArgumentValues }), (res) => ({
|
|
82
82
|
...res,
|
|
83
83
|
color: core.Color.NamedColors.has(res.value)
|
|
84
84
|
? core.Color.fromCompositeRGB(core.Color.NamedColors.get(res.value))
|
|
@@ -93,7 +93,7 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
93
93
|
case 'minecraft:entity':
|
|
94
94
|
return wrap(entity(treeNode.properties.amount, treeNode.properties.type));
|
|
95
95
|
case 'minecraft:entity_anchor':
|
|
96
|
-
return wrap(
|
|
96
|
+
return wrap(commandLiteral({ pool: EntityAnchorArgumentValues }));
|
|
97
97
|
case 'minecraft:entity_summon':
|
|
98
98
|
return wrap(core.resourceLocation({ category: 'entity_type' }));
|
|
99
99
|
case 'minecraft:float_range':
|
|
@@ -101,11 +101,11 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
101
101
|
case 'minecraft:function':
|
|
102
102
|
return wrap(core.resourceLocation({ category: 'function', allowTag: true }));
|
|
103
103
|
case 'minecraft:gamemode':
|
|
104
|
-
return wrap(
|
|
104
|
+
return wrap(commandLiteral({ pool: GamemodeArgumentValues }));
|
|
105
105
|
case 'minecraft:game_profile':
|
|
106
106
|
return wrap(entity('multiple', 'players'));
|
|
107
107
|
case 'minecraft:heightmap':
|
|
108
|
-
return wrap(
|
|
108
|
+
return wrap(commandLiteral({ pool: HeightmapValues }));
|
|
109
109
|
case 'minecraft:int_range':
|
|
110
110
|
return wrap(range('integer', treeNode.properties?.min, treeNode.properties?.max, treeNode.properties?.minSpan, treeNode.properties?.maxSpan));
|
|
111
111
|
case 'minecraft:item_enchantment':
|
|
@@ -113,9 +113,13 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
113
113
|
case 'minecraft:item_predicate':
|
|
114
114
|
return wrap(itemPredicate);
|
|
115
115
|
case 'minecraft:item_slot':
|
|
116
|
-
return wrap(
|
|
116
|
+
return wrap((src, ctx) => {
|
|
117
|
+
return commandLiteral({ pool: getItemSlotArgumentValues(ctx) })(src, ctx);
|
|
118
|
+
});
|
|
117
119
|
case 'minecraft:item_slots':
|
|
118
|
-
return wrap(
|
|
120
|
+
return wrap((src, ctx) => {
|
|
121
|
+
return commandLiteral({ pool: getItemSlotsArgumentValues(ctx) })(src, ctx);
|
|
122
|
+
});
|
|
119
123
|
case 'minecraft:item_stack':
|
|
120
124
|
return wrap(itemStack);
|
|
121
125
|
case 'minecraft:loot_modifier':
|
|
@@ -141,7 +145,7 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
141
145
|
case 'minecraft:objective_criteria':
|
|
142
146
|
return wrap(objectiveCriteria);
|
|
143
147
|
case 'minecraft:operation':
|
|
144
|
-
return wrap(
|
|
148
|
+
return wrap(commandLiteral({ pool: OperationArgumentValues, colorTokenType: 'operator' }));
|
|
145
149
|
case 'minecraft:particle':
|
|
146
150
|
return wrap(particle);
|
|
147
151
|
case 'minecraft:resource':
|
|
@@ -164,20 +168,20 @@ export const argument = (rawTreeNode, prevNodes) => {
|
|
|
164
168
|
// `BELOWNAME` and `sidebar.team.r--.+++e----__d` are also legal slots.
|
|
165
169
|
// But I do not want to spend time supporting them.
|
|
166
170
|
return wrap((src, ctx) => {
|
|
167
|
-
return
|
|
171
|
+
return commandLiteral({ pool: getScoreboardSlotArgumentValues(ctx) })(src, ctx);
|
|
168
172
|
});
|
|
169
173
|
case 'minecraft:style':
|
|
170
174
|
return wrap(jsonParser('::java::server::util::text::TextStyle'));
|
|
171
175
|
case 'minecraft:swizzle':
|
|
172
|
-
return wrap(
|
|
176
|
+
return wrap(commandLiteral({ pool: SwizzleArgumentValues }));
|
|
173
177
|
case 'minecraft:team':
|
|
174
178
|
return wrap(team(core.SymbolUsageType.is(treeNode.properties?.usageType)
|
|
175
179
|
? treeNode.properties?.usageType
|
|
176
180
|
: undefined));
|
|
177
181
|
case 'minecraft:template_mirror':
|
|
178
|
-
return wrap(
|
|
182
|
+
return wrap(commandLiteral({ pool: MirrorValues }));
|
|
179
183
|
case 'minecraft:template_rotation':
|
|
180
|
-
return wrap(
|
|
184
|
+
return wrap(commandLiteral({ pool: RotationValues }));
|
|
181
185
|
case 'minecraft:time':
|
|
182
186
|
return wrap(time);
|
|
183
187
|
case 'minecraft:uuid':
|
|
@@ -310,12 +314,6 @@ export function entity(amount, type) {
|
|
|
310
314
|
const greedyString = core.string({
|
|
311
315
|
unquotable: { blockList: new Set(['\n', '\r']) },
|
|
312
316
|
});
|
|
313
|
-
const itemSlot = (src, ctx) => {
|
|
314
|
-
return core.literal(...getItemSlotArgumentValues(ctx))(src, ctx);
|
|
315
|
-
};
|
|
316
|
-
export const itemSlots = (src, ctx) => {
|
|
317
|
-
return core.literal(...getItemSlotsArgumentValues(ctx))(src, ctx);
|
|
318
|
-
};
|
|
319
317
|
const itemStack = (src, ctx) => {
|
|
320
318
|
const oldFormat = shouldUseOldItemStackFormat(ctx);
|
|
321
319
|
return core.map(core.sequence([
|
|
@@ -368,6 +366,16 @@ export function jsonParser(typeRef) {
|
|
|
368
366
|
targetType: { kind: 'reference', path: typeRef },
|
|
369
367
|
}));
|
|
370
368
|
}
|
|
369
|
+
function commandLiteral(options) {
|
|
370
|
+
return (src, ctx) => {
|
|
371
|
+
const ans = core.literal(options)(src, ctx);
|
|
372
|
+
if (ans.value.length === 0) {
|
|
373
|
+
ans.value = src.readUntil(...core.Whitespaces);
|
|
374
|
+
ans.range = core.Range.create(ans.range.start, src);
|
|
375
|
+
}
|
|
376
|
+
return ans;
|
|
377
|
+
};
|
|
378
|
+
}
|
|
371
379
|
const message = (src, ctx) => {
|
|
372
380
|
const ans = {
|
|
373
381
|
type: 'mcfunction:message',
|
|
@@ -895,8 +903,11 @@ export function scoreHolderFakeName(usageType) {
|
|
|
895
903
|
}
|
|
896
904
|
export function scoreHolder(usageType, amount) {
|
|
897
905
|
return core.map(core.select([
|
|
898
|
-
|
|
899
|
-
|
|
906
|
+
{
|
|
907
|
+
predicate: (src) => src.peek() === '*'
|
|
908
|
+
&& (!src.canRead(2) || src.matchPattern(/^\s/, 1)),
|
|
909
|
+
parser: core.literal('*'),
|
|
910
|
+
},
|
|
900
911
|
{ prefix: '@', parser: selector() },
|
|
901
912
|
{ parser: scoreHolderFakeName(usageType) },
|
|
902
913
|
]), (res, _src, ctx) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spyglassmc/java-edition",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.25",
|
|
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.
|
|
20
|
+
"@spyglassmc/core": "0.4.19",
|
|
21
|
+
"@spyglassmc/json": "0.3.22",
|
|
22
22
|
"@spyglassmc/locales": "0.3.10",
|
|
23
|
-
"@spyglassmc/mcfunction": "0.2.
|
|
24
|
-
"@spyglassmc/mcdoc": "0.3.
|
|
25
|
-
"@spyglassmc/nbt": "0.3.
|
|
23
|
+
"@spyglassmc/mcfunction": "0.2.21",
|
|
24
|
+
"@spyglassmc/mcdoc": "0.3.23",
|
|
25
|
+
"@spyglassmc/nbt": "0.3.23"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"fast-glob": "^3.2.5"
|