@spyglassmc/java-edition 0.3.1 → 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.
Files changed (44) hide show
  1. package/lib/binder/index.d.ts +1 -1
  2. package/lib/binder/index.js +110 -19
  3. package/lib/common/index.js +10 -7
  4. package/lib/dependency/common.d.ts +1 -1
  5. package/lib/dependency/index.js +11 -9
  6. package/lib/dependency/mcmeta.d.ts +4 -4
  7. package/lib/dependency/mcmeta.js +32 -15
  8. package/lib/index.js +18 -6
  9. package/lib/json/checker/data/advancement.js +24 -13
  10. package/lib/json/checker/data/biome.js +3 -3
  11. package/lib/json/checker/data/common.js +29 -30
  12. package/lib/json/checker/data/dimension.js +7 -18
  13. package/lib/json/checker/data/feature.js +45 -27
  14. package/lib/json/checker/data/index.d.ts +1 -1
  15. package/lib/json/checker/data/index.js +3 -3
  16. package/lib/json/checker/data/loot_table.js +40 -21
  17. package/lib/json/checker/data/recipe.js +1 -1
  18. package/lib/json/checker/data/structure.js +24 -14
  19. package/lib/json/checker/data/tag.js +2 -2
  20. package/lib/json/checker/data/text_component.js +24 -8
  21. package/lib/json/checker/index.d.ts +10 -3
  22. package/lib/json/checker/index.js +231 -3
  23. package/lib/json/checker/util/advancement.js +3 -2
  24. package/lib/json/checker/util/block_states.d.ts +2 -2
  25. package/lib/json/checker/util/block_states.js +7 -5
  26. package/lib/json/checker/util/color.js +8 -2
  27. package/lib/json/checker/util/nbt.d.ts +1 -1
  28. package/lib/json/checker/util/nbt.js +4 -2
  29. package/lib/json/checker/util/recipe.js +7 -6
  30. package/lib/json/checker/util/version.d.ts +1 -1
  31. package/lib/json/checker/util/version.js +2 -2
  32. package/lib/mcfunction/checker/index.js +14 -11
  33. package/lib/mcfunction/colorizer/index.js +2 -4
  34. package/lib/mcfunction/common/index.js +46 -15
  35. package/lib/mcfunction/completer/argument.js +53 -24
  36. package/lib/mcfunction/index.js +13 -1
  37. package/lib/mcfunction/inlayHintProvider.js +8 -3
  38. package/lib/mcfunction/node/argument.d.ts +6 -6
  39. package/lib/mcfunction/node/argument.js +57 -17
  40. package/lib/mcfunction/parser/argument.js +158 -63
  41. package/lib/mcfunction/signatureHelpProvider.js +9 -4
  42. package/lib/mcfunction/tree/argument.d.ts +1 -1
  43. package/lib/mcfunction/tree/patch.js +132 -126
  44. package/package.json +7 -7
@@ -1,4 +1,4 @@
1
- import { any, as, dispatch, extract, float, floatRange, int, intRange, listOf, literal, opt, pick, record, ref, resource, simpleString } from '@spyglassmc/json/lib/checker/primitives/index.js';
1
+ import { any, as, dispatch, extract, float, floatRange, int, intRange, listOf, literal, opt, pick, record, ref, resource, simpleString, } from '@spyglassmc/json/lib/checker/primitives/index.js';
2
2
  import { blockStateMap } from '../util/index.js';
3
3
  function smallestEncompassingPowerOfTwo(n) {
4
4
  n = n - 1;
@@ -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 - 2 * (1 + Math.log2(smallestEncompassingPowerOfTwo(30000000))); // 12
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
@@ -17,10 +18,12 @@ export const number_provider = as('range', any([
17
18
  float,
18
19
  dispatch('type', (type) => record({
19
20
  type: opt(resource('loot_number_provider_type')),
20
- ...type === undefined ? {
21
- min: number_provider,
22
- max: number_provider,
23
- } : {},
21
+ ...(type === undefined
22
+ ? {
23
+ min: number_provider,
24
+ max: number_provider,
25
+ }
26
+ : {}),
24
27
  ...pick(type, {
25
28
  constant: {
26
29
  value: float,
@@ -47,7 +50,12 @@ export const score_provider = any([
47
50
  type: resource('loot_score_provider_type'),
48
51
  ...pick(type, {
49
52
  context: {
50
- target: literal(['this', 'killer', 'player_killer', 'direct_killer']),
53
+ target: literal([
54
+ 'this',
55
+ 'killer',
56
+ 'player_killer',
57
+ 'direct_killer',
58
+ ]),
51
59
  },
52
60
  fixed: {
53
61
  name: simpleString, // TODO: score holder, no selector
@@ -57,11 +65,16 @@ export const score_provider = any([
57
65
  ]);
58
66
  export const nbt_provider = any([
59
67
  literal(['this', 'killer', 'killer_player', 'block_entity']),
60
- dispatch('type', type => record({
68
+ dispatch('type', (type) => record({
61
69
  type: resource('loot_nbt_provider_type'),
62
70
  ...pick(type, {
63
71
  context: {
64
- target: literal(['this', 'killer', 'killer_player', 'block_entity']),
72
+ target: literal([
73
+ 'this',
74
+ 'killer',
75
+ 'killer_player',
76
+ 'block_entity',
77
+ ]),
65
78
  },
66
79
  storage: {
67
80
  source: resource('storage'),
@@ -95,14 +108,14 @@ export const float_bounds = as('bounds', any([
95
108
  }),
96
109
  ]),
97
110
  ]));
98
- export const block_state = as('block_state', dispatch(props => record({
111
+ export const block_state = as('block_state', dispatch((props) => record({
99
112
  Name: resource('block'),
100
113
  Properties: opt(blockStateMap({
101
114
  id: extract('Name', props),
102
115
  requireAll: true,
103
116
  })),
104
117
  })));
105
- export const fluid_state = as('fluid_state', dispatch(props => record({
118
+ export const fluid_state = as('fluid_state', dispatch((props) => record({
106
119
  Name: resource('fluid'),
107
120
  Properties: opt(blockStateMap({
108
121
  id: extract('Name', props),
@@ -123,7 +136,7 @@ export const vertical_anchor = as('vertical_anchor', any([
123
136
  ]));
124
137
  export const height_provider = as('height_provider', any([
125
138
  vertical_anchor,
126
- dispatch('type', type => record({
139
+ dispatch('type', (type) => record({
127
140
  type: resource('height_provider_type'),
128
141
  ...pick(type, {
129
142
  constant: {
@@ -159,7 +172,7 @@ export const height_provider = as('height_provider', any([
159
172
  ]));
160
173
  export const floatProvider = (min = undefined, max = undefined) => as('float_provider', any([
161
174
  floatRange(min, max),
162
- dispatch('type', type => record({
175
+ dispatch('type', (type) => record({
163
176
  type: resource('float_provider_type'),
164
177
  ...pick(type, {
165
178
  constant: {
@@ -191,7 +204,7 @@ export const floatProvider = (min = undefined, max = undefined) => as('float_pro
191
204
  ]));
192
205
  export const intProvider = (min = undefined, max = undefined) => as('int_provider', any([
193
206
  intRange(min, max),
194
- dispatch('type', type => record({
207
+ dispatch('type', (type) => record({
195
208
  type: resource('int_provider_type'),
196
209
  ...pick(type, {
197
210
  constant: {
@@ -260,20 +273,6 @@ export const HeightmapType = [
260
273
  'WORLD_SURFACE',
261
274
  'WORLD_SURFACE_WG',
262
275
  ];
263
- export const Slots = [
264
- 'mainhand',
265
- 'offhand',
266
- 'head',
267
- 'chest',
268
- 'legs',
269
- 'feet',
270
- ];
271
- export const Direction = [
272
- 'up',
273
- 'down',
274
- 'north',
275
- 'east',
276
- 'south',
277
- 'west',
278
- ];
276
+ export const Slots = ['mainhand', 'offhand', 'head', 'chest', 'legs', 'feet'];
277
+ export const Direction = ['up', 'down', 'north', 'east', 'south', 'west'];
279
278
  //# sourceMappingURL=common.js.map
@@ -1,7 +1,7 @@
1
- import { any, as, boolean, dispatch, float, floatRange, int, intRange, listOf, literal, object, opt, pick, record, ref, resource, simpleString } from '@spyglassmc/json/lib/checker/primitives/index.js';
1
+ import { any, as, boolean, dispatch, float, floatRange, int, intRange, listOf, literal, object, opt, pick, record, ref, resource, simpleString, } from '@spyglassmc/json/lib/checker/primitives/index.js';
2
2
  import { versioned } from '../util/index.js';
3
3
  import { block_state, noise_parameters, vertical_anchor } from './common.js';
4
- const material_condition = as('material_condition', dispatch('type', type => record({
4
+ const material_condition = as('material_condition', dispatch('type', (type) => record({
5
5
  type: resource('worldgen/material_condition'),
6
6
  ...pick(type, {
7
7
  biome: {
@@ -38,7 +38,7 @@ const material_condition = as('material_condition', dispatch('type', type => rec
38
38
  },
39
39
  }),
40
40
  })));
41
- const material_rule = as('material_rule', dispatch('type', type => record({
41
+ const material_rule = as('material_rule', dispatch('type', (type) => record({
42
42
  type: resource('worldgen/material_rule'),
43
43
  ...pick(type, {
44
44
  block: {
@@ -126,10 +126,7 @@ export const noise_settings = as('noise_settings', dispatch((_, ctx) => record({
126
126
  surface_rule: versioned(ctx, '1.18', material_rule),
127
127
  structures: structure_settings,
128
128
  })));
129
- const climate_parameter = any([
130
- floatRange(-2, 2),
131
- listOf(floatRange(-2, 2)),
132
- ]);
129
+ const climate_parameter = any([floatRange(-2, 2), listOf(floatRange(-2, 2))]);
133
130
  const biome_source = as('biome_source', dispatch('type', (type, _, ctx) => record({
134
131
  type: resource('worldgen/biome_source'),
135
132
  ...pick(type, {
@@ -142,12 +139,7 @@ const biome_source = as('biome_source', dispatch('type', (type, _, ctx) => recor
142
139
  },
143
140
  multi_noise: {
144
141
  seed: versioned(ctx, int, '1.18'),
145
- preset: opt(versioned(ctx, literal([
146
- 'nether',
147
- ]), '1.18', resource([
148
- 'minecraft:overworld',
149
- 'minecraft:nether',
150
- ]))),
142
+ preset: opt(versioned(ctx, literal(['nether']), '1.18', resource(['minecraft:overworld', 'minecraft:nether']))),
151
143
  ...versioned(ctx, {
152
144
  altitude_noise: noise_parameters,
153
145
  temperature_noise: noise_parameters,
@@ -202,11 +194,8 @@ export const dimension_type = as('dimension_type', dispatch((_, ctx) => record({
202
194
  has_ceiling: boolean,
203
195
  })));
204
196
  export const dimension = as('dimension', record({
205
- type: any([
206
- resource('dimension_type'),
207
- dimension_type,
208
- ]),
209
- generator: as('chunk_generator', dispatch('type', type => record({
197
+ type: any([resource('dimension_type'), dimension_type]),
198
+ generator: as('chunk_generator', dispatch('type', (type) => record({
210
199
  type: resource('worldgen/chunk_generator'),
211
200
  ...pick(type, {
212
201
  flat: {
@@ -1,10 +1,14 @@
1
1
  import { JsonArrayNode, JsonObjectNode } from '@spyglassmc/json';
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';
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, HeightmapType, height_provider, inclusiveRange, intProvider, noise_parameters, uniformInt, Y_SIZE } from './common.js';
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
- return [...new Set([].concat(...values).filter(e => values.every(a => a.includes(e))))];
7
+ return [
8
+ ...new Set([]
9
+ .concat(...values)
10
+ .filter((e) => values.every((a) => a.includes(e)))),
11
+ ];
8
12
  }
9
13
  function blockStateIntProperties(node, ctx) {
10
14
  if (node && JsonObjectNode.is(node)) {
@@ -15,14 +19,15 @@ function blockStateIntProperties(node, ctx) {
15
19
  }
16
20
  return Object.values(ctx.symbols.query(ctx.doc, 'block', block).symbol?.members ?? {})
17
21
  .filter((m) => m?.subcategory === 'state')
18
- .filter(m => Object.keys(m.members ?? {})[0]?.match(/^\d+$/))
19
- .map(m => m.identifier);
22
+ .filter((m) => Object.keys(m.members ?? {})[0]?.match(/^\d+$/))
23
+ .map((m) => m.identifier);
20
24
  }
21
25
  }
22
26
  else if (node && JsonArrayNode.is(node)) {
23
- const values = node.children.map(item => item.value)
24
- .filter(n => n)
25
- .map(n => blockStateIntProperties(n, ctx));
27
+ const values = node.children
28
+ .map((item) => item.value)
29
+ .filter((n) => n)
30
+ .map((n) => blockStateIntProperties(n, ctx));
26
31
  return intersection(...values);
27
32
  }
28
33
  return [];
@@ -33,27 +38,32 @@ function blockProviderProperties(node, ctx) {
33
38
  switch (extract('type', node.children)?.replace(/^minecraft:/, '')) {
34
39
  case 'dual_noise_provider':
35
40
  case 'noise_provider':
36
- const states = node.children.find(p => p.key?.value === 'states')?.value;
41
+ const states = node.children.find((p) => p.key?.value === 'states')
42
+ ?.value;
37
43
  return blockStateIntProperties(states, ctx);
38
44
  case 'noise_threshold':
39
- const lowStates = node.children.find(p => p.key?.value === 'low_states')?.value;
40
- const highStates = node.children.find(p => p.key?.value === 'high_states')?.value;
45
+ const lowStates = node.children.find((p) => p.key?.value === 'low_states')?.value;
46
+ const highStates = node.children.find((p) => p.key?.value === 'high_states')?.value;
41
47
  return intersection(blockStateIntProperties(lowStates, ctx), blockStateIntProperties(highStates, ctx));
42
48
  case 'randomized_int_state_provider':
43
- const source = node.children.find(p => p.key?.value === 'source')?.value;
49
+ const source = node.children.find((p) => p.key?.value === 'source')
50
+ ?.value;
44
51
  return blockProviderProperties(source, ctx);
45
52
  case 'rotated_block_provider':
46
53
  case 'simple_state_provider':
47
- const state = node.children.find(p => p.key?.value === 'state')?.value;
54
+ const state = node.children.find((p) => p.key?.value === 'state')
55
+ ?.value;
48
56
  return blockStateIntProperties(state, ctx);
49
57
  case 'weighted_state_provider':
50
- const entries = node.children.find(p => p.key?.value === 'entries')?.value;
58
+ const entries = node.children.find((p) => p.key?.value === 'entries')?.value;
51
59
  if (entries && JsonArrayNode.is(entries)) {
52
60
  const values = entries.children
53
- .map(n => n.value && JsonObjectNode.is(n.value) &&
54
- n.value.children.find(p => p.key?.value === 'data')?.value)
55
- .filter(n => n)
56
- .map(n => blockStateIntProperties(n, ctx));
61
+ .map((n) => n.value &&
62
+ JsonObjectNode.is(n.value) &&
63
+ n.value.children.find((p) => p.key?.value === 'data')
64
+ ?.value)
65
+ .filter((n) => n)
66
+ .map((n) => blockStateIntProperties(n, ctx));
57
67
  return intersection(...values);
58
68
  }
59
69
  }
@@ -88,7 +98,9 @@ const block_state_provider = as('block_state_provider', dispatch('type', (type,
88
98
  },
89
99
  randomized_int_state_provider: {
90
100
  // 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,
101
+ property: ctx.ensureBindingStarted
102
+ ? literal(blockProviderProperties(props.find((p) => p.key?.value === 'source')?.value, ctx))
103
+ : simpleString,
92
104
  values: intProvider(),
93
105
  source: block_state_provider,
94
106
  },
@@ -109,7 +121,7 @@ const block_state_provider = as('block_state_provider', dispatch('type', (type,
109
121
  const blockPredicateOffset = {
110
122
  offset: opt(listOf(intRange(-16, 16))),
111
123
  };
112
- const block_predicate_worldgen = as('block_predicate_worldgen', dispatch('type', type => record({
124
+ const block_predicate_worldgen = as('block_predicate_worldgen', dispatch('type', (type) => record({
113
125
  type: resource('block_predicate_type'),
114
126
  ...pick(type, {
115
127
  all_of: {
@@ -159,7 +171,7 @@ const block_placer = as('block_placer', dispatch('type', (type, _, ctx) => recor
159
171
  },
160
172
  }),
161
173
  })));
162
- const feature_size = as('feature_size', dispatch('type', type => record({
174
+ const feature_size = as('feature_size', dispatch('type', (type) => record({
163
175
  type: resource('worldgen/feature_size_type'),
164
176
  min_clipped_height: opt(intRange(0, 80)),
165
177
  ...pick(type, {
@@ -177,7 +189,7 @@ const feature_size = as('feature_size', dispatch('type', type => record({
177
189
  },
178
190
  }),
179
191
  })));
180
- const trunk_placer = as('trunk_placer', dispatch('type', type => record({
192
+ const trunk_placer = as('trunk_placer', dispatch('type', (type) => record({
181
193
  type: resource('worldgen/trunk_placer_type'),
182
194
  base_height: intRange(0, 32),
183
195
  height_rand_a: intRange(0, 24),
@@ -221,7 +233,7 @@ const foliage_placer = as('foliage_placer', dispatch('type', (type, _, ctx) => r
221
233
  },
222
234
  }),
223
235
  })));
224
- const tree_decorator = as('tree_decorator', dispatch('type', type => record({
236
+ const tree_decorator = as('tree_decorator', dispatch('type', (type) => record({
225
237
  type: resource('worldgen/tree_decorator_type'),
226
238
  ...pick(type, {
227
239
  alter_ground: {
@@ -374,7 +386,7 @@ export const configured_decorator = as('decorator', dispatch('type', (type, _, c
374
386
  },
375
387
  })),
376
388
  })));
377
- export const placement_modifier = as('placement_modifier', dispatch('type', type => record({
389
+ export const placement_modifier = as('placement_modifier', dispatch('type', (type) => record({
378
390
  type: resource('worldgen/placement_modifier_type'),
379
391
  ...pick(type, {
380
392
  block_predicate_filter: {
@@ -534,9 +546,15 @@ export const configured_feature = as('feature', dispatch('type', (type, _, ctx)
534
546
  use_potential_placements_chance: opt(floatRange(0, 1), 0.35),
535
547
  use_alternate_layer0_chance: opt(floatRange(0, 1), 0),
536
548
  placements_require_layer0_alternate: opt(boolean, true),
537
- outer_wall_distance: opt(intProvider(0, 10), { value: { min_inclusive: 0, max_inclusive: 10 } }),
538
- distribution_points: opt(intProvider(1, 20), { value: { min_inclusive: 3, max_inclusive: 4 } }),
539
- point_offset: opt(intProvider(0, 10), { value: { min_inclusive: 1, max_inclusive: 2 } }),
549
+ outer_wall_distance: opt(intProvider(0, 10), {
550
+ value: { min_inclusive: 0, max_inclusive: 10 },
551
+ }),
552
+ distribution_points: opt(intProvider(1, 20), {
553
+ value: { min_inclusive: 3, max_inclusive: 4 },
554
+ }),
555
+ point_offset: opt(intProvider(0, 10), {
556
+ value: { min_inclusive: 1, max_inclusive: 2 },
557
+ }),
540
558
  min_gen_offset: opt(int, -16),
541
559
  max_gen_offset: opt(int, 16),
542
560
  invalid_blocks_threshold: int,
@@ -1,4 +1,4 @@
1
1
  import type { JsonChecker } from '@spyglassmc/json/lib/checker/JsonChecker.js';
2
2
  export declare const pack_mcmeta: JsonChecker;
3
- export declare const Checkers: Map<"function" | "advancement" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/activity" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/chunk_status" | "tag/custom_stat" | "tag/enchantment" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/int_provider_type" | "tag/item" | "tag/loot_condition_type" | "tag/loot_function_type" | "tag/loot_nbt_provider_type" | "tag/loot_number_provider_type" | "tag/loot_pool_entry_type" | "tag/loot_score_provider_type" | "tag/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/particle_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/sound_event" | "tag/stat_type" | "tag/villager_profession" | "tag/villager_type" | "tag/worldgen/biome_source" | "tag/worldgen/block_placer_type" | "tag/worldgen/block_state_provider_type" | "tag/worldgen/carver" | "tag/worldgen/chunk_generator" | "tag/worldgen/decorator" | "tag/worldgen/feature" | "tag/worldgen/feature_size_type" | "tag/worldgen/foliage_placer_type" | "tag/worldgen/material_condition" | "tag/worldgen/material_rule" | "tag/worldgen/placement_modifier_type" | "tag/worldgen/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/template_pool", JsonChecker>;
3
+ export declare const Checkers: Map<"function" | "advancement" | "dimension" | "dimension_type" | "item_modifier" | "loot_table" | "predicate" | "recipe" | "structure" | "worldgen/biome" | "worldgen/configured_carver" | "worldgen/configured_feature" | "worldgen/configured_structure_feature" | "worldgen/configured_surface_builder" | "worldgen/density_function" | "worldgen/noise" | "worldgen/noise_settings" | "worldgen/placed_feature" | "worldgen/processor_list" | "worldgen/template_pool" | "tag/function" | "tag/activity" | "tag/attribute" | "tag/block" | "tag/block_entity_type" | "tag/block_predicate_type" | "tag/chunk_status" | "tag/custom_stat" | "tag/enchantment" | "tag/entity_type" | "tag/float_provider_type" | "tag/fluid" | "tag/game_event" | "tag/height_provider_type" | "tag/int_provider_type" | "tag/item" | "tag/loot_condition_type" | "tag/loot_function_type" | "tag/loot_nbt_provider_type" | "tag/loot_number_provider_type" | "tag/loot_pool_entry_type" | "tag/loot_score_provider_type" | "tag/memory_module_type" | "tag/menu" | "tag/mob_effect" | "tag/motive" | "tag/particle_type" | "tag/point_of_interest_type" | "tag/pos_rule_test" | "tag/position_source_type" | "tag/potion" | "tag/recipe_serializer" | "tag/recipe_type" | "tag/rule_test" | "tag/schedule" | "tag/sensor_type" | "tag/sound_event" | "tag/stat_type" | "tag/villager_profession" | "tag/villager_type" | "tag/worldgen/biome_source" | "tag/worldgen/block_placer_type" | "tag/worldgen/block_state_provider_type" | "tag/worldgen/carver" | "tag/worldgen/chunk_generator" | "tag/worldgen/decorator" | "tag/worldgen/feature" | "tag/worldgen/feature_size_type" | "tag/worldgen/foliage_placer_type" | "tag/worldgen/material_condition" | "tag/worldgen/material_rule" | "tag/worldgen/placement_modifier_type" | "tag/worldgen/structure_feature" | "tag/worldgen/structure_piece" | "tag/worldgen/structure_pool_element" | "tag/worldgen/structure_processor" | "tag/worldgen/surface_builder" | "tag/worldgen/tree_decorator_type" | "tag/worldgen/trunk_placer_type" | "tag/worldgen/biome" | "tag/worldgen/configured_carver" | "tag/worldgen/configured_feature" | "tag/worldgen/configured_structure_feature" | "tag/worldgen/configured_surface_builder" | "tag/worldgen/density_function" | "tag/worldgen/noise" | "tag/worldgen/noise_settings" | "tag/worldgen/placed_feature" | "tag/worldgen/processor_list" | "tag/worldgen/template_pool", JsonChecker>;
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1,12 +1,12 @@
1
1
  import { as, int, record } from '@spyglassmc/json/lib/checker/index.js';
2
2
  import { advancement } from './advancement.js';
3
- import { biome, configured_carver, configured_surface_builder } from './biome.js';
3
+ import { biome, configured_carver, configured_surface_builder, } from './biome.js';
4
4
  import { dimension, dimension_type, noise_settings } from './dimension.js';
5
5
  import { configured_feature } from './feature.js';
6
6
  import { item_modifier_list, loot_table, predicate_list } from './loot_table.js';
7
7
  import { recipe } from './recipe.js';
8
- import { configured_structure_feature, processor_list, template_pool } from './structure.js';
9
- import { block_tag, entity_type_tag, fluid_tag, function_tag, game_event_tag, item_tag } from './tag.js';
8
+ import { configured_structure_feature, processor_list, template_pool, } from './structure.js';
9
+ import { block_tag, entity_type_tag, fluid_tag, function_tag, game_event_tag, item_tag, } from './tag.js';
10
10
  import { text_component } from './text_component.js';
11
11
  export const pack_mcmeta = as('pack', record({
12
12
  pack: record({
@@ -1,6 +1,6 @@
1
- import { any, as, boolean, dispatch, extract, float, floatRange, int, intRange, listOf, literal, object, opt, pick, record, resource, simpleString } from '@spyglassmc/json/lib/checker/primitives/index.js';
2
- import { blockStateList, blockStateMap, nbt, nbtPath, uuid, versioned } from '../util/index.js';
3
- import { damage_source_predicate, entity_predicate, item_predicate, location_predicate } from './advancement.js';
1
+ import { any, as, boolean, dispatch, extract, float, floatRange, int, intRange, listOf, literal, object, opt, pick, record, resource, simpleString, } from '@spyglassmc/json/lib/checker/primitives/index.js';
2
+ import { blockStateList, blockStateMap, nbt, nbtPath, uuid, versioned, } from '../util/index.js';
3
+ import { damage_source_predicate, entity_predicate, item_predicate, location_predicate, } from './advancement.js';
4
4
  import { int_bounds, nbt_provider, number_provider, Slots } from './common.js';
5
5
  import { text_component } from './text_component.js';
6
6
  const loot_context_types = [
@@ -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(['this', 'killer', 'killer_player', 'direct_killer']),
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(['this', 'killer', 'killer_player', 'direct_killer']),
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: {
@@ -110,16 +120,17 @@ export const predicate = as('predicate', dispatch('condition', (condition, props
110
120
  },
111
121
  }),
112
122
  })));
113
- export const predicate_list = any([
114
- predicate,
115
- listOf(predicate),
116
- ]);
123
+ export const predicate_list = any([predicate, listOf(predicate)]);
117
124
  export const item_modifier = as('item_modifier', dispatch('function', (function_, props, ctx) => record({
118
125
  function: resource('loot_function_type'),
119
126
  ...pick(function_, {
120
127
  apply_bonus: {
121
128
  enchantment: resource('enchantment'),
122
- formula: resource(['binomial_with_bonus_count', 'ore_drops', 'uniform_bonus_count']),
129
+ formula: resource([
130
+ 'binomial_with_bonus_count',
131
+ 'ore_drops',
132
+ 'uniform_bonus_count',
133
+ ]),
123
134
  ...pick(extract('formula', props), {
124
135
  binomial_with_bonus_count: {
125
136
  parameters: record({
@@ -135,7 +146,12 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
135
146
  }),
136
147
  },
137
148
  copy_name: {
138
- source: literal(['this', 'killer', 'killer_player', 'block_entity']),
149
+ source: literal([
150
+ 'this',
151
+ 'killer',
152
+ 'killer_player',
153
+ 'block_entity',
154
+ ]),
139
155
  },
140
156
  copy_nbt: {
141
157
  source: nbt_provider,
@@ -164,7 +180,12 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
164
180
  skip_existing_chunks: opt(boolean, true),
165
181
  },
166
182
  fill_player_head: {
167
- entity: literal(['this', 'killer', 'killer_player', 'direct_killer']),
183
+ entity: literal([
184
+ 'this',
185
+ 'killer',
186
+ 'killer_player',
187
+ 'direct_killer',
188
+ ]),
168
189
  },
169
190
  limit_count: {
170
191
  limit: int_bounds,
@@ -177,13 +198,14 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
177
198
  modifiers: listOf(record({
178
199
  attribute: resource('attribute'),
179
200
  name: simpleString,
180
- operation: literal(['addition', 'multiply_base', 'multiply_total']),
201
+ operation: literal([
202
+ 'addition',
203
+ 'multiply_base',
204
+ 'multiply_total',
205
+ ]),
181
206
  id: opt(uuid),
182
207
  amount: number_provider,
183
- slot: any([
184
- literal(Slots),
185
- listOf(literal(Slots)),
186
- ]),
208
+ slot: any([literal(Slots), listOf(literal(Slots))]),
187
209
  })),
188
210
  },
189
211
  set_contents: {
@@ -226,10 +248,7 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
226
248
  }),
227
249
  conditions: opt(listOf(predicate)),
228
250
  })));
229
- export const item_modifier_list = any([
230
- item_modifier,
231
- listOf(item_modifier),
232
- ]);
251
+ export const item_modifier_list = any([item_modifier, listOf(item_modifier)]);
233
252
  export const loot_entry = as('loot_entry', dispatch('type', (type) => record({
234
253
  type: resource('loot_pool_entry_type'),
235
254
  weight: opt(intRange(1, undefined), 1),
@@ -1,4 +1,4 @@
1
- import { any, as, dispatch, float, int, intRange, listOf, object, opt, pick, record, resource, simpleString, when } from '@spyglassmc/json/lib/checker/primitives/index.js';
1
+ import { any, as, dispatch, float, int, intRange, listOf, object, opt, pick, record, resource, simpleString, when, } from '@spyglassmc/json/lib/checker/primitives/index.js';
2
2
  import { patternKeys, recipeGroup } from '../util/index.js';
3
3
  const one_recipe_ingredient = any([
4
4
  record({
@@ -1,8 +1,8 @@
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';
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, HeightmapType, height_provider } from './common.js';
3
+ import { block_state, height_provider, HeightmapType } from './common.js';
4
4
  import { configured_feature_ref, placed_feature_ref } from './feature.js';
5
- export const rule_test = as('rule_test', dispatch('predicate_type', type => record({
5
+ export const rule_test = as('rule_test', dispatch('predicate_type', (type) => record({
6
6
  predicate_type: resource('rule_test'),
7
7
  ...pick(type, {
8
8
  block_match: {
@@ -24,7 +24,7 @@ export const rule_test = as('rule_test', dispatch('predicate_type', type => reco
24
24
  },
25
25
  }),
26
26
  })));
27
- export const pos_rule_test = as('pos_rule_test', dispatch('predicate_type', type => record({
27
+ export const pos_rule_test = as('pos_rule_test', dispatch('predicate_type', (type) => record({
28
28
  predicate_type: resource('pos_rule_test'),
29
29
  ...pick(type, {
30
30
  axis_aligned_linear_pos: {
@@ -37,14 +37,19 @@ export const pos_rule_test = as('pos_rule_test', dispatch('predicate_type', type
37
37
  }),
38
38
  ...when(type, ['axis_aligned_linear_pos', 'linear_pos'], {}),
39
39
  })));
40
- const processor_rule = as('processor_rule', dispatch(props => record({
41
- position_predicate: opt(pos_rule_test, { predicate_type: 'always_true' }),
40
+ const processor_rule = as('processor_rule', dispatch((props) => record({
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,
45
- output_nbt: opt(nbt({ registry: 'block', id: extractNested('output_state', 'Name', props) })),
47
+ output_nbt: opt(nbt({
48
+ registry: 'block',
49
+ id: extractNested('output_state', 'Name', props),
50
+ })),
46
51
  })));
47
- const processor = as('processor', dispatch('processor_type', type => record({
52
+ const processor = as('processor', dispatch('processor_type', (type) => record({
48
53
  processor_type: resource('worldgen/structure_processor'),
49
54
  ...pick(type, {
50
55
  block_age: {
@@ -73,10 +78,7 @@ export const processor_list = as('processor_list', any([
73
78
  }),
74
79
  listOf(processor),
75
80
  ]));
76
- export const processor_list_ref = as('processor_list', any([
77
- resource('worldgen/processor_list'),
78
- processor_list,
79
- ]));
81
+ export const processor_list_ref = as('processor_list', any([resource('worldgen/processor_list'), processor_list]));
80
82
  const template_element = as('template_element', dispatch('element_type', (type, _, ctx) => record({
81
83
  element_type: resource('worldgen/structure_pool_element'),
82
84
  ...when(type, ['empty_pool_element'], {}, {
@@ -111,7 +113,7 @@ export const template_pool_ref = any([
111
113
  resource('worldgen/template_pool'),
112
114
  template_pool,
113
115
  ]);
114
- export const configured_structure_feature = as('structure_feature', dispatch('type', type => record({
116
+ export const configured_structure_feature = as('structure_feature', dispatch('type', (type) => record({
115
117
  type: resource('worldgen/structure_feature'),
116
118
  config: record({
117
119
  ...when(type, ['bastion_remnant', 'pillager_outpost', 'village'], {
@@ -134,7 +136,15 @@ export const configured_structure_feature = as('structure_feature', dispatch('ty
134
136
  cluster_probability: floatRange(0, 1),
135
137
  },
136
138
  ruined_portal: {
137
- portal_type: literal(['standard', 'desert', 'jungle', 'mountain', 'nether', 'ocean', 'swamp']),
139
+ portal_type: literal([
140
+ 'standard',
141
+ 'desert',
142
+ 'jungle',
143
+ 'mountain',
144
+ 'nether',
145
+ 'ocean',
146
+ 'swamp',
147
+ ]),
138
148
  },
139
149
  shipwreck: {
140
150
  is_beached: opt(boolean, false),
@@ -1,6 +1,6 @@
1
1
  import { ResourceLocation } from '@spyglassmc/core';
2
2
  import { JsonObjectNode, JsonStringNode } from '@spyglassmc/json';
3
- import { any, boolean, opt, record, resource, uniqueListOf } from '@spyglassmc/json/lib/checker/primitives/index.js';
3
+ import { any, boolean, opt, record, resource, uniqueListOf, } from '@spyglassmc/json/lib/checker/primitives/index.js';
4
4
  import { localize } from '@spyglassmc/locales';
5
5
  const tag = (type) => record({
6
6
  replace: opt(boolean, false),
@@ -16,7 +16,7 @@ const tag = (type) => record({
16
16
  return [ResourceLocation.shorten(node.value), node];
17
17
  }
18
18
  if (JsonObjectNode.is(node)) {
19
- const id = node.children.find(c => c.key?.value === 'id');
19
+ const id = node.children.find((c) => c.key?.value === 'id');
20
20
  if (id && id.value && JsonStringNode.is(id.value)) {
21
21
  return [ResourceLocation.shorten(id.value.value), id.value];
22
22
  }