@spyglassmc/java-edition 0.2.0 → 0.3.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.
@@ -13,7 +13,8 @@ export function getTagValues(category, id, ctx) {
13
13
  ? node.value
14
14
  : node.children.find(n => n.key?.value === 'id').value.value;
15
15
  const set = getUris(category, id, ctx).reduce((ans, uri) => {
16
- const result = ctx.getDocAndNode(uri);
16
+ // const result = ctx.getDocAndNode(uri)
17
+ const result = undefined; // FIXME: Use global symbol table to get the result
17
18
  if (!result || result.node.parserErrors.length || result.node.checkerErrors?.length) {
18
19
  return ans;
19
20
  }
@@ -415,8 +415,8 @@ export const advancement = as('advancement', record({
415
415
  })),
416
416
  parent: opt(resource('advancement')),
417
417
  criteria: object(string(undefined, undefined, (node, ctx) => {
418
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
419
- if (!ctx.ensureChecked) {
418
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
419
+ if (!ctx.ensureBindingStarted) {
420
420
  return;
421
421
  }
422
422
  const parts = dissectUri(ctx.doc.uri, ctx);
@@ -429,8 +429,8 @@ export const advancement = as('advancement', record({
429
429
  });
430
430
  }), () => criterion),
431
431
  requirements: opt(listOf(listOf((node, ctx) => {
432
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
433
- if (!ctx.ensureChecked) {
432
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
433
+ if (!ctx.ensureBindingStarted) {
434
434
  return;
435
435
  }
436
436
  const parts = dissectUri(ctx.doc.uri, ctx);
@@ -87,8 +87,8 @@ const block_state_provider = as('block_state_provider', dispatch('type', (type,
87
87
  states: listOf(block_state),
88
88
  },
89
89
  randomized_int_state_provider: {
90
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
91
- property: (ctx.ensureChecked) ? literal(blockProviderProperties(props.find(p => p.key?.value === 'source')?.value, ctx)) : simpleString,
90
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
91
+ property: (ctx.ensureBindingStarted) ? literal(blockProviderProperties(props.find(p => p.key?.value === 'source')?.value, ctx)) : simpleString,
92
92
  values: intProvider(),
93
93
  source: block_state_provider,
94
94
  },
@@ -1,7 +1,7 @@
1
- export declare const block_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
2
- export declare const entity_type_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
3
- export declare const fluid_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
4
- export declare const function_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
5
- export declare const game_event_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
6
- export declare const item_tag: import("@spyglassmc/json/lib/checker").JsonChecker;
1
+ export declare const block_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
2
+ export declare const entity_type_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
3
+ export declare const fluid_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
4
+ export declare const function_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
5
+ export declare const game_event_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
6
+ export declare const item_tag: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
7
7
  //# sourceMappingURL=tag.d.ts.map
@@ -1,8 +1,8 @@
1
1
  import { literal, simpleString } from '@spyglassmc/json/lib/checker/index.js';
2
2
  export function criterionReference(advancement) {
3
3
  return (node, ctx) => {
4
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
5
- if (!ctx.ensureChecked) {
4
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
5
+ if (!ctx.ensureBindingStarted) {
6
6
  simpleString(node, ctx);
7
7
  return;
8
8
  }
@@ -9,8 +9,8 @@ export function blockStateMap({ category, id, ids, tag, mixedTypes, requireAll }
9
9
  else if (id) {
10
10
  ids = [id];
11
11
  }
12
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
13
- if (!ids?.length || !ctx.ensureChecked) {
12
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
13
+ if (!ids?.length || !ctx.ensureBindingStarted) {
14
14
  const values = mixedTypes ? any([boolean, simpleString, intBounds()]) : simpleString;
15
15
  object(simpleString, () => requireAll ? values : opt(values))(node, ctx);
16
16
  return;
@@ -40,8 +40,8 @@ export function blockStateList({ category, id, ids, tag }) {
40
40
  else if (id) {
41
41
  ids = [id];
42
42
  }
43
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
44
- if (!ids?.length || !ctx.ensureChecked) {
43
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
44
+ if (!ids?.length || !ctx.ensureBindingStarted) {
45
45
  listOf(simpleString)(node, ctx);
46
46
  return;
47
47
  }
@@ -27,18 +27,18 @@ export function stringColor() {
27
27
  return Color.fromCompositeInt(value);
28
28
  };
29
29
  return (node, ctx) => {
30
- ctx.ops.set(node, 'expectation', [{ type: 'json:string', typedoc: 'String("Color")', pool: Color.ColorNames }]);
30
+ node.expectation = [{ type: 'json:string', typedoc: 'String("Color")', pool: Color.ColorNames }];
31
31
  if (!JsonStringNode.is(node)) {
32
32
  ctx.err.report(localize('expected', localize('string')), node);
33
33
  }
34
34
  else {
35
35
  const result = parseStringValue(parser, node.value, node.valueMap, ctx);
36
36
  if (result !== Failure) {
37
- ctx.ops.set(node, 'color', {
37
+ node.color = {
38
38
  value: result,
39
39
  format: [ColorFormat.HexRGB],
40
40
  range: { start: node.range.start + 1, end: node.range.end - 1 },
41
- });
41
+ };
42
42
  }
43
43
  }
44
44
  };
@@ -49,10 +49,10 @@ export function intColor() {
49
49
  ctx.err.report(localize('expected', localize('integer')), node);
50
50
  }
51
51
  else {
52
- ctx.ops.set(node, 'color', {
52
+ node.color = {
53
53
  value: Color.fromCompositeInt(node.value),
54
54
  format: [ColorFormat.CompositeInt],
55
- });
55
+ };
56
56
  }
57
57
  };
58
58
  }
@@ -15,8 +15,8 @@ function isDefinitionOptions(options) {
15
15
  }
16
16
  function definitionNbt({ definition }) {
17
17
  return (node, ctx) => {
18
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
19
- if (!ctx.ensureChecked) {
18
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
19
+ if (!ctx.ensureBindingStarted) {
20
20
  simpleString(node, ctx);
21
21
  return;
22
22
  }
@@ -28,8 +28,8 @@ function definitionNbt({ definition }) {
28
28
  function registryNbt(options) {
29
29
  return (node, ctx) => {
30
30
  const ids = getIds(options, ctx);
31
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
32
- if (!ctx.ensureChecked) {
31
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
32
+ if (!ctx.ensureBindingStarted) {
33
33
  simpleString(node, ctx);
34
34
  return;
35
35
  }
@@ -41,8 +41,8 @@ function registryNbt(options) {
41
41
  export function nbtPath(options) {
42
42
  return (node, ctx) => {
43
43
  const ids = getIds(options, ctx);
44
- // FIXME: Temporary solution to make tests pass when ensureChecked is not given.
45
- if (!ctx.ensureChecked) {
44
+ // FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
45
+ if (!ctx.ensureBindingStarted) {
46
46
  simpleString(node, ctx);
47
47
  return;
48
48
  }
@@ -1,2 +1,2 @@
1
- export declare const uuid: import("@spyglassmc/json/lib/checker/JsonChecker").JsonChecker;
1
+ export declare const uuid: import("@spyglassmc/json/lib/checker/JsonChecker.js").JsonChecker;
2
2
  //# sourceMappingURL=uuid.d.ts.map
@@ -180,6 +180,7 @@ const particle = (node, ctx) => {
180
180
  falling_dust: [BlockNode.mock(ctx.offset, false)],
181
181
  item: [ItemNode.mock(ctx.offset, false)],
182
182
  sculk_charge: [FloatNode.mock(ctx.offset)],
183
+ shriek: [IntegerNode.mock(ctx.offset)],
183
184
  vibration: [VectorNode.mock(ctx.offset, { dimension: 3 }), VectorNode.mock(ctx.offset, { dimension: 3 }), IntegerNode.mock(ctx.offset)],
184
185
  };
185
186
  if (ParticleNode.isSpecialType(id)) {
@@ -14,7 +14,7 @@ export interface BlockNode extends core.AstNode {
14
14
  nbt?: nbt.NbtCompoundNode;
15
15
  }
16
16
  export declare namespace BlockNode {
17
- function is(node: core.AstNode | undefined): node is BlockNode;
17
+ function is(node: core.DeepReadonly<core.AstNode> | undefined): node is BlockNode;
18
18
  function mock(range: core.RangeLike, isPredicate: boolean): BlockNode;
19
19
  }
20
20
  export declare const CoordinateNotations: readonly ["", "~", "^"];
@@ -78,7 +78,7 @@ export interface EntitySelectorNode extends core.AstNode {
78
78
  typeLimited?: boolean;
79
79
  }
80
80
  export declare namespace EntitySelectorNode {
81
- function is(node: core.AstNode | undefined): node is EntitySelectorNode;
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
83
  const ArgumentKeys: Set<"predicate" | "tag" | "team" | "type" | "level" | "advancements" | "nbt" | "name" | "scores" | "limit" | "x" | "y" | "z" | "distance" | "gamemode" | "sort" | "dx" | "dy" | "dz" | "x_rotation" | "y_rotation">;
84
84
  type ArgumentKey = typeof ArgumentKeys extends Set<infer T> ? T : undefined;
@@ -87,7 +87,7 @@ export declare namespace EntitySelectorNode {
87
87
  Duplicated = 1,
88
88
  NotApplicable = 2
89
89
  }
90
- function canKeyExist(selector: EntitySelectorNode, argument: EntitySelectorArgumentsNode, key: string): Result;
90
+ function canKeyExist(selector: core.DeepReadonly<EntitySelectorNode>, argument: core.DeepReadonly<EntitySelectorArgumentsNode>, key: string): Result;
91
91
  }
92
92
  export interface EntityNode extends core.AstNode {
93
93
  type: 'mcfunction:entity';
@@ -143,7 +143,7 @@ export interface ParticleNode extends core.AstNode {
143
143
  id: core.ResourceLocationNode;
144
144
  }
145
145
  export declare namespace ParticleNode {
146
- const SpecialTypes: Set<"block" | "item" | "block_marker" | "dust" | "dust_color_transition" | "falling_dust" | "sculk_charge" | "vibration">;
146
+ const SpecialTypes: Set<"block" | "item" | "block_marker" | "dust" | "dust_color_transition" | "falling_dust" | "sculk_charge" | "shriek" | "vibration">;
147
147
  export type SpecialType = typeof SpecialTypes extends Set<infer T> ? T : undefined;
148
148
  export function isSpecialType(type: string | undefined): type is SpecialType;
149
149
  export function is(node: core.AstNode | undefined): node is ParticleNode;
@@ -207,6 +207,7 @@ export var ParticleNode;
207
207
  'falling_dust',
208
208
  'item',
209
209
  'sculk_charge',
210
+ 'shriek',
210
211
  'vibration',
211
212
  ]);
212
213
  function isSpecialType(type) {
@@ -360,7 +360,8 @@ export const particle = (() => {
360
360
  falling_dust: blockState,
361
361
  item: itemStack,
362
362
  sculk_charge: float(),
363
- vibration: sequence([vec, vec, integer()], sep),
363
+ shriek: integer(),
364
+ vibration: sequence([vec, integer()], sep),
364
365
  };
365
366
  return core.map(sequence([
366
367
  core.resourceLocation({ category: 'particle_type' }),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spyglassmc/java-edition",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
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.2.0",
21
- "@spyglassmc/json": "0.2.0",
22
- "@spyglassmc/locales": "0.2.0",
23
- "@spyglassmc/mcfunction": "0.2.0",
24
- "@spyglassmc/mcdoc": "0.2.0",
25
- "@spyglassmc/nbt": "0.2.0"
20
+ "@spyglassmc/core": "0.3.0",
21
+ "@spyglassmc/json": "0.3.0",
22
+ "@spyglassmc/locales": "0.3.0",
23
+ "@spyglassmc/mcfunction": "0.2.1",
24
+ "@spyglassmc/mcdoc": "0.3.0",
25
+ "@spyglassmc/nbt": "0.3.0"
26
26
  },
27
27
  "devDependencies": {
28
28
  "fast-glob": "^3.2.5",