@spyglassmc/java-edition 0.1.1 → 0.1.2

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 (46) hide show
  1. package/lib/binder/index.d.ts +2 -2
  2. package/lib/binder/index.js +2 -2
  3. package/lib/common/index.js +5 -1
  4. package/lib/dependency/common.d.ts +8 -5
  5. package/lib/dependency/common.js +15 -12
  6. package/lib/dependency/index.d.ts +1 -1
  7. package/lib/dependency/index.js +11 -7
  8. package/lib/dependency/mcmeta.d.ts +1 -2
  9. package/lib/dependency/mcmeta.js +27 -70
  10. package/lib/index.js +14 -10
  11. package/lib/json/checker/data/common.d.ts +1 -1
  12. package/lib/json/checker/data/tag.js +1 -1
  13. package/lib/json/checker/util/block_states.js +5 -1
  14. package/lib/json/checker/util/index.js +5 -1
  15. package/lib/json/checker/util/nbt.d.ts +1 -2
  16. package/lib/json/checker/util/version.d.ts +12 -12
  17. package/lib/json/checker/util/version.js +1 -1
  18. package/lib/json/index.js +5 -1
  19. package/lib/mcfunction/checker/index.js +60 -55
  20. package/lib/mcfunction/colorizer/index.js +5 -1
  21. package/lib/mcfunction/common/index.js +5 -1
  22. package/lib/mcfunction/completer/argument.js +10 -6
  23. package/lib/mcfunction/completer/index.js +5 -1
  24. package/lib/mcfunction/index.d.ts +2 -2
  25. package/lib/mcfunction/index.js +12 -20
  26. package/lib/mcfunction/inlayHintProvider.js +5 -1
  27. package/lib/mcfunction/node/argument.js +15 -11
  28. package/lib/mcfunction/node/index.js +5 -1
  29. package/lib/mcfunction/parser/argument.js +11 -7
  30. package/lib/mcfunction/parser/index.js +5 -1
  31. package/lib/mcfunction/signatureHelpProvider.js +5 -1
  32. package/lib/mcfunction/tree/index.d.ts +0 -5
  33. package/lib/mcfunction/tree/index.js +5 -6
  34. package/lib/mcfunction/tree/patch.d.ts +4 -0
  35. package/lib/mcfunction/tree/patch.js +752 -0
  36. package/package.json +7 -7
  37. package/lib/mcfunction/tree/1.15.d.ts +0 -9
  38. package/lib/mcfunction/tree/1.15.js +0 -542
  39. package/lib/mcfunction/tree/1.16.d.ts +0 -10
  40. package/lib/mcfunction/tree/1.16.js +0 -77
  41. package/lib/mcfunction/tree/1.17.d.ts +0 -12
  42. package/lib/mcfunction/tree/1.17.js +0 -166
  43. package/lib/mcfunction/tree/1.18.d.ts +0 -26
  44. package/lib/mcfunction/tree/1.18.js +0 -6
  45. package/lib/mcfunction/tree/1.19.d.ts +0 -26
  46. package/lib/mcfunction/tree/1.19.js +0 -6
@@ -0,0 +1,752 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getPatch = void 0;
4
+ const dependency_1 = require("../../dependency");
5
+ function getPatch(release) {
6
+ return {
7
+ children: {
8
+ advancement: {
9
+ children: {
10
+ grant: AdvancementTargets,
11
+ revoke: AdvancementTargets,
12
+ },
13
+ },
14
+ ...dependency_1.ReleaseVersion.cmp(release, '1.16') >= 0 ? {
15
+ attribute: {
16
+ children: {
17
+ target: {
18
+ children: {
19
+ attribute: {
20
+ properties: {
21
+ category: 'attribute',
22
+ },
23
+ children: {
24
+ modifier: {
25
+ children: {
26
+ add: {
27
+ children: {
28
+ uuid: {
29
+ properties: {
30
+ category: 'attribute_modifier_uuid',
31
+ usageType: 'definition',
32
+ },
33
+ },
34
+ },
35
+ },
36
+ remove: {
37
+ children: {
38
+ uuid: {
39
+ properties: {
40
+ category: 'attribute_modifier_uuid',
41
+ },
42
+ },
43
+ },
44
+ },
45
+ value: {
46
+ children: {
47
+ get: {
48
+ children: {
49
+ uuid: {
50
+ properties: {
51
+ category: 'attribute_modifier_uuid',
52
+ },
53
+ },
54
+ },
55
+ },
56
+ },
57
+ },
58
+ },
59
+ },
60
+ },
61
+ },
62
+ },
63
+ },
64
+ },
65
+ },
66
+ } : {},
67
+ ban: {
68
+ permission: 3,
69
+ },
70
+ 'ban-ip': {
71
+ permission: 3,
72
+ },
73
+ banlist: {
74
+ permission: 3,
75
+ },
76
+ bossbar: {
77
+ children: {
78
+ add: {
79
+ children: {
80
+ id: {
81
+ properties: {
82
+ category: 'bossbar',
83
+ usageType: 'definition',
84
+ },
85
+ },
86
+ },
87
+ },
88
+ get: {
89
+ children: {
90
+ id: {
91
+ properties: {
92
+ category: 'bossbar',
93
+ },
94
+ },
95
+ },
96
+ },
97
+ remove: {
98
+ children: {
99
+ id: {
100
+ properties: {
101
+ category: 'bossbar',
102
+ },
103
+ },
104
+ },
105
+ },
106
+ set: {
107
+ children: {
108
+ id: {
109
+ properties: {
110
+ category: 'bossbar',
111
+ accessType: 1 /* SymbolAccessType.Write */,
112
+ },
113
+ },
114
+ },
115
+ },
116
+ },
117
+ },
118
+ data: {
119
+ children: {
120
+ get: DataSource,
121
+ merge: DataTarget,
122
+ modify: {
123
+ children: {
124
+ block: {
125
+ children: {
126
+ targetPos: {
127
+ children: {
128
+ targetPath: DataModifyOperation,
129
+ },
130
+ },
131
+ },
132
+ },
133
+ entity: {
134
+ children: {
135
+ target: {
136
+ children: {
137
+ targetPath: DataModifyOperation,
138
+ },
139
+ },
140
+ },
141
+ },
142
+ storage: {
143
+ children: {
144
+ target: {
145
+ properties: {
146
+ category: 'storage',
147
+ accessType: 1 /* SymbolAccessType.Write */,
148
+ },
149
+ children: {
150
+ targetPath: DataModifyOperation,
151
+ },
152
+ },
153
+ },
154
+ },
155
+ },
156
+ },
157
+ remove: DataSource,
158
+ },
159
+ },
160
+ debug: {
161
+ permission: 3,
162
+ },
163
+ deop: {
164
+ permission: 3,
165
+ },
166
+ execute: {
167
+ children: {
168
+ if: ExecuteCondition,
169
+ store: {
170
+ children: {
171
+ result: ExecuteStoreTarget,
172
+ success: ExecuteStoreTarget,
173
+ },
174
+ },
175
+ unless: ExecuteCondition,
176
+ },
177
+ },
178
+ ...dependency_1.ReleaseVersion.cmp(release, '1.17') >= 0 ? {
179
+ item: {
180
+ children: {
181
+ replace: {
182
+ children: {
183
+ block: {
184
+ children: {
185
+ pos: {
186
+ children: {
187
+ slot: {
188
+ children: {
189
+ from: {
190
+ children: {
191
+ block: {
192
+ children: {
193
+ source: {
194
+ children: {
195
+ sourceSlot: {
196
+ children: {
197
+ modifier: {
198
+ properties: {
199
+ category: 'item_modifier',
200
+ },
201
+ },
202
+ },
203
+ },
204
+ },
205
+ },
206
+ },
207
+ },
208
+ entity: {
209
+ children: {
210
+ source: {
211
+ children: {
212
+ sourceSlot: {
213
+ children: {
214
+ modifier: {
215
+ properties: {
216
+ category: 'item_modifier',
217
+ },
218
+ },
219
+ },
220
+ },
221
+ },
222
+ },
223
+ },
224
+ },
225
+ },
226
+ },
227
+ },
228
+ },
229
+ },
230
+ },
231
+ },
232
+ },
233
+ entity: {
234
+ children: {
235
+ targets: {
236
+ children: {
237
+ slot: {
238
+ children: {
239
+ from: {
240
+ children: {
241
+ block: {
242
+ children: {
243
+ source: {
244
+ children: {
245
+ sourceSlot: {
246
+ children: {
247
+ modifier: {
248
+ properties: {
249
+ category: 'item_modifier',
250
+ },
251
+ },
252
+ },
253
+ },
254
+ },
255
+ },
256
+ },
257
+ },
258
+ entity: {
259
+ children: {
260
+ source: {
261
+ children: {
262
+ sourceSlot: {
263
+ children: {
264
+ modifier: {
265
+ properties: {
266
+ category: 'item_modifier',
267
+ },
268
+ },
269
+ },
270
+ },
271
+ },
272
+ },
273
+ },
274
+ },
275
+ },
276
+ },
277
+ },
278
+ },
279
+ },
280
+ },
281
+ },
282
+ },
283
+ },
284
+ },
285
+ modify: {
286
+ children: {
287
+ block: {
288
+ children: {
289
+ pos: {
290
+ children: {
291
+ slot: {
292
+ children: {
293
+ modifier: {
294
+ properties: {
295
+ category: 'item_modifier',
296
+ },
297
+ },
298
+ },
299
+ },
300
+ },
301
+ },
302
+ },
303
+ },
304
+ entity: {
305
+ children: {
306
+ targets: {
307
+ children: {
308
+ slot: {
309
+ children: {
310
+ modifier: {
311
+ properties: {
312
+ category: 'item_modifier',
313
+ },
314
+ },
315
+ },
316
+ },
317
+ },
318
+ },
319
+ },
320
+ },
321
+ },
322
+ },
323
+ },
324
+ },
325
+ } : {},
326
+ help: {
327
+ permission: 0,
328
+ },
329
+ kick: {
330
+ permission: 3,
331
+ },
332
+ list: {
333
+ permission: 0,
334
+ },
335
+ ...dependency_1.ReleaseVersion.cmp(release, '1.16') >= 0 ? {
336
+ locatebiome: {
337
+ children: {
338
+ biome: {
339
+ properties: {
340
+ category: 'worldgen/biome',
341
+ },
342
+ },
343
+ },
344
+ },
345
+ } : {},
346
+ loot: {
347
+ children: {
348
+ give: {
349
+ children: {
350
+ players: LootSource,
351
+ },
352
+ },
353
+ insert: {
354
+ children: {
355
+ targetPos: LootSource,
356
+ },
357
+ },
358
+ replace: {
359
+ children: {
360
+ block: {
361
+ children: {
362
+ targetPos: {
363
+ children: {
364
+ slot: {
365
+ children: {
366
+ ...LootSource.children,
367
+ count: LootSource,
368
+ },
369
+ },
370
+ },
371
+ },
372
+ },
373
+ },
374
+ entity: {
375
+ children: {
376
+ entities: {
377
+ children: {
378
+ slot: {
379
+ children: {
380
+ ...LootSource.children,
381
+ count: LootSource,
382
+ },
383
+ },
384
+ },
385
+ },
386
+ },
387
+ },
388
+ },
389
+ },
390
+ spawn: {
391
+ children: {
392
+ targetPos: LootSource,
393
+ },
394
+ },
395
+ },
396
+ },
397
+ me: {
398
+ permission: 0,
399
+ },
400
+ msg: {
401
+ permission: 0,
402
+ },
403
+ op: {
404
+ permission: 3,
405
+ },
406
+ pardon: {
407
+ permission: 3,
408
+ },
409
+ 'pardon-ip': {
410
+ permission: 3,
411
+ },
412
+ playsound: Sound,
413
+ publish: {
414
+ permission: 4,
415
+ },
416
+ recipe: {
417
+ children: {
418
+ give: RecipeTargets,
419
+ take: RecipeTargets,
420
+ },
421
+ },
422
+ 'save-all': {
423
+ permission: 4,
424
+ },
425
+ 'save-off': {
426
+ permission: 4,
427
+ },
428
+ 'save-on': {
429
+ permission: 4,
430
+ },
431
+ scoreboard: {
432
+ children: {
433
+ objectives: {
434
+ children: {
435
+ add: {
436
+ children: {
437
+ objective: {
438
+ parser: 'minecraft:objective',
439
+ properties: {
440
+ usageType: 'definition',
441
+ },
442
+ },
443
+ },
444
+ },
445
+ },
446
+ },
447
+ players: {
448
+ children: {
449
+ add: ObjectiveWriteTargets,
450
+ operation: ObjectiveWriteTargets,
451
+ remove: ObjectiveWriteTargets,
452
+ reset: ObjectiveWriteTargets,
453
+ set: ObjectiveWriteTargets,
454
+ },
455
+ },
456
+ },
457
+ },
458
+ setidletimeout: {
459
+ permission: 3,
460
+ },
461
+ stop: {
462
+ permission: 4,
463
+ },
464
+ stopsound: {
465
+ children: {
466
+ targets: {
467
+ children: {
468
+ '*': Sound,
469
+ ambient: Sound,
470
+ block: Sound,
471
+ hostile: Sound,
472
+ master: Sound,
473
+ music: Sound,
474
+ neutral: Sound,
475
+ player: Sound,
476
+ record: Sound,
477
+ voice: Sound,
478
+ weather: Sound,
479
+ },
480
+ },
481
+ },
482
+ },
483
+ tag: {
484
+ children: {
485
+ targets: {
486
+ children: {
487
+ add: {
488
+ children: {
489
+ name: {
490
+ parser: 'spyglassmc:tag',
491
+ },
492
+ },
493
+ },
494
+ remove: {
495
+ children: {
496
+ name: {
497
+ parser: 'spyglassmc:tag',
498
+ },
499
+ },
500
+ },
501
+ },
502
+ },
503
+ },
504
+ },
505
+ team: {
506
+ children: {
507
+ add: {
508
+ children: {
509
+ team: {
510
+ parser: 'minecraft:team',
511
+ properties: {
512
+ usageType: 'definition',
513
+ },
514
+ },
515
+ },
516
+ },
517
+ },
518
+ },
519
+ teammsg: {
520
+ permission: 0,
521
+ },
522
+ /**
523
+ * Original command syntax:
524
+ * 1. `teleport <destination: entity(single)>`
525
+ * 2. `teleport <location: vec3>`
526
+ * 3. `teleport <targets: entity(multiple)> <...arguments>`
527
+ *
528
+ * It is impossible for Spyglass to differentiate between (1) and (3) when it encouters a single entity
529
+ * at the position of the first argument, due to its lack of ability to backtrack.
530
+ *
531
+ * Therefore, we have compromised to patch the trees to something like this:
532
+ * - `teleport <location: vec3>`
533
+ * - `teleport <targets: entity(multiple)> [<...arguments>]`
534
+ *
535
+ * Diff:
536
+ * - Removed (1) `teleport <destination: entity(single)>`.
537
+ * - Marked `<...arguments>` in (3) as optional.
538
+ *
539
+ * The downside of this patch is that entity selectors tracking multiple entities can now be used as the
540
+ * `<destination>` argument. We will see how this work.
541
+ */
542
+ teleport: {
543
+ children: {
544
+ destination: undefined,
545
+ targets: {
546
+ executable: true,
547
+ },
548
+ },
549
+ },
550
+ tell: {
551
+ permission: 0,
552
+ },
553
+ tm: {
554
+ permission: 0,
555
+ },
556
+ trigger: {
557
+ permission: 0,
558
+ children: {
559
+ objective: {
560
+ properties: {
561
+ category: 'objective',
562
+ accessType: 1 /* SymbolAccessType.Write */,
563
+ },
564
+ },
565
+ },
566
+ },
567
+ w: {
568
+ permission: 0,
569
+ },
570
+ whitelist: {
571
+ permission: 3,
572
+ },
573
+ },
574
+ };
575
+ }
576
+ exports.getPatch = getPatch;
577
+ const AdvancementTargets = Object.freeze({
578
+ children: {
579
+ targets: {
580
+ children: {
581
+ from: {
582
+ children: {
583
+ advancement: {
584
+ properties: {
585
+ category: 'advancement',
586
+ },
587
+ },
588
+ },
589
+ },
590
+ only: {
591
+ children: {
592
+ advancement: {
593
+ properties: {
594
+ category: 'advancement',
595
+ },
596
+ },
597
+ },
598
+ },
599
+ through: {
600
+ children: {
601
+ advancement: {
602
+ properties: {
603
+ category: 'advancement',
604
+ },
605
+ },
606
+ },
607
+ },
608
+ until: {
609
+ children: {
610
+ advancement: {
611
+ properties: {
612
+ category: 'advancement',
613
+ },
614
+ },
615
+ },
616
+ },
617
+ },
618
+ },
619
+ },
620
+ });
621
+ const DataSource = Object.freeze({
622
+ children: {
623
+ storage: {
624
+ children: {
625
+ source: {
626
+ properties: {
627
+ category: 'storage',
628
+ },
629
+ },
630
+ },
631
+ },
632
+ },
633
+ });
634
+ const DataTarget = Object.freeze({
635
+ children: {
636
+ storage: {
637
+ children: {
638
+ target: {
639
+ properties: {
640
+ category: 'storage',
641
+ accessType: 1 /* SymbolAccessType.Write */,
642
+ },
643
+ },
644
+ },
645
+ },
646
+ },
647
+ });
648
+ const DataModifySource = Object.freeze({
649
+ children: {
650
+ from: DataSource,
651
+ },
652
+ });
653
+ const DataModifyOperation = Object.freeze({
654
+ children: {
655
+ append: DataModifySource,
656
+ insert: {
657
+ children: {
658
+ index: DataModifySource,
659
+ },
660
+ },
661
+ merge: DataModifySource,
662
+ prepend: DataModifySource,
663
+ set: DataModifySource,
664
+ },
665
+ });
666
+ const ExecuteCondition = Object.freeze({
667
+ children: {
668
+ data: DataSource,
669
+ predicate: {
670
+ children: {
671
+ predicate: {
672
+ properties: {
673
+ category: 'predicate',
674
+ },
675
+ },
676
+ },
677
+ },
678
+ },
679
+ });
680
+ const ExecuteStoreTarget = Object.freeze({
681
+ children: {
682
+ ...DataTarget.children,
683
+ bossbar: {
684
+ children: {
685
+ id: {
686
+ properties: {
687
+ category: 'bossbar',
688
+ accessType: 1 /* SymbolAccessType.Write */,
689
+ },
690
+ },
691
+ },
692
+ },
693
+ },
694
+ });
695
+ const LootSource = Object.freeze({
696
+ children: {
697
+ fish: {
698
+ children: {
699
+ loot_table: {
700
+ properties: {
701
+ category: 'loot_table',
702
+ },
703
+ },
704
+ },
705
+ },
706
+ loot: {
707
+ children: {
708
+ loot_table: {
709
+ properties: {
710
+ category: 'loot_table',
711
+ },
712
+ },
713
+ },
714
+ },
715
+ },
716
+ });
717
+ const ObjectiveWriteTargets = Object.freeze({
718
+ children: {
719
+ targets: {
720
+ children: {
721
+ objective: {
722
+ properties: {
723
+ accessType: 1 /* SymbolAccessType.Write */,
724
+ },
725
+ },
726
+ },
727
+ },
728
+ },
729
+ });
730
+ const RecipeTargets = Object.freeze({
731
+ children: {
732
+ targets: {
733
+ children: {
734
+ recipe: {
735
+ properties: {
736
+ category: 'recipe',
737
+ },
738
+ },
739
+ },
740
+ },
741
+ },
742
+ });
743
+ const Sound = Object.freeze({
744
+ children: {
745
+ sound: {
746
+ properties: {
747
+ category: 'sound_event',
748
+ },
749
+ },
750
+ },
751
+ });
752
+ //# sourceMappingURL=patch.js.map