sandstone 1.0.0-beta.5 → 1.0.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.
- package/dist/_internal/index.d.ts +990 -333
- package/dist/_internal/index.js +233 -160
- package/dist/_internal/index.js.map +1 -1
- package/dist/_internal/types/arguments/coords.d.ts +13 -14
- package/dist/_internal/types/arguments/generated/_registry/activities.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/atlases.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/attribute_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/attributes.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/banner_patterns.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/block_definitions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/block_entity_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/block_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/blocks.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/chunk_statuses.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/command_argument_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/creative_mode_tabs.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/custom_stats.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/damage_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/data_component_predicate_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/data_component_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/debug_subscriptions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/decorated_pot_patterns.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/dimension_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_effect_component_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_entity_effect_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_level_based_value_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_location_based_effect_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantment_value_effect_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/enchantments.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/equipments.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/float_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/fluids.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/game_events.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/game_rules.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/height_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/int_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/item_definitions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/items.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/jukebox_songs.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/loot_condition_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/loot_function_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/loot_nbt_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/loot_number_provider_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/memory_module_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/menus.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/mob_effects.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/models.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/painting_variants.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/particle_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/point_of_interest_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/post_effects.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/potions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/recipe_displays.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/recipe_serializers.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/recipe_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/recipes.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/slot_displays.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/slot_source_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/structures.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_blocks.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_entity_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_fluids.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_items.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_point_of_interest_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_timelines.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_villager_trades.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/tag_worldgen_structures.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/textures.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/ticket_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/trigger_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/trim_patterns.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/villager_professions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/wolf_variants.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_biomes.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_density_function_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_features.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_material_conditions.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_noise_settings.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_noises.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_placed_features.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_placement_modifier_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_processor_lists.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_structure_sets.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_structure_types.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_structures.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_template_pools.d.ts +1 -1
- package/dist/_internal/types/arguments/generated/_registry/worldgen_tree_decorator_types.d.ts +1 -1
- package/dist/_internal/types/arguments/objective.d.ts +1 -1
- package/dist/_internal/types/arguments/range.d.ts +7 -7
- package/dist/_internal/types/commands/commands.d.ts +1 -4
- package/dist/_internal/types/commands/implementations/entity/execute.d.ts +7 -1
- package/dist/_internal/types/commands/implementations/server/gamerule.d.ts +38 -3
- package/dist/_internal/types/commands/implementations/server/random.d.ts +3 -3
- package/dist/_internal/types/commands/implementations/world/time.d.ts +6 -6
- package/dist/_internal/types/core/Macro.d.ts +0 -1
- package/dist/_internal/types/core/sandstoneCore.d.ts +8 -0
- package/dist/_internal/types/pack/pack.d.ts +2 -3
- package/dist/_internal/types/utils.d.ts +79 -0
- package/dist/_internal/types/variables/Score.d.ts +20 -4
- package/dist/_internal/types/variables/Sleep.d.ts +0 -3
- package/dist/_internal/types/variables/nbt/NBTs.d.ts +28 -1
- package/dist/browser/sandstone.esm.js +304 -170
- package/dist/browser/sandstone.esm.js.map +1 -1
- package/dist/exports/commands/index.d.ts +1 -1
- package/dist/exports/core/index.d.ts +1 -1
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/index.js +1 -1
- package/package.json +17 -18
- package/src/arguments/coords.ts +11 -14
- package/src/arguments/objective.ts +1 -1
- package/src/arguments/range.ts +9 -9
- package/src/commands/commands.ts +3 -3
- package/src/commands/implementations/block/fill.ts +3 -3
- package/src/commands/implementations/block/setblock.ts +2 -2
- package/src/commands/implementations/entity/clear.ts +5 -1
- package/src/commands/implementations/entity/execute.ts +23 -6
- package/src/commands/implementations/entity/summon.ts +2 -2
- package/src/commands/implementations/player/dialog.ts +2 -2
- package/src/commands/implementations/player/give.ts +2 -2
- package/src/commands/implementations/player/particle.ts +2 -2
- package/src/commands/implementations/server/debug.ts +6 -1
- package/src/commands/implementations/server/function.ts +8 -3
- package/src/commands/implementations/server/gamerule.ts +75 -3
- package/src/commands/implementations/server/random.ts +3 -3
- package/src/commands/implementations/server/schedule.ts +10 -2
- package/src/commands/implementations/world/data.ts +5 -5
- package/src/commands/implementations/world/item.ts +2 -2
- package/src/commands/implementations/world/time.ts +5 -5
- package/src/core/Macro.ts +0 -2
- package/src/core/nodes.ts +17 -1
- package/src/core/resources/datapack/mcfunction.ts +12 -5
- package/src/core/resources/resourcepack/sound.ts +2 -4
- package/src/core/sandstoneCore.ts +17 -0
- package/src/flow/conditions/variables/block.ts +2 -2
- package/src/pack/pack.ts +10 -3
- package/src/utils.ts +159 -0
- package/src/variables/Data.ts +3 -3
- package/src/variables/ItemPredicate.ts +2 -2
- package/src/variables/Score.ts +18 -10
- package/src/variables/Selector.ts +21 -3
- package/src/variables/Sleep.ts +2 -10
- package/src/variables/Trigger.ts +3 -5
- package/src/variables/nbt/NBTs.ts +70 -19
package/dist/_internal/index.js
CHANGED
|
@@ -227,7 +227,7 @@ NotNBT = class NotNBT extends NBTClass {
|
|
|
227
227
|
super();
|
|
228
228
|
this.nbt = nbt;
|
|
229
229
|
}
|
|
230
|
-
[util2.inspect.custom] = () => `!${
|
|
230
|
+
[util2.inspect.custom] = () => `!${nbtResolver(this.nbt)}`;
|
|
231
231
|
};
|
|
232
232
|
NBTString = class NBTString extends NBTPrimitive {
|
|
233
233
|
};
|
|
@@ -258,7 +258,7 @@ Score = class Score extends MacroArgument {
|
|
|
258
258
|
return `${this.target} ${this.objective}`;
|
|
259
259
|
}
|
|
260
260
|
toNBT() {
|
|
261
|
-
return
|
|
261
|
+
return nbtResolver(this._toChatComponent()).toString();
|
|
262
262
|
}
|
|
263
263
|
toJSON() {
|
|
264
264
|
return this._toChatComponent();
|
|
@@ -359,6 +359,7 @@ Score = class Score extends MacroArgument {
|
|
|
359
359
|
modulo(...args) {
|
|
360
360
|
return this.binaryOperation("%=", ...args);
|
|
361
361
|
}
|
|
362
|
+
mod = this.modulo;
|
|
362
363
|
"%=" = this.modulo;
|
|
363
364
|
swap(...args) {
|
|
364
365
|
this.binaryOperation("><", ...args);
|
|
@@ -375,6 +376,7 @@ Score = class Score extends MacroArgument {
|
|
|
375
376
|
multipliedBy(...args) {
|
|
376
377
|
return createVariable(this.sandstonePack, this).binaryOperation("*=", ...args);
|
|
377
378
|
}
|
|
379
|
+
times = this.multipliedBy;
|
|
378
380
|
"*" = this.multipliedBy;
|
|
379
381
|
dividedBy(...args) {
|
|
380
382
|
return createVariable(this.sandstonePack, this).binaryOperation("/=", ...args);
|
|
@@ -383,6 +385,7 @@ Score = class Score extends MacroArgument {
|
|
|
383
385
|
moduloBy(...args) {
|
|
384
386
|
return createVariable(this.sandstonePack, this).binaryOperation("%=", ...args);
|
|
385
387
|
}
|
|
388
|
+
modBy = this.moduloBy;
|
|
386
389
|
"%" = this.moduloBy;
|
|
387
390
|
comparison(operator, matchesRange, args) {
|
|
388
391
|
const playerScore = this;
|
|
@@ -410,21 +413,22 @@ Score = class Score extends MacroArgument {
|
|
|
410
413
|
return this.comparison(">", `${typeof args[0] === "number" ? args[0] + 1 : null}..`, args);
|
|
411
414
|
}
|
|
412
415
|
">" = this.greaterThan;
|
|
413
|
-
|
|
416
|
+
greaterThanOrEqualTo(...args) {
|
|
414
417
|
return this.comparison(">=", `${args[0]}..`, args);
|
|
415
418
|
}
|
|
416
|
-
">=" = this.
|
|
419
|
+
">=" = this.greaterThanOrEqualTo;
|
|
417
420
|
lessThan(...args) {
|
|
418
421
|
return this.comparison("<", `..${typeof args[0] === "number" ? args[0] - 1 : null}`, args);
|
|
419
422
|
}
|
|
420
423
|
"<" = this.lessThan;
|
|
421
|
-
|
|
424
|
+
lessThanOrEqualTo(...args) {
|
|
422
425
|
return this.comparison("<=", `..${args[0]}`, args);
|
|
423
426
|
}
|
|
424
|
-
"<=" = this.
|
|
427
|
+
"<=" = this.lessThanOrEqualTo;
|
|
425
428
|
equalTo(...args) {
|
|
426
429
|
return this.comparison("=", args[0].toString(), args);
|
|
427
430
|
}
|
|
431
|
+
equals = this.equalTo;
|
|
428
432
|
"==" = this.equalTo;
|
|
429
433
|
notEqualTo(...args) {
|
|
430
434
|
return this.sandstonePack._.not(this.comparison("=", args[0].toString(), args));
|
|
@@ -621,7 +625,7 @@ DataPointClass = class DataPointClass extends MacroArgument {
|
|
|
621
625
|
nbt: this.path,
|
|
622
626
|
[this.type]: this.currentTarget
|
|
623
627
|
});
|
|
624
|
-
toNBT = () =>
|
|
628
|
+
toNBT = () => nbtResolver(this._toChatComponent()).toString();
|
|
625
629
|
};
|
|
626
630
|
StringDataPointClass = class StringDataPointClass extends DataPointClass {
|
|
627
631
|
sandstonePack;
|
|
@@ -728,9 +732,17 @@ CommandNode = class CommandNode extends Node {
|
|
|
728
732
|
for (const arg of this.args) {
|
|
729
733
|
if (arg !== undefined && arg !== null) {
|
|
730
734
|
if (typeof arg === "object") {
|
|
731
|
-
if (
|
|
735
|
+
if (arg instanceof ResolvedNBT) {
|
|
736
|
+
if (arg.containsMacro) {
|
|
737
|
+
this.isMacro = true;
|
|
738
|
+
}
|
|
739
|
+
filteredArgs.push(arg);
|
|
740
|
+
} else if (isMacroArgument(this.sandstoneCore, arg)) {
|
|
732
741
|
this.isMacro = true;
|
|
733
742
|
filteredArgs.push(arg.toMacro());
|
|
743
|
+
} else if (Object.hasOwn(arg, "_hasMacro") && arg._hasMacro) {
|
|
744
|
+
this.isMacro = true;
|
|
745
|
+
filteredArgs.push(arg);
|
|
734
746
|
} else if (Object.hasOwn(arg, "toLoop")) {
|
|
735
747
|
filteredArgs.push(arg.toLoop());
|
|
736
748
|
} else {
|
|
@@ -789,8 +801,13 @@ ContainerCommandNode = class ContainerCommandNode extends CommandNode {
|
|
|
789
801
|
AwaitNode = class AwaitNode extends ContainerCommandNode {
|
|
790
802
|
mcfunction = undefined;
|
|
791
803
|
};
|
|
792
|
-
|
|
793
|
-
command = "
|
|
804
|
+
CommentCommandNode = class CommentCommandNode extends CommandNode {
|
|
805
|
+
command = "#";
|
|
806
|
+
getValue() {
|
|
807
|
+
return this.args[0].join(" ").split(`
|
|
808
|
+
`).map((line) => `# ${line}`).join(`
|
|
809
|
+
`);
|
|
810
|
+
}
|
|
794
811
|
};
|
|
795
812
|
class CommandArguments {
|
|
796
813
|
sandstonePack;
|
|
@@ -836,55 +853,6 @@ class CommandArguments {
|
|
|
836
853
|
return new NextArgumentType(this.sandstonePack, node, this.autoCommit, ...additionalNextArgs);
|
|
837
854
|
};
|
|
838
855
|
}
|
|
839
|
-
PlaceCommand = class PlaceCommand extends CommandArguments {
|
|
840
|
-
NodeType = PlaceCommandNode;
|
|
841
|
-
feature = (feature, pos = "~ ~ ~") => this.finalCommand(["feature", feature, coordinatesParser(pos)]);
|
|
842
|
-
jigsaw = (pool, target, maxDepth, pos = "~ ~ ~") => this.finalCommand([
|
|
843
|
-
"jigsaw",
|
|
844
|
-
pool,
|
|
845
|
-
target,
|
|
846
|
-
`${validateIntegerRange(maxDepth, "Jigsaw max depth", 0, 7)}`,
|
|
847
|
-
coordinatesParser(pos)
|
|
848
|
-
]);
|
|
849
|
-
structure = (configuredStructure, pos = "~ ~ ~") => this.finalCommand(["structure", configuredStructure, coordinatesParser(pos)]);
|
|
850
|
-
template = (structure, pos = "~ ~ ~", rotation, mirror, integrity = 1, seed = 0, mode) => {
|
|
851
|
-
this.finalCommand([
|
|
852
|
-
"template",
|
|
853
|
-
`${structure}`,
|
|
854
|
-
coordinatesParser(pos),
|
|
855
|
-
structureRotationParser(rotation),
|
|
856
|
-
structureMirrorParser(mirror),
|
|
857
|
-
`${integrity}`,
|
|
858
|
-
`${seed}`,
|
|
859
|
-
...mode === undefined ? [] : [mode]
|
|
860
|
-
]);
|
|
861
|
-
};
|
|
862
|
-
};
|
|
863
|
-
DamageCommandNode = class DamageCommandNode extends CommandNode {
|
|
864
|
-
command = "damage";
|
|
865
|
-
};
|
|
866
|
-
DamageCauseCommand = class DamageCauseCommand extends CommandArguments {
|
|
867
|
-
from = (cause) => this.finalCommand(["from", targetParser(cause)]);
|
|
868
|
-
};
|
|
869
|
-
DamageSourceCommand = class DamageSourceCommand extends CommandArguments {
|
|
870
|
-
by = (entity) => this.subCommand(["by", targetParser(entity)], DamageCauseCommand, true);
|
|
871
|
-
at = (position) => this.finalCommand(["at", coordinatesParser(position)]);
|
|
872
|
-
};
|
|
873
|
-
DamageCommand = class DamageCommand extends CommandArguments {
|
|
874
|
-
NodeType = DamageCommandNode;
|
|
875
|
-
damage = (target, amount, damageType) => {
|
|
876
|
-
validateIntegerRange(amount, "amount", 0, 1e6);
|
|
877
|
-
return this.subCommand([targetParser(target), amount, damageType], DamageSourceCommand, true);
|
|
878
|
-
};
|
|
879
|
-
};
|
|
880
|
-
CommentCommandNode = class CommentCommandNode extends CommandNode {
|
|
881
|
-
command = "#";
|
|
882
|
-
getValue() {
|
|
883
|
-
return this.args[0].join(" ").split(`
|
|
884
|
-
`).map((line) => `# ${line}`).join(`
|
|
885
|
-
`);
|
|
886
|
-
}
|
|
887
|
-
};
|
|
888
856
|
CommentCommand = class CommentCommand extends CommandArguments {
|
|
889
857
|
NodeType = CommentCommandNode;
|
|
890
858
|
comment = (...comments) => this.finalCommand([comments]);
|
|
@@ -945,7 +913,7 @@ SetBlockCommand = class SetBlockCommand extends CommandArguments {
|
|
|
945
913
|
return this.finalCommand([coordinatesParser(pos), block, arg5]);
|
|
946
914
|
}
|
|
947
915
|
const state = typeof arg3 === "undefined" ? "" : blockStateStringifier(arg3);
|
|
948
|
-
const nbt = typeof arg4 === "string" || arg4 === undefined ? "" :
|
|
916
|
+
const nbt = typeof arg4 === "string" || arg4 === undefined ? "" : nbtResolver(arg4).toString();
|
|
949
917
|
const setblockType = typeof arg4 === "string" ? arg4 : arg5;
|
|
950
918
|
return this.finalCommand([coordinatesParser(pos), `${block}${state}${nbt}`, setblockType]);
|
|
951
919
|
}
|
|
@@ -957,7 +925,7 @@ FillCommand = class FillCommand extends CommandArguments {
|
|
|
957
925
|
NodeType = FillCommandNode;
|
|
958
926
|
fill(from, to, block, state, nbt) {
|
|
959
927
|
const stateStr = state && Object.keys(state).length > 0 ? blockStateStringifier(state) : "";
|
|
960
|
-
const nbtStr = nbt ?
|
|
928
|
+
const nbtStr = nbt ? nbtResolver(nbt).toString() : "";
|
|
961
929
|
const blockArg = `${block}${stateStr}${nbtStr}`;
|
|
962
930
|
return this.subCommand([coordinatesParser(from), coordinatesParser(to), blockArg], FillArgumentsCommand, true);
|
|
963
931
|
}
|
|
@@ -973,7 +941,7 @@ FillArgumentsCommand = class FillArgumentsCommand extends CommandArguments {
|
|
|
973
941
|
return this.finalCommand(["replace"]);
|
|
974
942
|
}
|
|
975
943
|
const stateStr = filterState && Object.keys(filterState).length > 0 ? blockStateStringifier(filterState) : "";
|
|
976
|
-
const nbtStr = filterNbt ?
|
|
944
|
+
const nbtStr = filterNbt ? nbtResolver(filterNbt).toString() : "";
|
|
977
945
|
return this.subCommand(["replace", `${filter}${stateStr}${nbtStr}`], FillReplaceFilterCommand, true);
|
|
978
946
|
}
|
|
979
947
|
};
|
|
@@ -983,6 +951,33 @@ FillReplaceFilterCommand = class FillReplaceFilterCommand extends CommandArgumen
|
|
|
983
951
|
outline = () => this.finalCommand(["outline"]);
|
|
984
952
|
strict = () => this.finalCommand(["strict"]);
|
|
985
953
|
};
|
|
954
|
+
PlaceCommandNode = class PlaceCommandNode extends CommandNode {
|
|
955
|
+
command = "place";
|
|
956
|
+
};
|
|
957
|
+
PlaceCommand = class PlaceCommand extends CommandArguments {
|
|
958
|
+
NodeType = PlaceCommandNode;
|
|
959
|
+
feature = (feature, pos = "~ ~ ~") => this.finalCommand(["feature", feature, coordinatesParser(pos)]);
|
|
960
|
+
jigsaw = (pool, target, maxDepth, pos = "~ ~ ~") => this.finalCommand([
|
|
961
|
+
"jigsaw",
|
|
962
|
+
pool,
|
|
963
|
+
target,
|
|
964
|
+
`${validateIntegerRange(maxDepth, "Jigsaw max depth", 0, 7)}`,
|
|
965
|
+
coordinatesParser(pos)
|
|
966
|
+
]);
|
|
967
|
+
structure = (configuredStructure, pos = "~ ~ ~") => this.finalCommand(["structure", configuredStructure, coordinatesParser(pos)]);
|
|
968
|
+
template = (structure, pos = "~ ~ ~", rotation, mirror, integrity = 1, seed = 0, mode) => {
|
|
969
|
+
this.finalCommand([
|
|
970
|
+
"template",
|
|
971
|
+
`${structure}`,
|
|
972
|
+
coordinatesParser(pos),
|
|
973
|
+
structureRotationParser(rotation),
|
|
974
|
+
structureMirrorParser(mirror),
|
|
975
|
+
`${integrity}`,
|
|
976
|
+
`${seed}`,
|
|
977
|
+
...mode === undefined ? [] : [mode]
|
|
978
|
+
]);
|
|
979
|
+
};
|
|
980
|
+
};
|
|
986
981
|
AttributeCommandNode = class AttributeCommandNode extends CommandNode {
|
|
987
982
|
command = "attribute";
|
|
988
983
|
};
|
|
@@ -1005,9 +1000,27 @@ ClearCommandNode = class ClearCommandNode extends CommandNode {
|
|
|
1005
1000
|
ClearCommand = class ClearCommand extends CommandArguments {
|
|
1006
1001
|
NodeType = ClearCommandNode;
|
|
1007
1002
|
clear(targets, itemOrPredicate, maxCount) {
|
|
1008
|
-
|
|
1003
|
+
const itemArg = isMacroArgument(this.sandstoneCore, itemOrPredicate) ? itemOrPredicate : `${itemOrPredicate}`;
|
|
1004
|
+
return this.finalCommand([targetParser(targets), itemArg, maxCount]);
|
|
1009
1005
|
}
|
|
1010
1006
|
};
|
|
1007
|
+
DamageCommandNode = class DamageCommandNode extends CommandNode {
|
|
1008
|
+
command = "damage";
|
|
1009
|
+
};
|
|
1010
|
+
DamageCauseCommand = class DamageCauseCommand extends CommandArguments {
|
|
1011
|
+
from = (cause) => this.finalCommand(["from", targetParser(cause)]);
|
|
1012
|
+
};
|
|
1013
|
+
DamageSourceCommand = class DamageSourceCommand extends CommandArguments {
|
|
1014
|
+
by = (entity) => this.subCommand(["by", targetParser(entity)], DamageCauseCommand, true);
|
|
1015
|
+
at = (position) => this.finalCommand(["at", coordinatesParser(position)]);
|
|
1016
|
+
};
|
|
1017
|
+
DamageCommand = class DamageCommand extends CommandArguments {
|
|
1018
|
+
NodeType = DamageCommandNode;
|
|
1019
|
+
damage = (target, amount, damageType) => {
|
|
1020
|
+
validateIntegerRange(amount, "amount", 0, 1e6);
|
|
1021
|
+
return this.subCommand([targetParser(target), amount, damageType], DamageSourceCommand, true);
|
|
1022
|
+
};
|
|
1023
|
+
};
|
|
1011
1024
|
EffectCommandNode = class EffectCommandNode extends CommandNode {
|
|
1012
1025
|
command = "effect";
|
|
1013
1026
|
};
|
|
@@ -1874,15 +1887,17 @@ _RawMCFunctionClass = class _RawMCFunctionClass extends CallableResourceClass {
|
|
|
1874
1887
|
func = this;
|
|
1875
1888
|
}
|
|
1876
1889
|
if (typeof tag === "string") {
|
|
1877
|
-
|
|
1878
|
-
|
|
1890
|
+
const existing = this.core.functionTags.get(tag);
|
|
1891
|
+
if (existing) {
|
|
1892
|
+
existing.push(func);
|
|
1879
1893
|
} else {
|
|
1880
|
-
|
|
1894
|
+
const newTag = new TagClass(this.core, "function", tag, {
|
|
1881
1895
|
values: [func],
|
|
1882
1896
|
addToSandstoneCore: true,
|
|
1883
1897
|
creator: "sandstone",
|
|
1884
1898
|
onConflict: "append"
|
|
1885
1899
|
});
|
|
1900
|
+
this.core.functionTags.set(tag, newTag);
|
|
1886
1901
|
}
|
|
1887
1902
|
} else {
|
|
1888
1903
|
tag.push(func);
|
|
@@ -1906,6 +1921,7 @@ _RawMCFunctionClass = class _RawMCFunctionClass extends CallableResourceClass {
|
|
|
1906
1921
|
this.core.enterMCFunction(this);
|
|
1907
1922
|
this.core.insideContext(this.node, () => this.callback(makeCallable(this, this.__call__.bind(undefined, ..._params)), ..._params), false);
|
|
1908
1923
|
this.core.exitMCFunction();
|
|
1924
|
+
this.generated = true;
|
|
1909
1925
|
} else if (this.callback.length > 1) {
|
|
1910
1926
|
throw new Error(`[MCFunctionClass] Function ${this.name} expects ${this.callback.length - 1} params at the call-site`);
|
|
1911
1927
|
}
|
|
@@ -2726,9 +2742,9 @@ SoundEventClass = class SoundEventClass extends ResourceClass {
|
|
|
2726
2742
|
this.buffer = args.sound;
|
|
2727
2743
|
}
|
|
2728
2744
|
if (args.addToSounds) {
|
|
2729
|
-
let def = sounds.get(this.path[0]);
|
|
2745
|
+
let def = this.core.sounds.get(this.path[0]);
|
|
2730
2746
|
if (!def) {
|
|
2731
|
-
def = sounds.set(this.path[0], new SoundsClass(this.core, this.path[0], {
|
|
2747
|
+
def = this.core.sounds.set(this.path[0], new SoundsClass(this.core, this.path[0], {
|
|
2732
2748
|
addToSandstoneCore: true,
|
|
2733
2749
|
creator: "sandstone"
|
|
2734
2750
|
})).get(this.path[0]);
|
|
@@ -3005,10 +3021,11 @@ FunctionCommand = class FunctionCommand extends CommandArguments {
|
|
|
3005
3021
|
args.push(point.type, point.currentTarget, point.path);
|
|
3006
3022
|
}
|
|
3007
3023
|
} else {
|
|
3008
|
-
args.push(typeof params === "object" && params.toMacro ? params :
|
|
3024
|
+
args.push(typeof params === "object" && params.toMacro ? params : nbtResolver(params));
|
|
3009
3025
|
}
|
|
3010
3026
|
}
|
|
3011
|
-
|
|
3027
|
+
const mcFunctionArg = isMacroArgument(this.sandstoneCore, mcFunction) ? mcFunction : `${mcFunction}`;
|
|
3028
|
+
return this.finalCommand([mcFunctionArg, ...args]);
|
|
3012
3029
|
}
|
|
3013
3030
|
};
|
|
3014
3031
|
ExecuteCommandPart = class ExecuteCommandPart extends CommandArguments {
|
|
@@ -3113,7 +3130,15 @@ ExecuteStoreArgsCommand = class ExecuteStoreArgsCommand extends ExecuteCommandPa
|
|
|
3113
3130
|
block = (targetPos, path5, type, scale) => this.nestedExecute(["block", coordinatesParser(targetPos), path5, type, scale]);
|
|
3114
3131
|
bossbar = (id2, type) => this.nestedExecute(["bossbar", id2, type]);
|
|
3115
3132
|
entity = (target, path5, type, scale) => this.nestedExecute(["entity", targetParser(target), path5, type, scale]);
|
|
3116
|
-
score
|
|
3133
|
+
score(...args) {
|
|
3134
|
+
const finalArgs = ["score"];
|
|
3135
|
+
if (isScore(args[0])) {
|
|
3136
|
+
finalArgs.push(args[0].target, args[0].objective.name);
|
|
3137
|
+
} else {
|
|
3138
|
+
finalArgs.push(targetParser(args[0]), args[1]);
|
|
3139
|
+
}
|
|
3140
|
+
return this.nestedExecute(finalArgs);
|
|
3141
|
+
}
|
|
3117
3142
|
storage = (target, path5, type, scale = 1) => this.nestedExecute(["storage", target, path5, type, scale]);
|
|
3118
3143
|
};
|
|
3119
3144
|
ExecuteStoreCommand = class ExecuteStoreCommand extends ExecuteCommandPart {
|
|
@@ -3151,7 +3176,7 @@ ExecuteItemsCommand = class ExecuteItemsCommand extends ExecuteCommandPart {
|
|
|
3151
3176
|
ExecuteIfUnlessCommand = class ExecuteIfUnlessCommand extends ExecuteCommandPart {
|
|
3152
3177
|
block(pos, block, state, nbt) {
|
|
3153
3178
|
const stateStr = state && typeof state === "object" && Object.keys(state).length > 0 ? blockStateStringifier(state) : "";
|
|
3154
|
-
const nbtStr = nbt ?
|
|
3179
|
+
const nbtStr = nbt ? nbtResolver(nbt).toString() : "";
|
|
3155
3180
|
return this.nestedExecute(["block", coordinatesParser(pos), `${block}${stateStr}${nbtStr}`], true);
|
|
3156
3181
|
}
|
|
3157
3182
|
blocks = (start, end, destination, scan_mode) => this.nestedExecute(["blocks", coordinatesParser(start), coordinatesParser(end), coordinatesParser(destination), scan_mode], true);
|
|
@@ -3401,7 +3426,7 @@ SummonCommand = class SummonCommand extends CommandArguments {
|
|
|
3401
3426
|
args.push(coordinatesParser(pos));
|
|
3402
3427
|
}
|
|
3403
3428
|
if (nbt !== undefined) {
|
|
3404
|
-
args.push(
|
|
3429
|
+
args.push(nbtResolver(nbt));
|
|
3405
3430
|
}
|
|
3406
3431
|
return this.finalCommand(args);
|
|
3407
3432
|
}
|
|
@@ -3501,7 +3526,7 @@ DialogCommandNode = class DialogCommandNode extends CommandNode {
|
|
|
3501
3526
|
DialogCommand = class DialogCommand extends CommandArguments {
|
|
3502
3527
|
NodeType = DialogCommandNode;
|
|
3503
3528
|
show(targets, dialog2) {
|
|
3504
|
-
const dialogArg = typeof dialog2 === "string" || dialog2 instanceof ResourceClass ? dialog2 :
|
|
3529
|
+
const dialogArg = typeof dialog2 === "string" || dialog2 instanceof ResourceClass ? dialog2 : nbtResolver(dialog2);
|
|
3505
3530
|
return this.finalCommand(["show", targetParser(targets), dialogArg]);
|
|
3506
3531
|
}
|
|
3507
3532
|
clear = (targets) => this.finalCommand(["clear", targetParser(targets)]);
|
|
@@ -3547,7 +3572,7 @@ ParticleCommand = class ParticleCommand extends CommandArguments {
|
|
|
3547
3572
|
NodeType = ParticleCommandNode;
|
|
3548
3573
|
particle(name, arg2, arg3, arg4, arg5, arg6, arg7, arg8) {
|
|
3549
3574
|
const hasOptions = arg2 !== undefined && typeof arg2 === "object" && !isCoordinates(arg2);
|
|
3550
|
-
const [particleName, pos, delta, speed, count, mode, viewers] = hasOptions ? [`${name}${
|
|
3575
|
+
const [particleName, pos, delta, speed, count, mode, viewers] = hasOptions ? [`${name}${nbtResolver(arg2)}`, arg3, arg4, arg5, arg6, arg7, arg8] : [name, arg2, arg3, arg4, arg5, arg6, arg7];
|
|
3551
3576
|
return this.finalCommand([
|
|
3552
3577
|
particleName,
|
|
3553
3578
|
pos === undefined ? "~ ~ ~" : coordinatesParser(pos),
|
|
@@ -3727,7 +3752,8 @@ DebugCommand = class DebugCommand extends CommandArguments {
|
|
|
3727
3752
|
this.sandstoneCore.insideContext(node, func, false);
|
|
3728
3753
|
return this.finalCommand(["function", undefined], node);
|
|
3729
3754
|
}
|
|
3730
|
-
|
|
3755
|
+
const funcArg = isMacroArgument(this.sandstoneCore, func) ? func : `${func}`;
|
|
3756
|
+
return this.finalCommand(["function", funcArg], node);
|
|
3731
3757
|
}
|
|
3732
3758
|
};
|
|
3733
3759
|
DefaultGameModeCommandNode = class DefaultGameModeCommandNode extends CommandNode {
|
|
@@ -3934,7 +3960,8 @@ ScheduleCommandNode = class ScheduleCommandNode extends ContainerCommandNode {
|
|
|
3934
3960
|
ScheduleCommand = class ScheduleCommand extends CommandArguments {
|
|
3935
3961
|
NodeType = ScheduleCommandNode;
|
|
3936
3962
|
clear = (func) => {
|
|
3937
|
-
const
|
|
3963
|
+
const funcArg = isMacroArgument(this.sandstoneCore, func) ? func : `${func}`;
|
|
3964
|
+
const result = this.finalCommand(["clear", funcArg]);
|
|
3938
3965
|
return result;
|
|
3939
3966
|
};
|
|
3940
3967
|
function = (func, delay, type) => {
|
|
@@ -3946,7 +3973,8 @@ ScheduleCommand = class ScheduleCommand extends CommandArguments {
|
|
|
3946
3973
|
this.sandstoneCore.insideContext(node, func, false);
|
|
3947
3974
|
return this.finalCommand(["function", undefined, delay, type], node);
|
|
3948
3975
|
}
|
|
3949
|
-
|
|
3976
|
+
const funcArg = isMacroArgument(this.sandstoneCore, func) ? func : `${func}`;
|
|
3977
|
+
return this.finalCommand(["function", funcArg, delay, type], node);
|
|
3950
3978
|
};
|
|
3951
3979
|
};
|
|
3952
3980
|
SetIdleTimeoutCommandNode = class SetIdleTimeoutCommandNode extends CommandNode {
|
|
@@ -4062,9 +4090,9 @@ DataGetCommand = class DataGetCommand extends CommandArguments {
|
|
|
4062
4090
|
};
|
|
4063
4091
|
};
|
|
4064
4092
|
DataMergeCommand = class DataMergeCommand extends CommandArguments {
|
|
4065
|
-
block = (targetPos, nbt) => this.finalCommand(["block", coordinatesParser(targetPos),
|
|
4066
|
-
entity = (target, nbt) => this.finalCommand(["entity", targetParser(target),
|
|
4067
|
-
storage = (target, nbt) => this.finalCommand(["storage", target,
|
|
4093
|
+
block = (targetPos, nbt) => this.finalCommand(["block", coordinatesParser(targetPos), nbtResolver(nbt)]);
|
|
4094
|
+
entity = (target, nbt) => this.finalCommand(["entity", targetParser(target), nbtResolver(nbt)]);
|
|
4095
|
+
storage = (target, nbt) => this.finalCommand(["storage", target, nbtResolver(nbt)]);
|
|
4068
4096
|
};
|
|
4069
4097
|
DataModifyFromCommand = class DataModifyFromCommand extends CommandArguments {
|
|
4070
4098
|
block = (sourcePosition, sourcePath) => this.finalCommand(["block", coordinatesParser(sourcePosition), sourcePath]);
|
|
@@ -4125,7 +4153,7 @@ DataModifyValuesCommand = class DataModifyValuesCommand extends CommandArguments
|
|
|
4125
4153
|
this.finalCommand(command);
|
|
4126
4154
|
}
|
|
4127
4155
|
};
|
|
4128
|
-
value = (value) => this.finalCommand(["value",
|
|
4156
|
+
value = (value) => this.finalCommand(["value", nbtResolver(value)]);
|
|
4129
4157
|
};
|
|
4130
4158
|
DataModifyTypeCommand = class DataModifyTypeCommand extends CommandArguments {
|
|
4131
4159
|
get append() {
|
|
@@ -4198,7 +4226,7 @@ ItemCommandNode = class ItemCommandNode extends CommandNode {
|
|
|
4198
4226
|
ItemSourceCommand = class ItemSourceCommand extends CommandArguments {
|
|
4199
4227
|
with(item, countOrNBT, count) {
|
|
4200
4228
|
if (typeof countOrNBT === "object") {
|
|
4201
|
-
return this.finalCommand(["with", `${item}${
|
|
4229
|
+
return this.finalCommand(["with", `${item}${nbtResolver(countOrNBT)}`, count]);
|
|
4202
4230
|
}
|
|
4203
4231
|
return this.finalCommand(["with", item, countOrNBT]);
|
|
4204
4232
|
}
|
|
@@ -4469,7 +4497,7 @@ BlockConditionNode = class BlockConditionNode extends SingleConditionNode {
|
|
|
4469
4497
|
}
|
|
4470
4498
|
getCondition() {
|
|
4471
4499
|
const stateStr = this.state && Object.keys(this.state).length > 0 ? blockStateStringifier(this.state) : "";
|
|
4472
|
-
const nbtStr = this.nbt ?
|
|
4500
|
+
const nbtStr = this.nbt ? nbtResolver(this.nbt).toString() : "";
|
|
4473
4501
|
return ["block", coordinatesParser(this.position), `${this.block}${stateStr}${nbtStr}`];
|
|
4474
4502
|
}
|
|
4475
4503
|
};
|
|
@@ -5608,7 +5636,7 @@ ItemPredicateClass = class ItemPredicateClass {
|
|
|
5608
5636
|
if (test2.operator === "exists") {
|
|
5609
5637
|
return `${prefix}${test2.component}`;
|
|
5610
5638
|
}
|
|
5611
|
-
const valueStr =
|
|
5639
|
+
const valueStr = nbtResolver(test2.value).toString();
|
|
5612
5640
|
return `${prefix}${test2.component}${test2.operator}${valueStr}`;
|
|
5613
5641
|
}
|
|
5614
5642
|
stringifyOrGroup(group) {
|
|
@@ -6077,6 +6105,7 @@ SelectorClass = class SelectorClass {
|
|
|
6077
6105
|
sandstonePack;
|
|
6078
6106
|
target;
|
|
6079
6107
|
arguments;
|
|
6108
|
+
_hasMacro = false;
|
|
6080
6109
|
constructor(sandstonePack2, target, selectorArguments) {
|
|
6081
6110
|
this.sandstonePack = sandstonePack2;
|
|
6082
6111
|
this.target = target;
|
|
@@ -6087,6 +6116,7 @@ SelectorClass = class SelectorClass {
|
|
|
6087
6116
|
};
|
|
6088
6117
|
toString() {
|
|
6089
6118
|
if (!this.arguments || !Object.keys(this.arguments).length) {
|
|
6119
|
+
this._hasMacro = false;
|
|
6090
6120
|
return this.target;
|
|
6091
6121
|
}
|
|
6092
6122
|
const result = [];
|
|
@@ -6095,12 +6125,18 @@ SelectorClass = class SelectorClass {
|
|
|
6095
6125
|
scores: (scores) => result.push(["scores", parseScore(this.sandstonePack.core, scores)]),
|
|
6096
6126
|
nbt: (nbt2) => {
|
|
6097
6127
|
const nbts = Array.isArray(nbt2) ? nbt2 : [nbt2];
|
|
6098
|
-
|
|
6128
|
+
for (const nbt_ of nbts) {
|
|
6129
|
+
const resolved = nbtResolver(nbt_);
|
|
6130
|
+
if (resolved.containsMacro) {
|
|
6131
|
+
this._hasMacro = true;
|
|
6132
|
+
}
|
|
6133
|
+
result.push(["nbt", resolved]);
|
|
6134
|
+
}
|
|
6099
6135
|
},
|
|
6100
6136
|
advancements: (advancements) => result.push(["advancements", parseAdvancements(advancements)]),
|
|
6101
6137
|
tag: (tag4) => {
|
|
6102
|
-
const
|
|
6103
|
-
result.push(...
|
|
6138
|
+
const tags = Array.isArray(tag4) ? tag4 : [tag4];
|
|
6139
|
+
result.push(...tags.map((tag_) => ["tag", tag_]));
|
|
6104
6140
|
},
|
|
6105
6141
|
gamemode: (gamemode2) => {
|
|
6106
6142
|
const gamemodes = Array.isArray(gamemode2) ? gamemode2 : [gamemode2];
|
|
@@ -6280,6 +6316,7 @@ SleepClass = class SleepClass extends AwaitNode {
|
|
|
6280
6316
|
const { execute: execute2 } = commands2;
|
|
6281
6317
|
const name = `__sandstone:asyncTimer.${currentFunction.resource.name.replace(/[:/]/g, ".")}`;
|
|
6282
6318
|
const timer = new ObjectiveClass(core.pack, name.replace(":", "."), "dummy", undefined, { creator: "sandstone" });
|
|
6319
|
+
core.pack.registerNewObjective(timer);
|
|
6283
6320
|
execute2.store.result(timer("@s")).run.time.query("gametime");
|
|
6284
6321
|
timer("@s").add(Duration);
|
|
6285
6322
|
const label2 = Label(name);
|
|
@@ -6296,14 +6333,6 @@ SleepClass = class SleepClass extends AwaitNode {
|
|
|
6296
6333
|
currentFunction.enterContext(this);
|
|
6297
6334
|
core.awaitNodes.add(this);
|
|
6298
6335
|
}
|
|
6299
|
-
promise() {
|
|
6300
|
-
return {
|
|
6301
|
-
then: async (onfullfilled) => {
|
|
6302
|
-
await onfullfilled?.();
|
|
6303
|
-
return this;
|
|
6304
|
-
}
|
|
6305
|
-
};
|
|
6306
|
-
}
|
|
6307
6336
|
};
|
|
6308
6337
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
6309
6338
|
|
|
@@ -7130,18 +7159,30 @@ function customNumber(num, _class) {
|
|
|
7130
7159
|
}
|
|
7131
7160
|
function dynamicNBT(template, ...args) {
|
|
7132
7161
|
const mixedArgs = template.flatMap((s, i) => [s, args[i]]).slice(0, -1);
|
|
7133
|
-
const result = mixedArgs.map((element) => element instanceof NBTClass ?
|
|
7162
|
+
const result = mixedArgs.map((element) => element instanceof NBTClass ? nbtResolver(element).toString() : element.toString()).join("");
|
|
7134
7163
|
return parseNBT(NBT, result);
|
|
7135
7164
|
}
|
|
7136
|
-
|
|
7165
|
+
|
|
7166
|
+
class ResolvedNBT {
|
|
7167
|
+
value;
|
|
7168
|
+
containsMacro;
|
|
7169
|
+
constructor(value, containsMacro) {
|
|
7170
|
+
this.value = value;
|
|
7171
|
+
this.containsMacro = containsMacro;
|
|
7172
|
+
}
|
|
7173
|
+
toString() {
|
|
7174
|
+
return this.value;
|
|
7175
|
+
}
|
|
7176
|
+
}
|
|
7177
|
+
var NBTPrimitive, NBTLong, NBTByte, NBTShort, NBTFloat, NBTInt, NBTDouble, NBTTypedArray, NBTLongArray, NBTByteArray, NBTIntArray, NotNBT, NBTString, NBTAnyValue, NBT, resolve = (nbt) => {
|
|
7137
7178
|
if (nbt === null || nbt === undefined) {
|
|
7138
7179
|
throw new Error("Nullish nbt values are not allowed");
|
|
7139
7180
|
}
|
|
7140
7181
|
if (typeof nbt === "number") {
|
|
7141
|
-
return `${nbt}d
|
|
7182
|
+
return new ResolvedNBT(`${nbt}d`, false);
|
|
7142
7183
|
}
|
|
7143
7184
|
if (typeof nbt === "boolean") {
|
|
7144
|
-
return nbt.toString();
|
|
7185
|
+
return new ResolvedNBT(nbt.toString(), false);
|
|
7145
7186
|
}
|
|
7146
7187
|
if (typeof nbt === "string") {
|
|
7147
7188
|
const inspectedStr = util2.inspect(nbt, {
|
|
@@ -7151,16 +7192,22 @@ var NBTPrimitive, NBTLong, NBTByte, NBTShort, NBTFloat, NBTInt, NBTDouble, NBTTy
|
|
|
7151
7192
|
depth: Number.POSITIVE_INFINITY
|
|
7152
7193
|
});
|
|
7153
7194
|
if (inspectedStr[0] === "`") {
|
|
7154
|
-
return JSON.stringify(nbt);
|
|
7195
|
+
return new ResolvedNBT(JSON.stringify(nbt), false);
|
|
7155
7196
|
}
|
|
7156
|
-
return inspectedStr;
|
|
7197
|
+
return new ResolvedNBT(inspectedStr, false);
|
|
7157
7198
|
}
|
|
7158
7199
|
if (Array.isArray(nbt)) {
|
|
7159
|
-
|
|
7160
|
-
|
|
7200
|
+
let containsMacro2 = false;
|
|
7201
|
+
const itemsStr = nbt.map((item) => {
|
|
7202
|
+
const resolved = resolve(item);
|
|
7203
|
+
if (resolved.containsMacro)
|
|
7204
|
+
containsMacro2 = true;
|
|
7205
|
+
return resolved.value;
|
|
7206
|
+
}).join(",");
|
|
7207
|
+
return new ResolvedNBT(`[${itemsStr}]`, containsMacro2);
|
|
7161
7208
|
}
|
|
7162
7209
|
if (nbt instanceof NBTClass) {
|
|
7163
|
-
return nbt[util2.inspect.custom]();
|
|
7210
|
+
return new ResolvedNBT(nbt[util2.inspect.custom](), false);
|
|
7164
7211
|
}
|
|
7165
7212
|
if (typeof nbt === "object" || typeof nbt === "function") {
|
|
7166
7213
|
let failedMacro = false;
|
|
@@ -7169,28 +7216,38 @@ var NBTPrimitive, NBTLong, NBTByte, NBTShort, NBTFloat, NBTInt, NBTDouble, NBTTy
|
|
|
7169
7216
|
if (macro === "$()") {
|
|
7170
7217
|
failedMacro = true;
|
|
7171
7218
|
} else {
|
|
7172
|
-
return macro;
|
|
7219
|
+
return new ResolvedNBT(macro, true);
|
|
7173
7220
|
}
|
|
7174
7221
|
}
|
|
7175
7222
|
if ("toNBT" in nbt) {
|
|
7176
|
-
|
|
7223
|
+
const toNbtResult = nbt.toNBT();
|
|
7224
|
+
if (toNbtResult instanceof ResolvedNBT) {
|
|
7225
|
+
return toNbtResult;
|
|
7226
|
+
}
|
|
7227
|
+
return new ResolvedNBT(String(toNbtResult), false);
|
|
7177
7228
|
} else if (failedMacro) {
|
|
7178
|
-
throw new Error("[
|
|
7229
|
+
throw new Error("[nbtResolver] A macro variable NBT insertion was attempted in an mcfunction without macros defined.");
|
|
7179
7230
|
}
|
|
7180
7231
|
if (typeof nbt === "function") {
|
|
7181
|
-
throw new Error(`[
|
|
7232
|
+
throw new Error(`[nbtResolver] This should never happen. A function or callable instance (${nbt.constructor?.name}) without toNBT was passed in as an NBT value.`);
|
|
7182
7233
|
}
|
|
7183
7234
|
if (nbt.constructor.name !== "Object") {
|
|
7184
7235
|
if ("toString" in nbt) {
|
|
7185
|
-
return `${toString}
|
|
7236
|
+
return new ResolvedNBT(`${toString}`, false);
|
|
7186
7237
|
} else {
|
|
7187
|
-
throw new Error(`[
|
|
7238
|
+
throw new Error(`[nbtResolver] A ${nbt.constructor?.name} was passed in as an NBT value. Hint: define toNBT or toString if this was intentional`);
|
|
7188
7239
|
}
|
|
7189
7240
|
}
|
|
7190
7241
|
}
|
|
7191
|
-
|
|
7192
|
-
|
|
7193
|
-
|
|
7242
|
+
let containsMacro = false;
|
|
7243
|
+
const objectStr = Object.entries(nbt).map(([key, value]) => {
|
|
7244
|
+
const resolved = resolve(value);
|
|
7245
|
+
if (resolved.containsMacro)
|
|
7246
|
+
containsMacro = true;
|
|
7247
|
+
return `${key}:${resolved.value}`;
|
|
7248
|
+
}).join(",");
|
|
7249
|
+
return new ResolvedNBT(`{${objectStr}}`, containsMacro);
|
|
7250
|
+
}, nbtResolver = (nbt) => resolve(nbt);
|
|
7194
7251
|
var init_NBTs = __esm(() => {
|
|
7195
7252
|
init_utils();
|
|
7196
7253
|
init_parser();
|
|
@@ -7205,7 +7262,7 @@ var init_NBTs = __esm(() => {
|
|
|
7205
7262
|
longArray: (numbers) => new NBTLongArray(numbers),
|
|
7206
7263
|
byteArray: (numbers) => new NBTByteArray(numbers),
|
|
7207
7264
|
not: (nbt) => new NotNBT(nbt),
|
|
7208
|
-
stringify: (nbt) =>
|
|
7265
|
+
stringify: (nbt) => nbtResolver(nbt).toString(),
|
|
7209
7266
|
parse: (nbt) => parseNBT(NBT, nbt)
|
|
7210
7267
|
}, dynamicNBT);
|
|
7211
7268
|
});
|
|
@@ -7399,7 +7456,7 @@ function NBTpathToString(pack, paths) {
|
|
|
7399
7456
|
} else if (Array.isArray(path) && path.length === 1 && typeof path[0] === "number" && Number.isInteger(path[0])) {
|
|
7400
7457
|
parsedPaths.push(`[${path[0]}]`);
|
|
7401
7458
|
} else {
|
|
7402
|
-
parsedPaths.push(
|
|
7459
|
+
parsedPaths.push(nbtResolver(path).toString());
|
|
7403
7460
|
}
|
|
7404
7461
|
} else if (path !== "") {
|
|
7405
7462
|
parsedPaths.push(`${path}${i === paths.length - 1 ? "" : "."}`);
|
|
@@ -7490,6 +7547,7 @@ var init_dependencies = __esm(() => {
|
|
|
7490
7547
|
import * as util4 from "util";
|
|
7491
7548
|
var Node, ContainerNode, CommandNode, ContainerCommandNode, AwaitNode;
|
|
7492
7549
|
var init_nodes = __esm(() => {
|
|
7550
|
+
init_NBTs();
|
|
7493
7551
|
init_utils();
|
|
7494
7552
|
init_Macro();
|
|
7495
7553
|
});
|
|
@@ -7503,34 +7561,6 @@ class FinalCommandOutput {
|
|
|
7503
7561
|
}
|
|
7504
7562
|
|
|
7505
7563
|
|
|
7506
|
-
// src/commands/validators.ts
|
|
7507
|
-
function validateIntegerRange(integer, name, minimum = 0, maximum = 2147483647) {
|
|
7508
|
-
if (typeof integer !== "number") {
|
|
7509
|
-
return integer;
|
|
7510
|
-
}
|
|
7511
|
-
if (integer && integer <= minimum) {
|
|
7512
|
-
throw new Error(`\`${name}\` must be greater than or equal to ${minimum.toLocaleString()}, got \`${integer.toLocaleString()}\`.`);
|
|
7513
|
-
}
|
|
7514
|
-
if (integer && integer >= maximum) {
|
|
7515
|
-
throw new Error(`\`${name}\` must be lower than or equal to ${maximum.toLocaleString()}, got \`${integer.toLocaleString()}\`.`);
|
|
7516
|
-
}
|
|
7517
|
-
return integer;
|
|
7518
|
-
}
|
|
7519
|
-
|
|
7520
|
-
// src/commands/implementations/block/place.ts
|
|
7521
|
-
var PlaceCommandNode, PlaceCommand;
|
|
7522
|
-
var init_place = __esm(() => {
|
|
7523
|
-
init_nodes();
|
|
7524
|
-
init_parsers();
|
|
7525
|
-
});
|
|
7526
|
-
|
|
7527
|
-
// src/commands/implementations/entity/damage.ts
|
|
7528
|
-
var DamageCommandNode, DamageCauseCommand, DamageSourceCommand, DamageCommand;
|
|
7529
|
-
var init_damage = __esm(() => {
|
|
7530
|
-
init_nodes();
|
|
7531
|
-
init_parsers();
|
|
7532
|
-
});
|
|
7533
|
-
|
|
7534
7564
|
// src/commands/implementations/_fake/comment.ts
|
|
7535
7565
|
var CommentCommandNode, CommentCommand;
|
|
7536
7566
|
var init_comment = __esm(() => {
|
|
@@ -7572,6 +7602,27 @@ var init_fill = __esm(() => {
|
|
|
7572
7602
|
init_setblock();
|
|
7573
7603
|
});
|
|
7574
7604
|
|
|
7605
|
+
// src/commands/validators.ts
|
|
7606
|
+
function validateIntegerRange(integer, name, minimum = 0, maximum = 2147483647) {
|
|
7607
|
+
if (typeof integer !== "number") {
|
|
7608
|
+
return integer;
|
|
7609
|
+
}
|
|
7610
|
+
if (integer && integer <= minimum) {
|
|
7611
|
+
throw new Error(`\`${name}\` must be greater than or equal to ${minimum.toLocaleString()}, got \`${integer.toLocaleString()}\`.`);
|
|
7612
|
+
}
|
|
7613
|
+
if (integer && integer >= maximum) {
|
|
7614
|
+
throw new Error(`\`${name}\` must be lower than or equal to ${maximum.toLocaleString()}, got \`${integer.toLocaleString()}\`.`);
|
|
7615
|
+
}
|
|
7616
|
+
return integer;
|
|
7617
|
+
}
|
|
7618
|
+
|
|
7619
|
+
// src/commands/implementations/block/place.ts
|
|
7620
|
+
var PlaceCommandNode, PlaceCommand;
|
|
7621
|
+
var init_place = __esm(() => {
|
|
7622
|
+
init_nodes();
|
|
7623
|
+
init_parsers();
|
|
7624
|
+
});
|
|
7625
|
+
|
|
7575
7626
|
// src/commands/implementations/entity/attribute.ts
|
|
7576
7627
|
var AttributeCommandNode, AttributeCommand, AttributeOperationCommand;
|
|
7577
7628
|
var init_attribute = __esm(() => {
|
|
@@ -7582,10 +7633,18 @@ var init_attribute = __esm(() => {
|
|
|
7582
7633
|
// src/commands/implementations/entity/clear.ts
|
|
7583
7634
|
var ClearCommandNode, ClearCommand;
|
|
7584
7635
|
var init_clear = __esm(() => {
|
|
7636
|
+
init_Macro();
|
|
7585
7637
|
init_nodes();
|
|
7586
7638
|
init_parsers();
|
|
7587
7639
|
});
|
|
7588
7640
|
|
|
7641
|
+
// src/commands/implementations/entity/damage.ts
|
|
7642
|
+
var DamageCommandNode, DamageCauseCommand, DamageSourceCommand, DamageCommand;
|
|
7643
|
+
var init_damage = __esm(() => {
|
|
7644
|
+
init_nodes();
|
|
7645
|
+
init_parsers();
|
|
7646
|
+
});
|
|
7647
|
+
|
|
7589
7648
|
// src/commands/implementations/entity/effect.ts
|
|
7590
7649
|
var EffectCommandNode, EffectCommand;
|
|
7591
7650
|
var init_effect = __esm(() => {
|
|
@@ -7886,14 +7945,13 @@ var init_tag = __esm(() => {
|
|
|
7886
7945
|
|
|
7887
7946
|
// src/core/resources/datapack/mcfunction.ts
|
|
7888
7947
|
import * as util6 from "util";
|
|
7889
|
-
var
|
|
7948
|
+
var MCFunctionNode, _RawMCFunctionClass, MCFunctionClass;
|
|
7890
7949
|
var init_mcfunction = __esm(() => {
|
|
7891
7950
|
init_utils();
|
|
7892
7951
|
init_ResolveNBT();
|
|
7893
7952
|
init_nodes();
|
|
7894
7953
|
init_resource();
|
|
7895
7954
|
init_tag();
|
|
7896
|
-
tags = {};
|
|
7897
7955
|
});
|
|
7898
7956
|
|
|
7899
7957
|
// src/core/resources/datapack/predicate.ts
|
|
@@ -8102,12 +8160,11 @@ var init_shader = __esm(() => {
|
|
|
8102
8160
|
|
|
8103
8161
|
// src/core/resources/resourcepack/sound.ts
|
|
8104
8162
|
import path from "node:path";
|
|
8105
|
-
var
|
|
8163
|
+
var SoundEventNode, SoundEventClass, SoundsNode, SoundsClass;
|
|
8106
8164
|
var init_sound = __esm(() => {
|
|
8107
8165
|
init_arguments();
|
|
8108
8166
|
init_nodes();
|
|
8109
8167
|
init_resource();
|
|
8110
|
-
sounds = new Map;
|
|
8111
8168
|
});
|
|
8112
8169
|
|
|
8113
8170
|
// src/core/resources/resourcepack/text.ts
|
|
@@ -8527,11 +8584,17 @@ class SandstoneCore {
|
|
|
8527
8584
|
_mcMetaCache = false;
|
|
8528
8585
|
_smithed = false;
|
|
8529
8586
|
dependencies = [];
|
|
8587
|
+
functionTags = new Map;
|
|
8588
|
+
sounds = new Map;
|
|
8589
|
+
checkTriggers = {};
|
|
8530
8590
|
constructor(pack) {
|
|
8531
8591
|
this.pack = pack;
|
|
8532
8592
|
this.resourceNodes = new ResourceNodesMap;
|
|
8533
8593
|
this.mcfunctionStack = [];
|
|
8534
8594
|
this.awaitNodes = new Set;
|
|
8595
|
+
this.functionTags = new Map;
|
|
8596
|
+
this.sounds = new Map;
|
|
8597
|
+
this.checkTriggers = {};
|
|
8535
8598
|
for (const method of Object.getOwnPropertyNames(Object.getPrototypeOf(this))) {
|
|
8536
8599
|
if (method !== "constructor" && typeof this[method] === "function" && typeof this[method].bind === "function") {
|
|
8537
8600
|
this[method] = this[method].bind(this);
|
|
@@ -8546,6 +8609,9 @@ class SandstoneCore {
|
|
|
8546
8609
|
this._mcMetaCache = undefined;
|
|
8547
8610
|
this._smithed = undefined;
|
|
8548
8611
|
this.dependencies = [];
|
|
8612
|
+
this.functionTags.clear();
|
|
8613
|
+
this.sounds.clear();
|
|
8614
|
+
this.checkTriggers = {};
|
|
8549
8615
|
};
|
|
8550
8616
|
get currentMCFunction() {
|
|
8551
8617
|
return this.mcfunctionStack[this.mcfunctionStack.length - 1];
|
|
@@ -8699,6 +8765,7 @@ var init_core = __esm(() => {
|
|
|
8699
8765
|
// src/commands/implementations/server/function.ts
|
|
8700
8766
|
var FunctionCommandNode, FunctionCommand;
|
|
8701
8767
|
var init_function = __esm(() => {
|
|
8768
|
+
init_Macro();
|
|
8702
8769
|
init_nodes();
|
|
8703
8770
|
init_NBTs();
|
|
8704
8771
|
});
|
|
@@ -8966,7 +9033,7 @@ function componentPatchStringifier(components) {
|
|
|
8966
9033
|
throw new Error(`Attempted to insert a negation component patch of ${key} with a value, use {} instead.`);
|
|
8967
9034
|
}
|
|
8968
9035
|
} else {
|
|
8969
|
-
resultPairs.push(`${key}=${
|
|
9036
|
+
resultPairs.push(`${key}=${nbtResolver(value).toString()}`);
|
|
8970
9037
|
}
|
|
8971
9038
|
}
|
|
8972
9039
|
return `[${resultPairs.join(",")}]`;
|
|
@@ -9054,6 +9121,7 @@ var init_datapack2 = __esm(() => {
|
|
|
9054
9121
|
var DebugCommandNode, DebugCommand;
|
|
9055
9122
|
var init_debug = __esm(() => {
|
|
9056
9123
|
init_nodes();
|
|
9124
|
+
init_Macro();
|
|
9057
9125
|
});
|
|
9058
9126
|
|
|
9059
9127
|
// src/commands/implementations/server/defaultgamemode.ts
|
|
@@ -9129,6 +9197,7 @@ var init_say = __esm(() => {
|
|
|
9129
9197
|
// src/commands/implementations/server/schedule.ts
|
|
9130
9198
|
var ScheduleCommandNode, ScheduleCommand;
|
|
9131
9199
|
var init_schedule = __esm(() => {
|
|
9200
|
+
init_Macro();
|
|
9132
9201
|
init_nodes();
|
|
9133
9202
|
});
|
|
9134
9203
|
|
|
@@ -9607,10 +9676,7 @@ class SandstoneCommands {
|
|
|
9607
9676
|
}
|
|
9608
9677
|
}
|
|
9609
9678
|
var init_commands = __esm(() => {
|
|
9610
|
-
init_place();
|
|
9611
|
-
init_damage();
|
|
9612
9679
|
init_implementations();
|
|
9613
|
-
init_random();
|
|
9614
9680
|
});
|
|
9615
9681
|
|
|
9616
9682
|
// src/commands/index.ts
|
|
@@ -10514,6 +10580,9 @@ class SandstonePack {
|
|
|
10514
10580
|
this.initMCFunction.push(() => loadStatus(this.defaultNamespace).set(loadVersion));
|
|
10515
10581
|
};
|
|
10516
10582
|
resourceToPath = (name, resourceFolders) => {
|
|
10583
|
+
if (name === "") {
|
|
10584
|
+
throw new Error("A resource name must not be empty!");
|
|
10585
|
+
}
|
|
10517
10586
|
let namespace = this.defaultNamespace;
|
|
10518
10587
|
let fullName = name;
|
|
10519
10588
|
if (name.includes(":")) {
|
|
@@ -10529,6 +10598,11 @@ class SandstonePack {
|
|
|
10529
10598
|
return this.flow;
|
|
10530
10599
|
}
|
|
10531
10600
|
registerNewObjective = (objective) => {
|
|
10601
|
+
for (const obj of this.objectives) {
|
|
10602
|
+
if (obj.name === objective.name) {
|
|
10603
|
+
return;
|
|
10604
|
+
}
|
|
10605
|
+
}
|
|
10532
10606
|
this.objectives.add(objective);
|
|
10533
10607
|
};
|
|
10534
10608
|
registerNewConstant(amount) {
|
|
@@ -10702,7 +10776,7 @@ class SandstonePack {
|
|
|
10702
10776
|
}
|
|
10703
10777
|
this.tickedCommands[runEvery].push(callback);
|
|
10704
10778
|
}
|
|
10705
|
-
sleep = (delay) => new SleepClass(this.core, delay)
|
|
10779
|
+
sleep = (delay) => new SleepClass(this.core, delay);
|
|
10706
10780
|
Loop = () => new LoopArgument(this);
|
|
10707
10781
|
__customResourceTypes = [];
|
|
10708
10782
|
registerCustomResource(type) {
|
|
@@ -50857,13 +50931,13 @@ class TriggerClass {
|
|
|
50857
50931
|
this.objective = new ObjectiveClass(sandstoneCore2.pack, name, "dummy", undefined, { creator: "sandstone" });
|
|
50858
50932
|
const { registerNewObjective, MCFunction, commands: commands2 } = sandstoneCore2.pack;
|
|
50859
50933
|
registerNewObjective(this.objective);
|
|
50860
|
-
if (!checkTriggers[pollingEvery]) {
|
|
50861
|
-
checkTriggers[pollingEvery] = MCFunction(`triggers/check/${pollingEvery}`, {
|
|
50934
|
+
if (!sandstoneCore2.checkTriggers[pollingEvery]) {
|
|
50935
|
+
sandstoneCore2.checkTriggers[pollingEvery] = MCFunction(`triggers/check/${pollingEvery}`, {
|
|
50862
50936
|
creator: "sandstone",
|
|
50863
50937
|
runEvery: pollingEvery
|
|
50864
50938
|
});
|
|
50865
50939
|
}
|
|
50866
|
-
checkTriggers[pollingEvery].push(() => {
|
|
50940
|
+
sandstoneCore2.checkTriggers[pollingEvery].push(() => {
|
|
50867
50941
|
commands2.execute.as(`@a[scores={${name}=1..}]`).run(() => {
|
|
50868
50942
|
const score2 = this.objective("@s");
|
|
50869
50943
|
if (callback instanceof _RawMCFunctionClass || typeof callback === "function") {
|
|
@@ -50879,11 +50953,9 @@ class TriggerClass {
|
|
|
50879
50953
|
}
|
|
50880
50954
|
toString = () => this.name;
|
|
50881
50955
|
}
|
|
50882
|
-
var checkTriggers;
|
|
50883
50956
|
var init_Trigger = __esm(() => {
|
|
50884
50957
|
init_mcfunction();
|
|
50885
50958
|
init_Objective();
|
|
50886
|
-
checkTriggers = {};
|
|
50887
50959
|
});
|
|
50888
50960
|
|
|
50889
50961
|
// src/variables/UUID.ts
|
|
@@ -51505,7 +51577,7 @@ export {
|
|
|
51505
51577
|
particle3 as particle,
|
|
51506
51578
|
parseNBT,
|
|
51507
51579
|
parseJSONText,
|
|
51508
|
-
|
|
51580
|
+
nbtResolver,
|
|
51509
51581
|
msg,
|
|
51510
51582
|
me2 as me,
|
|
51511
51583
|
mcMetaCache2 as mcMetaCache,
|
|
@@ -51811,6 +51883,7 @@ export {
|
|
|
51811
51883
|
ResourcePack,
|
|
51812
51884
|
ResourceNodesMap,
|
|
51813
51885
|
ResourceClass,
|
|
51886
|
+
ResolvedNBT,
|
|
51814
51887
|
ResolveNBTPartClass,
|
|
51815
51888
|
ResolveNBTPart,
|
|
51816
51889
|
ResolveNBTClass,
|
|
@@ -52185,5 +52258,5 @@ export {
|
|
|
52185
52258
|
ACTIVITIES_SET
|
|
52186
52259
|
};
|
|
52187
52260
|
|
|
52188
|
-
//# debugId=
|
|
52261
|
+
//# debugId=CD6B0FD0ECC93B9764756E2164756E21
|
|
52189
52262
|
//# sourceMappingURL=index.js.map
|