@spyglassmc/java-edition 0.3.1 → 0.3.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.
- package/lib/binder/index.d.ts +1 -1
- package/lib/binder/index.js +94 -19
- package/lib/common/index.js +10 -7
- package/lib/dependency/index.js +11 -9
- package/lib/dependency/mcmeta.d.ts +1 -1
- package/lib/dependency/mcmeta.js +27 -13
- package/lib/index.js +15 -6
- package/lib/json/checker/data/advancement.js +24 -13
- package/lib/json/checker/data/biome.js +3 -3
- package/lib/json/checker/data/common.js +15 -27
- package/lib/json/checker/data/dimension.js +7 -18
- package/lib/json/checker/data/feature.js +41 -27
- package/lib/json/checker/data/index.d.ts +1 -1
- package/lib/json/checker/data/index.js +3 -3
- package/lib/json/checker/data/loot_table.js +16 -17
- package/lib/json/checker/data/recipe.js +1 -1
- package/lib/json/checker/data/structure.js +20 -12
- package/lib/json/checker/data/tag.js +2 -2
- package/lib/json/checker/data/text_component.js +21 -12
- package/lib/json/checker/index.d.ts +10 -3
- package/lib/json/checker/index.js +230 -3
- package/lib/json/checker/util/advancement.js +3 -3
- package/lib/json/checker/util/block_states.d.ts +2 -2
- package/lib/json/checker/util/block_states.js +7 -5
- package/lib/json/checker/util/color.js +8 -2
- package/lib/json/checker/util/nbt.js +3 -2
- package/lib/json/checker/util/recipe.js +7 -6
- package/lib/json/checker/util/version.js +2 -2
- package/lib/mcfunction/checker/index.js +10 -7
- package/lib/mcfunction/colorizer/index.js +2 -4
- package/lib/mcfunction/common/index.js +46 -15
- package/lib/mcfunction/completer/argument.js +53 -24
- package/lib/mcfunction/inlayHintProvider.js +8 -3
- package/lib/mcfunction/node/argument.d.ts +3 -3
- package/lib/mcfunction/node/argument.js +57 -17
- package/lib/mcfunction/parser/argument.js +124 -52
- package/lib/mcfunction/signatureHelpProvider.js +6 -3
- package/lib/mcfunction/tree/patch.js +132 -126
- package/package.json +7 -7
|
@@ -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
|
-
|
|
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, HeightmapType, height_provider, 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 [
|
|
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
|
|
24
|
-
.
|
|
25
|
-
.
|
|
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,28 @@ 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')?.value;
|
|
37
42
|
return blockStateIntProperties(states, ctx);
|
|
38
43
|
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;
|
|
44
|
+
const lowStates = node.children.find((p) => p.key?.value === 'low_states')?.value;
|
|
45
|
+
const highStates = node.children.find((p) => p.key?.value === 'high_states')?.value;
|
|
41
46
|
return intersection(blockStateIntProperties(lowStates, ctx), blockStateIntProperties(highStates, ctx));
|
|
42
47
|
case 'randomized_int_state_provider':
|
|
43
|
-
const source = node.children.find(p => p.key?.value === 'source')?.value;
|
|
48
|
+
const source = node.children.find((p) => p.key?.value === 'source')?.value;
|
|
44
49
|
return blockProviderProperties(source, ctx);
|
|
45
50
|
case 'rotated_block_provider':
|
|
46
51
|
case 'simple_state_provider':
|
|
47
|
-
const state = node.children.find(p => p.key?.value === 'state')?.value;
|
|
52
|
+
const state = node.children.find((p) => p.key?.value === 'state')?.value;
|
|
48
53
|
return blockStateIntProperties(state, ctx);
|
|
49
54
|
case 'weighted_state_provider':
|
|
50
|
-
const entries = node.children.find(p => p.key?.value === 'entries')?.value;
|
|
55
|
+
const entries = node.children.find((p) => p.key?.value === 'entries')?.value;
|
|
51
56
|
if (entries && JsonArrayNode.is(entries)) {
|
|
52
57
|
const values = entries.children
|
|
53
|
-
.map(n => n.value &&
|
|
54
|
-
|
|
55
|
-
.
|
|
56
|
-
.
|
|
58
|
+
.map((n) => n.value &&
|
|
59
|
+
JsonObjectNode.is(n.value) &&
|
|
60
|
+
n.value.children.find((p) => p.key?.value === 'data')?.value)
|
|
61
|
+
.filter((n) => n)
|
|
62
|
+
.map((n) => blockStateIntProperties(n, ctx));
|
|
57
63
|
return intersection(...values);
|
|
58
64
|
}
|
|
59
65
|
}
|
|
@@ -88,7 +94,9 @@ const block_state_provider = as('block_state_provider', dispatch('type', (type,
|
|
|
88
94
|
},
|
|
89
95
|
randomized_int_state_provider: {
|
|
90
96
|
// FIXME: Temporary solution to make tests pass when ensureBindingStarted is not given.
|
|
91
|
-
property:
|
|
97
|
+
property: ctx.ensureBindingStarted
|
|
98
|
+
? literal(blockProviderProperties(props.find((p) => p.key?.value === 'source')?.value, ctx))
|
|
99
|
+
: simpleString,
|
|
92
100
|
values: intProvider(),
|
|
93
101
|
source: block_state_provider,
|
|
94
102
|
},
|
|
@@ -109,7 +117,7 @@ const block_state_provider = as('block_state_provider', dispatch('type', (type,
|
|
|
109
117
|
const blockPredicateOffset = {
|
|
110
118
|
offset: opt(listOf(intRange(-16, 16))),
|
|
111
119
|
};
|
|
112
|
-
const block_predicate_worldgen = as('block_predicate_worldgen', dispatch('type', type => record({
|
|
120
|
+
const block_predicate_worldgen = as('block_predicate_worldgen', dispatch('type', (type) => record({
|
|
113
121
|
type: resource('block_predicate_type'),
|
|
114
122
|
...pick(type, {
|
|
115
123
|
all_of: {
|
|
@@ -159,7 +167,7 @@ const block_placer = as('block_placer', dispatch('type', (type, _, ctx) => recor
|
|
|
159
167
|
},
|
|
160
168
|
}),
|
|
161
169
|
})));
|
|
162
|
-
const feature_size = as('feature_size', dispatch('type', type => record({
|
|
170
|
+
const feature_size = as('feature_size', dispatch('type', (type) => record({
|
|
163
171
|
type: resource('worldgen/feature_size_type'),
|
|
164
172
|
min_clipped_height: opt(intRange(0, 80)),
|
|
165
173
|
...pick(type, {
|
|
@@ -177,7 +185,7 @@ const feature_size = as('feature_size', dispatch('type', type => record({
|
|
|
177
185
|
},
|
|
178
186
|
}),
|
|
179
187
|
})));
|
|
180
|
-
const trunk_placer = as('trunk_placer', dispatch('type', type => record({
|
|
188
|
+
const trunk_placer = as('trunk_placer', dispatch('type', (type) => record({
|
|
181
189
|
type: resource('worldgen/trunk_placer_type'),
|
|
182
190
|
base_height: intRange(0, 32),
|
|
183
191
|
height_rand_a: intRange(0, 24),
|
|
@@ -221,7 +229,7 @@ const foliage_placer = as('foliage_placer', dispatch('type', (type, _, ctx) => r
|
|
|
221
229
|
},
|
|
222
230
|
}),
|
|
223
231
|
})));
|
|
224
|
-
const tree_decorator = as('tree_decorator', dispatch('type', type => record({
|
|
232
|
+
const tree_decorator = as('tree_decorator', dispatch('type', (type) => record({
|
|
225
233
|
type: resource('worldgen/tree_decorator_type'),
|
|
226
234
|
...pick(type, {
|
|
227
235
|
alter_ground: {
|
|
@@ -374,7 +382,7 @@ export const configured_decorator = as('decorator', dispatch('type', (type, _, c
|
|
|
374
382
|
},
|
|
375
383
|
})),
|
|
376
384
|
})));
|
|
377
|
-
export const placement_modifier = as('placement_modifier', dispatch('type', type => record({
|
|
385
|
+
export const placement_modifier = as('placement_modifier', dispatch('type', (type) => record({
|
|
378
386
|
type: resource('worldgen/placement_modifier_type'),
|
|
379
387
|
...pick(type, {
|
|
380
388
|
block_predicate_filter: {
|
|
@@ -534,9 +542,15 @@ export const configured_feature = as('feature', dispatch('type', (type, _, ctx)
|
|
|
534
542
|
use_potential_placements_chance: opt(floatRange(0, 1), 0.35),
|
|
535
543
|
use_alternate_layer0_chance: opt(floatRange(0, 1), 0),
|
|
536
544
|
placements_require_layer0_alternate: opt(boolean, true),
|
|
537
|
-
outer_wall_distance: opt(intProvider(0, 10), {
|
|
538
|
-
|
|
539
|
-
|
|
545
|
+
outer_wall_distance: opt(intProvider(0, 10), {
|
|
546
|
+
value: { min_inclusive: 0, max_inclusive: 10 },
|
|
547
|
+
}),
|
|
548
|
+
distribution_points: opt(intProvider(1, 20), {
|
|
549
|
+
value: { min_inclusive: 3, max_inclusive: 4 },
|
|
550
|
+
}),
|
|
551
|
+
point_offset: opt(intProvider(0, 10), {
|
|
552
|
+
value: { min_inclusive: 1, max_inclusive: 2 },
|
|
553
|
+
}),
|
|
540
554
|
min_gen_offset: opt(int, -16),
|
|
541
555
|
max_gen_offset: opt(int, 16),
|
|
542
556
|
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 = [
|
|
@@ -110,16 +110,17 @@ export const predicate = as('predicate', dispatch('condition', (condition, props
|
|
|
110
110
|
},
|
|
111
111
|
}),
|
|
112
112
|
})));
|
|
113
|
-
export const predicate_list = any([
|
|
114
|
-
predicate,
|
|
115
|
-
listOf(predicate),
|
|
116
|
-
]);
|
|
113
|
+
export const predicate_list = any([predicate, listOf(predicate)]);
|
|
117
114
|
export const item_modifier = as('item_modifier', dispatch('function', (function_, props, ctx) => record({
|
|
118
115
|
function: resource('loot_function_type'),
|
|
119
116
|
...pick(function_, {
|
|
120
117
|
apply_bonus: {
|
|
121
118
|
enchantment: resource('enchantment'),
|
|
122
|
-
formula: resource([
|
|
119
|
+
formula: resource([
|
|
120
|
+
'binomial_with_bonus_count',
|
|
121
|
+
'ore_drops',
|
|
122
|
+
'uniform_bonus_count',
|
|
123
|
+
]),
|
|
123
124
|
...pick(extract('formula', props), {
|
|
124
125
|
binomial_with_bonus_count: {
|
|
125
126
|
parameters: record({
|
|
@@ -177,13 +178,14 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
|
|
|
177
178
|
modifiers: listOf(record({
|
|
178
179
|
attribute: resource('attribute'),
|
|
179
180
|
name: simpleString,
|
|
180
|
-
operation: literal([
|
|
181
|
+
operation: literal([
|
|
182
|
+
'addition',
|
|
183
|
+
'multiply_base',
|
|
184
|
+
'multiply_total',
|
|
185
|
+
]),
|
|
181
186
|
id: opt(uuid),
|
|
182
187
|
amount: number_provider,
|
|
183
|
-
slot: any([
|
|
184
|
-
literal(Slots),
|
|
185
|
-
listOf(literal(Slots)),
|
|
186
|
-
]),
|
|
188
|
+
slot: any([literal(Slots), listOf(literal(Slots))]),
|
|
187
189
|
})),
|
|
188
190
|
},
|
|
189
191
|
set_contents: {
|
|
@@ -226,10 +228,7 @@ export const item_modifier = as('item_modifier', dispatch('function', (function_
|
|
|
226
228
|
}),
|
|
227
229
|
conditions: opt(listOf(predicate)),
|
|
228
230
|
})));
|
|
229
|
-
export const item_modifier_list = any([
|
|
230
|
-
item_modifier,
|
|
231
|
-
listOf(item_modifier),
|
|
232
|
-
]);
|
|
231
|
+
export const item_modifier_list = any([item_modifier, listOf(item_modifier)]);
|
|
233
232
|
export const loot_entry = as('loot_entry', dispatch('type', (type) => record({
|
|
234
233
|
type: resource('loot_pool_entry_type'),
|
|
235
234
|
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
3
|
import { block_state, HeightmapType, height_provider } 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,17 @@ 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({
|
|
40
|
+
const processor_rule = as('processor_rule', dispatch((props) => record({
|
|
41
41
|
position_predicate: opt(pos_rule_test, { predicate_type: 'always_true' }),
|
|
42
42
|
input_predicate: rule_test,
|
|
43
43
|
location_predicate: rule_test,
|
|
44
44
|
output_state: block_state,
|
|
45
|
-
output_nbt: opt(nbt({
|
|
45
|
+
output_nbt: opt(nbt({
|
|
46
|
+
registry: 'block',
|
|
47
|
+
id: extractNested('output_state', 'Name', props),
|
|
48
|
+
})),
|
|
46
49
|
})));
|
|
47
|
-
const processor = as('processor', dispatch('processor_type', type => record({
|
|
50
|
+
const processor = as('processor', dispatch('processor_type', (type) => record({
|
|
48
51
|
processor_type: resource('worldgen/structure_processor'),
|
|
49
52
|
...pick(type, {
|
|
50
53
|
block_age: {
|
|
@@ -73,10 +76,7 @@ export const processor_list = as('processor_list', any([
|
|
|
73
76
|
}),
|
|
74
77
|
listOf(processor),
|
|
75
78
|
]));
|
|
76
|
-
export const processor_list_ref = as('processor_list', any([
|
|
77
|
-
resource('worldgen/processor_list'),
|
|
78
|
-
processor_list,
|
|
79
|
-
]));
|
|
79
|
+
export const processor_list_ref = as('processor_list', any([resource('worldgen/processor_list'), processor_list]));
|
|
80
80
|
const template_element = as('template_element', dispatch('element_type', (type, _, ctx) => record({
|
|
81
81
|
element_type: resource('worldgen/structure_pool_element'),
|
|
82
82
|
...when(type, ['empty_pool_element'], {}, {
|
|
@@ -111,7 +111,7 @@ export const template_pool_ref = any([
|
|
|
111
111
|
resource('worldgen/template_pool'),
|
|
112
112
|
template_pool,
|
|
113
113
|
]);
|
|
114
|
-
export const configured_structure_feature = as('structure_feature', dispatch('type', type => record({
|
|
114
|
+
export const configured_structure_feature = as('structure_feature', dispatch('type', (type) => record({
|
|
115
115
|
type: resource('worldgen/structure_feature'),
|
|
116
116
|
config: record({
|
|
117
117
|
...when(type, ['bastion_remnant', 'pillager_outpost', 'village'], {
|
|
@@ -134,7 +134,15 @@ export const configured_structure_feature = as('structure_feature', dispatch('ty
|
|
|
134
134
|
cluster_probability: floatRange(0, 1),
|
|
135
135
|
},
|
|
136
136
|
ruined_portal: {
|
|
137
|
-
portal_type: literal([
|
|
137
|
+
portal_type: literal([
|
|
138
|
+
'standard',
|
|
139
|
+
'desert',
|
|
140
|
+
'jungle',
|
|
141
|
+
'mountain',
|
|
142
|
+
'nether',
|
|
143
|
+
'ocean',
|
|
144
|
+
'swamp',
|
|
145
|
+
]),
|
|
138
146
|
},
|
|
139
147
|
shipwreck: {
|
|
140
148
|
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
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { integer } from '@spyglassmc/core';
|
|
2
|
-
import { any, as, boolean, dispatch, extract, having, int, listOf, literal, opt, pick, record, ref, resource, simpleString, string } from '@spyglassmc/json/lib/checker/primitives/index.js';
|
|
3
|
-
import { deprecated, nbt, nbtPath, stringColor, uuid, versioned } from '../util/index.js';
|
|
2
|
+
import { any, as, boolean, dispatch, extract, having, int, listOf, literal, opt, pick, record, ref, resource, simpleString, string, } from '@spyglassmc/json/lib/checker/primitives/index.js';
|
|
3
|
+
import { deprecated, nbt, nbtPath, stringColor, uuid, versioned, } from '../util/index.js';
|
|
4
4
|
const Keybinds = [
|
|
5
5
|
'key.jump',
|
|
6
6
|
'key.sneak',
|
|
@@ -69,11 +69,15 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
69
69
|
},
|
|
70
70
|
entity: {
|
|
71
71
|
entity: simpleString,
|
|
72
|
-
nbt: nbtPath({
|
|
72
|
+
nbt: nbtPath({
|
|
73
|
+
registry: 'entity_type' /* FIXME: import { getTypesFromEntity } from '../../../../mcfunction/checker'; ids: getTypesFromEntity(somehowGetTheNodeHere, ctx) */,
|
|
74
|
+
}),
|
|
73
75
|
},
|
|
74
76
|
storage: {
|
|
75
77
|
storage: resource('storage'),
|
|
76
|
-
nbt: nbtPath({
|
|
78
|
+
nbt: nbtPath({
|
|
79
|
+
registry: 'storage' /* FIXME:, id: extract('storage', props) */,
|
|
80
|
+
}),
|
|
77
81
|
},
|
|
78
82
|
}),
|
|
79
83
|
interpret: opt(boolean, false),
|
|
@@ -89,7 +93,14 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
89
93
|
obfuscated: opt(boolean),
|
|
90
94
|
insertion: opt(simpleString),
|
|
91
95
|
clickEvent: opt(dispatch('action', (action) => record({
|
|
92
|
-
action: literal([
|
|
96
|
+
action: literal([
|
|
97
|
+
'open_url',
|
|
98
|
+
'open_file',
|
|
99
|
+
'run_command',
|
|
100
|
+
'suggest_command',
|
|
101
|
+
'change_page',
|
|
102
|
+
'copy_to_clipboard',
|
|
103
|
+
]),
|
|
93
104
|
value: simpleString,
|
|
94
105
|
...pick(action, {
|
|
95
106
|
run_command: {
|
|
@@ -108,8 +119,10 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
108
119
|
contents: opt(versioned(ctx, '1.16', text_component)),
|
|
109
120
|
},
|
|
110
121
|
show_item: {
|
|
111
|
-
value: deprecated(ctx, '1.16', nbt({
|
|
112
|
-
|
|
122
|
+
value: deprecated(ctx, '1.16', nbt({
|
|
123
|
+
definition: '::minecraft::util::invitem::InventoryItem',
|
|
124
|
+
})),
|
|
125
|
+
contents: opt(versioned(ctx, '1.16', dispatch((props) => record({
|
|
113
126
|
id: resource('item'),
|
|
114
127
|
count: opt(int),
|
|
115
128
|
tag: opt(nbt({ registry: 'item', id: extract('id', props) })),
|
|
@@ -131,9 +144,5 @@ const text_component_object = as('text_component', (node, ctx) => record({
|
|
|
131
144
|
}))),
|
|
132
145
|
extra: opt(listOf(text_component)),
|
|
133
146
|
})(node, ctx));
|
|
134
|
-
export const text_component = as('text_component', any([
|
|
135
|
-
simpleString,
|
|
136
|
-
text_component_object,
|
|
137
|
-
listOf(ref(() => text_component)),
|
|
138
|
-
]));
|
|
147
|
+
export const text_component = as('text_component', any([simpleString, text_component_object, listOf(ref(() => text_component))]));
|
|
139
148
|
//# sourceMappingURL=text_component.js.map
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as core from '@spyglassmc/core';
|
|
2
2
|
import type { JsonNode } from '@spyglassmc/json';
|
|
3
|
-
|
|
4
|
-
export declare
|
|
3
|
+
import * as mcdoc from '@spyglassmc/mcdoc';
|
|
4
|
+
export declare const entry: core.Checker<JsonNode>;
|
|
5
|
+
export declare function register(meta: core.MetaRegistry): void;
|
|
6
|
+
/**
|
|
7
|
+
* @param identifier An identifier of mcdoc compound definition. e.g. `::minecraft::util::invitem::InventoryItem`
|
|
8
|
+
*/
|
|
9
|
+
export declare function definition(identifier: `::${string}::${string}`): core.SyncChecker<JsonNode>;
|
|
10
|
+
export declare function object(typeDef: mcdoc.StructType): core.SyncChecker<JsonNode>;
|
|
11
|
+
export declare function fieldValue(type: mcdoc.McdocType): core.SyncChecker<JsonNode>;
|
|
5
12
|
//# sourceMappingURL=index.d.ts.map
|