@spyglassmc/java-edition 0.1.1 → 0.2.0

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