sandstone 1.0.1 → 1.0.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.
- package/dist/_internal/index.d.ts +11 -11
- package/dist/_internal/index.d.ts.map +1 -1
- package/dist/_internal/index.js +45 -43
- package/dist/_internal/index.js.map +1 -1
- package/dist/_internal/types/arguments/generated/resources.d.ts +2 -2
- package/dist/_internal/types/arguments/generated/resources.d.ts.map +1 -1
- package/dist/_internal/types/commands/implementations/block/place.d.ts +1 -1
- package/dist/_internal/types/commands/implementations/block/place.d.ts.map +1 -1
- package/dist/_internal/types/commands/implementations/server/schedule.d.ts +1 -1
- package/dist/_internal/types/core/resources/index.d.ts +1 -1
- package/dist/_internal/types/core/resources/resourcepack/blockstate.d.ts +13 -13
- package/dist/_internal/types/core/resources/resourcepack/blockstate.d.ts.map +1 -1
- package/dist/_internal/types/flow/Flow.d.ts +11 -11
- package/dist/_internal/types/flow/loop.d.ts +1 -1
- package/dist/_internal/types/pack/index.d.ts +1 -1
- package/dist/_internal/types/pack/pack.d.ts +7 -7
- package/dist/_internal/types/pack/pack.d.ts.map +1 -1
- package/dist/_internal/types/utils.d.ts +1 -1
- package/dist/_internal/types/utils.d.ts.map +1 -1
- package/dist/_internal/types/variables/Data.d.ts +1 -1
- package/dist/_internal/types/variables/DataSets.d.ts +4 -4
- package/dist/_internal/types/variables/DataSets.d.ts.map +1 -1
- package/dist/_internal/types/variables/ResolveNBT.d.ts +2 -2
- package/dist/browser/sandstone.esm.js +45 -43
- package/dist/browser/sandstone.esm.js.map +1 -1
- package/dist/exports/core/index.d.ts +1 -1
- package/dist/exports/core/index.js +1 -1
- package/dist/exports/index.d.ts +1 -1
- package/dist/exports/index.js +1 -1
- package/dist/exports/variables/index.d.ts +1 -1
- package/dist/exports/variables/index.js +1 -1
- package/package.json +1 -1
- package/src/arguments/generated/resources.ts +2 -2
- package/src/commands/implementations/block/place.ts +1 -1
- package/src/core/resources/datapack/itemModifier.ts +2 -2
- package/src/core/resources/resourcepack/blockstate.ts +32 -32
- package/src/pack/pack.ts +17 -15
- package/src/sandstone.ts +34 -5
- package/src/utils.ts +1 -1
- package/src/variables/DataSets.ts +4 -4
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdvancementClassArguments, AdvancementNode, AtlasClassArguments, AtlasNode, AudibleVariantType, AwaitNode, BannerPatternClassArguments, BannerPatternNode,
|
|
1
|
+
export { AdvancementClassArguments, AdvancementNode, AtlasClassArguments, AtlasNode, AudibleVariantType, AwaitNode, BannerPatternClassArguments, BannerPatternNode, BlockStateDefinitionArguments, BlockStateDefinitionJSON, BlockStateDefinitionNode, BlockStateDefinitionType, CallableResourceClass, ChatTypeClassArguments, ChatTypeNode, CommandNode, ConditionalDataPointPickClass, ContainerCommandNode, ContainerNode, CustomResourceClass, CustomResourceClassArguments, CustomResourceNode, DamageTypeClassArguments, DamageTypeNode, DataPointPickClass, DialogClassArguments, DialogNode, EnchantmentClassArguments, EnchantmentNode, EnchantmentProviderClassArguments, EnchantmentProviderNode, EquipmentClassArguments, EquipmentNode, FontArguments, FontNode, HintedTagStringType, InstrumentClassArguments, InstrumentNode, ItemModelBuilder, ItemModelDefinitionClassArguments, ItemModelDefinitionInput, ItemModelDefinitionNode, ItemModifierClassArguments, ItemModifierNode, JukeboxSongClassArguments, JukeboxSongNode, LanguageArguments, LanguageNode, ListResource, LootTableClassArguments, LootTableNode, MCFunctionClassArguments, MCFunctionNode, MacroArgument, MacroLiteral, Macroable, ModelClassArguments, ModelNode, Node, ParticleClassArguments, ParticleNode, PlainTextArguments, PlainTextClass, PlainTextNode, PostEffectClassArguments, PostEffectNode, PredicateClassArguments, PredicateNode, RecipeClassArguments, RecipeNode, ResourceClass, ResourceClassArguments, ResourceNode, ResourceNodeConstructor, ResourceNodesMap, SandstoneCore, ShaderClass, ShaderClassArguments, ShaderNode, SoundEventArguments, SoundEventNode, SoundsIndexArguments, SoundsIndexNode, StructureClassArguments, StructureNode, TagClassArguments, TagNode, TagSingleValue, TagValuesJSON, TestEnvironmentClassArguments, TestEnvironmentNode, TestInstanceClassArguments, TestInstanceNode, TextureArguments, TextureNode, TimelineClassArguments, TimelineNode, TradeSetClassArguments, TradeSetNode, TrialSpawnerClassArguments, TrialSpawnerNode, TrimMaterialClassArguments, TrimMaterialNode, TrimPatternClassArguments, TrimPatternNode, VariantClassArguments, VariantNode, VariantType, VillagerTradeClassArguments, VillagerTradeNode, WaypointStyleClassArguments, WaypointStyleNode, WorldClockClassArguments, WorldClockNode, _RawMCFunctionClass, isMacroArgument, jsonStringify } from '../../_internal/index.js'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { AdvancementNode, AtlasNode, AwaitNode, BannerPatternNode,
|
|
1
|
+
export { AdvancementNode, AtlasNode, AwaitNode, BannerPatternNode, BlockStateDefinitionNode, CallableResourceClass, ChatTypeNode, CommandNode, ConditionalDataPointPickClass, ContainerCommandNode, ContainerNode, CustomResourceClass, CustomResourceNode, DamageTypeNode, DataPointPickClass, DialogNode, EnchantmentNode, EnchantmentProviderNode, EquipmentNode, FontNode, InstrumentNode, ItemModelBuilder, ItemModelDefinitionNode, ItemModifierNode, JukeboxSongNode, LanguageNode, ListResource, LootTableNode, MCFunctionNode, MacroArgument, MacroLiteral, ModelNode, Node, ParticleNode, PlainTextClass, PlainTextNode, PostEffectNode, PredicateNode, RecipeNode, ResourceClass, ResourceNodesMap, SandstoneCore, ShaderClass, ShaderNode, SoundEventNode, SoundsIndexNode, StructureNode, TagNode, TestEnvironmentNode, TestInstanceNode, TextureNode, TimelineNode, TradeSetNode, TrialSpawnerNode, TrimMaterialNode, TrimPatternNode, VariantNode, VillagerTradeNode, WaypointStyleNode, WorldClockNode, _RawMCFunctionClass, isMacroArgument, jsonStringify } from '../../_internal/index.js'
|
package/dist/exports/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Advancement, AdvancementClass, Atlas, AtlasClass, BannerPattern, BannerPatternClass,
|
|
1
|
+
export { Advancement, AdvancementClass, Atlas, AtlasClass, BannerPattern, BannerPatternClass, BlockStateDefinition, BlockStateDefinitionClass, ChatType, ChatTypeClass, Condition, ContentStrategyKind, DamageType, DamageTypeClass, Data, DataArray, DataIndexMap, DataPointClass, DataVariable, DatapackConfig, Dialog, DialogClass, Enchantment, EnchantmentClass, EnchantmentProvider, EnchantmentProviderClass, Equipment, EquipmentClass, Font, FontClass, HandlerFile, Instrument, InstrumentClass, ItemModelDefinition, ItemModelDefinitionClass, ItemModifier, ItemModifierClass, ItemPredicate, JukeboxSong, JukeboxSongClass, Label, LabelClass, Language, LanguageClass, LiteralUnion, LootTable, LootTableClass, MCFunction, MCFunctionClass, Macro, Model, ModelClass, NBTAllArrays, NBTAllNumberClasses, NBTAllNumbers, NBTAllPrimitives, NBTAllValues, NBTAnyValue, NBTByte, NBTByteArray, NBTClass, NBTDouble, NBTFloat, NBTInt, NBTIntArray, NBTList, NBTLong, NBTLongArray, NBTPrimitive, NBTRange, NBTShort, NBTSimpleClasses, NBTString, NBTTypedArray, NamespacedLiteralUnion, NotNBT, Objective, ObjectiveClass, ParticleClass, ParticleResource, PlainText, PostEffect, PostEffectClass, Predicate, PredicateClass, RawResource, Recipe, RecipeClass, ResolveNBT, ResolveNBTPart, ResolvedNBT, ResourcePackConfig, SandstoneConfig, SandstoneContext, SandstonePack, Score, Selector, SelectorClass, Set, SetType, Shader, SoundEvent, SoundEventClass, SoundsIndex, SoundsIndexClass, StructureClass, Tag, TagClass, TestEnvironment, TestEnvironmentClass, TestInstance, TestInstanceClass, Texture, TextureClass, Timeline, TimelineClass, TradeSet, TradeSetClass, TrialSpawner, TrialSpawnerClass, Trigger, TrimMaterial, TrimMaterialClass, TrimPattern, TrimPatternClass, UUID, UUIDClass, Variable, Variant, VariantClass, VillagerTrade, VillagerTradeClass, WaypointStyle, WaypointStyleClass, WorldClock, WorldClockClass, _, abs, absolute, advancement, attribute, bossbar, clear, clone, comment, createSandstonePack, damage, data, datapack, debug, defaultNamespace, defaultgamemode, depend, dialog, difficulty, effect, enchant, execute, experience, fill, fillbiome, flowVariable, forceload, functionCmd, gamemode, gamerule, getExistingResource, getSandstoneContext, getTempStorage, getVanillaResource, give, hasContext, help, item, jfr, kill, list, loadTags, loc, local, locate, loot, makeCustomResource, mcMetaCache, me, msg, particle, perf, place, playsound, random, randomUUID, raw, recipe, rel, relative, reload, resetContext, resetSandstonePack, returnCmd, ride, rotate, sandstonePack, say, schedule, scoreboard, seed, setSandstoneContext, setblock, setidletimeout, setworldspawn, sleep, spawnpoint, spectate, spreadplayers, stopsound, stopwatch, summon, swing, tag, team, teammsg, teleport, tell, tellraw, test, time, title, tm, tp, transfer, trigger, version, w, waypoint, weather, worldborder, xp } from '../_internal/index.js'
|
package/dist/exports/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Advancement, AdvancementClass, Atlas, AtlasClass, BannerPattern, BannerPatternClass,
|
|
1
|
+
export { Advancement, AdvancementClass, Atlas, AtlasClass, BannerPattern, BannerPatternClass, BlockStateDefinition, BlockStateDefinitionClass, ChatType, ChatTypeClass, DamageType, DamageTypeClass, Data, DataArray, DataIndexMap, DataPointClass, DataVariable, Dialog, DialogClass, Enchantment, EnchantmentClass, EnchantmentProvider, EnchantmentProviderClass, Equipment, EquipmentClass, Font, FontClass, Instrument, InstrumentClass, ItemModelDefinition, ItemModelDefinitionClass, ItemModifier, ItemModifierClass, ItemPredicate, JukeboxSong, JukeboxSongClass, Label, LabelClass, Language, LanguageClass, LootTable, LootTableClass, MCFunction, MCFunctionClass, Macro, Model, ModelClass, NBTAnyValue, NBTByte, NBTByteArray, NBTClass, NBTDouble, NBTFloat, NBTInt, NBTIntArray, NBTLong, NBTLongArray, NBTPrimitive, NBTShort, NBTString, NBTTypedArray, NotNBT, Objective, ObjectiveClass, ParticleClass, ParticleResource, PlainText, PostEffect, PostEffectClass, Predicate, PredicateClass, RawResource, Recipe, RecipeClass, ResolveNBT, ResolveNBTPart, ResolvedNBT, SandstonePack, Score, Selector, SelectorClass, Set, Shader, SoundEvent, SoundEventClass, SoundsIndex, SoundsIndexClass, StructureClass, Tag, TagClass, TestEnvironment, TestEnvironmentClass, TestInstance, TestInstanceClass, Texture, TextureClass, Timeline, TimelineClass, TradeSet, TradeSetClass, TrialSpawner, TrialSpawnerClass, Trigger, TrimMaterial, TrimMaterialClass, TrimPattern, TrimPatternClass, UUID, UUIDClass, Variable, Variant, VariantClass, VillagerTrade, VillagerTradeClass, WaypointStyle, WaypointStyleClass, WorldClock, WorldClockClass, _, abs, absolute, advancement, attribute, bossbar, clear, clone, comment, createSandstonePack, damage, data, datapack, debug, defaultNamespace, defaultgamemode, depend, dialog, difficulty, effect, enchant, execute, experience, fill, fillbiome, flowVariable, forceload, functionCmd, gamemode, gamerule, getExistingResource, getSandstoneContext, getTempStorage, getVanillaResource, give, hasContext, help, item, jfr, kill, list, loadTags, loc, local, locate, loot, makeCustomResource, mcMetaCache, me, msg, particle, perf, place, playsound, random, randomUUID, raw, recipe, rel, relative, reload, resetContext, resetSandstonePack, returnCmd, ride, rotate, sandstonePack, say, schedule, scoreboard, seed, setSandstoneContext, setblock, setidletimeout, setworldspawn, sleep, spawnpoint, spectate, spreadplayers, stopsound, stopwatch, summon, swing, tag, team, teammsg, teleport, tell, tellraw, test, time, title, tm, tp, transfer, trigger, version, w, waypoint, weather, worldborder, xp } from '../_internal/index.js'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ConditionClass, ConditionTextComponentClass, DATA_PATH, DATA_TARGET, DATA_TYPES, DataArrayClass, DataArrayInitial, DataClass, DataIndexMapClass, DataIndexMapInitial, EntityLabel, ItemPredicateClass, ItemPredicateItem, IterableDataClass, JSONTextComponentClass, LoopArgument, NBTpathToString, ResolveEntityValues, ResolveNBTClass, ResolveNBTPartClass, ScoreDisplay, SelectorEntityType, SelectorPickClass, SelectorProperties, SleepClass, StringDataPointClass, StructureMirror, StructureRotation, TargetFor, TargetlessDataClass, TargetlessDataPointClass, TextComponentClass, TriggerClass, TriggerHandler, UUIDOptions, UUIDSource, UUIDinNumber, UUIDinScore, VectorClass, _RawLabelClass, _RawObjectiveClass, coordinatesParser, parseJSONText, parseNBT, rangeParser, rotationParser, sanitizeValue, structureMirrorParser, structureRotationParser, targetParser } from '../../_internal/index.js'
|
|
1
|
+
export { ConditionClass, ConditionTextComponentClass, DATA_PATH, DATA_TARGET, DATA_TYPES, DataArrayClass, DataArrayInitial, DataArrayInternal, DataArrayType, DataClass, DataIndexMapClass, DataIndexMapInitial, DataIndexMapInternal, DataIndexMapType, EntityLabel, ItemPredicateClass, ItemPredicateItem, IterableDataClass, JSONTextComponentClass, LoopArgument, NBT, NBTpathToString, ResolveEntityValues, ResolveNBTClass, ResolveNBTPartClass, ScoreDisplay, SelectorEntityType, SelectorPickClass, SelectorProperties, SleepClass, StringDataPointClass, StructureMirror, StructureRotation, TargetFor, TargetlessDataClass, TargetlessDataPointClass, TextComponentClass, TriggerClass, TriggerHandler, UUIDOptions, UUIDSource, UUIDinNumber, UUIDinScore, VectorClass, _RawLabelClass, _RawObjectiveClass, coordinatesParser, nbtResolver, parseJSONText, parseNBT, rangeParser, rotationParser, sanitizeValue, structureMirrorParser, structureRotationParser, targetParser } from '../../_internal/index.js'
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { ConditionClass, ConditionTextComponentClass, DataArrayClass, DataClass, DataIndexMapClass, EntityLabel, ItemPredicateClass, IterableDataClass, JSONTextComponentClass, LoopArgument, NBTpathToString, ResolveNBTClass, ResolveNBTPartClass, SelectorPickClass, SleepClass, StringDataPointClass, TargetlessDataClass, TargetlessDataPointClass, TextComponentClass, TriggerClass, VectorClass, _RawLabelClass, _RawObjectiveClass, coordinatesParser, parseJSONText, parseNBT, rangeParser, rotationParser, sanitizeValue, structureMirrorParser, structureRotationParser, targetParser } from '../../_internal/index.js'
|
|
1
|
+
export { ConditionClass, ConditionTextComponentClass, DataArrayClass, DataArrayInternal, DataClass, DataIndexMapClass, DataIndexMapInternal, EntityLabel, ItemPredicateClass, IterableDataClass, JSONTextComponentClass, LoopArgument, NBT, NBTpathToString, ResolveNBTClass, ResolveNBTPartClass, SelectorPickClass, SleepClass, StringDataPointClass, TargetlessDataClass, TargetlessDataPointClass, TextComponentClass, TriggerClass, VectorClass, _RawLabelClass, _RawObjectiveClass, coordinatesParser, nbtResolver, parseJSONText, parseNBT, rangeParser, rotationParser, sanitizeValue, structureMirrorParser, structureRotationParser, targetParser } from '../../_internal/index.js'
|
package/package.json
CHANGED
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
VillagerTradeClass,
|
|
25
25
|
WorldClockClass,
|
|
26
26
|
AtlasClass,
|
|
27
|
-
|
|
27
|
+
BlockStateDefinitionClass,
|
|
28
28
|
EquipmentClass,
|
|
29
29
|
FontClass,
|
|
30
30
|
ItemModelDefinitionClass,
|
|
@@ -64,7 +64,7 @@ export const RESOURCE_CLASS_TYPES = [
|
|
|
64
64
|
[VillagerTradeClass, 'villager_trade'],
|
|
65
65
|
[WorldClockClass, 'world_clock'],
|
|
66
66
|
[AtlasClass, 'atlas'],
|
|
67
|
-
[
|
|
67
|
+
[BlockStateDefinitionClass, 'block_definition'],
|
|
68
68
|
[EquipmentClass, 'equipment'],
|
|
69
69
|
[FontClass, 'font'],
|
|
70
70
|
[ItemModelDefinitionClass, 'item_definition'],
|
|
@@ -26,7 +26,7 @@ export class PlaceCommand<MACRO extends boolean> extends CommandArguments {
|
|
|
26
26
|
* @param pos Optional. Where the placement should be tried.
|
|
27
27
|
*/
|
|
28
28
|
feature = (
|
|
29
|
-
feature: Macroable<Registry['minecraft:worldgen/
|
|
29
|
+
feature: Macroable<Registry['minecraft:worldgen/feature'], MACRO>,
|
|
30
30
|
pos: Macroable<Coordinates<MACRO>, MACRO> = '~ ~ ~' as Coordinates<MACRO>,
|
|
31
31
|
) => this.finalCommand(['feature', feature, coordinatesParser(pos)])
|
|
32
32
|
|
|
@@ -63,7 +63,7 @@ export class ItemModifierClass extends ResourceClass<ItemModifierNode> implement
|
|
|
63
63
|
}
|
|
64
64
|
|
|
65
65
|
for (const modifier of modifiers) {
|
|
66
|
-
let modifierJSON:
|
|
66
|
+
let modifierJSON: any
|
|
67
67
|
if (modifier instanceof ItemModifierClass) {
|
|
68
68
|
modifierJSON = modifier.itemModifierJSON
|
|
69
69
|
} else {
|
|
@@ -83,7 +83,7 @@ export class ItemModifierClass extends ResourceClass<ItemModifierNode> implement
|
|
|
83
83
|
}
|
|
84
84
|
|
|
85
85
|
for (const modifier of modifiers) {
|
|
86
|
-
let modifierJSON:
|
|
86
|
+
let modifierJSON: any
|
|
87
87
|
if (modifier instanceof ItemModifierClass) {
|
|
88
88
|
modifierJSON = modifier.itemModifierJSON
|
|
89
89
|
} else {
|
|
@@ -6,115 +6,115 @@ import type { ListResource, ResourceClassArguments, ResourceNode } from '../reso
|
|
|
6
6
|
import { ResourceClass, jsonStringify } from '../resource'
|
|
7
7
|
import type { AllKeys } from 'sandstone/utils'
|
|
8
8
|
|
|
9
|
-
export type
|
|
10
|
-
export type
|
|
9
|
+
export type BlockStateDefinitionJSON = NonNullable<MCDocToJSON<SymbolResource['block_definition']>>
|
|
10
|
+
export type BlockStateDefinitionType = AllKeys<BlockStateDefinitionJSON>
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
|
-
* A node representing a Minecraft block state.
|
|
13
|
+
* A node representing a Minecraft block state definition.
|
|
14
14
|
*/
|
|
15
|
-
export class
|
|
15
|
+
export class BlockStateDefinitionNode<JSON extends BlockStateDefinitionJSON>
|
|
16
16
|
extends ContainerNode
|
|
17
|
-
implements ResourceNode<
|
|
17
|
+
implements ResourceNode<BlockStateDefinitionClass<JSON>> {
|
|
18
18
|
constructor(
|
|
19
19
|
sandstoneCore: SandstoneCore,
|
|
20
|
-
public resource:
|
|
20
|
+
public resource: BlockStateDefinitionClass<JSON>,
|
|
21
21
|
) {
|
|
22
22
|
super(sandstoneCore)
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
getValue = () => jsonStringify(this.resource.
|
|
25
|
+
getValue = () => jsonStringify(this.resource.blockStateDefinitionJSON, this.resource._resourceType as keyof typeof RESOURCE_PATHS)
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
export type
|
|
28
|
+
export type BlockStateDefinitionArguments<JSON extends BlockStateDefinitionJSON> = {
|
|
29
29
|
/**
|
|
30
|
-
* The block state's JSON.
|
|
30
|
+
* The block state definition's JSON.
|
|
31
31
|
*/
|
|
32
32
|
json: JSON
|
|
33
33
|
} & ResourceClassArguments<'list'>
|
|
34
34
|
|
|
35
|
-
export class
|
|
36
|
-
extends ResourceClass<
|
|
35
|
+
export class BlockStateDefinitionClass<JSON extends BlockStateDefinitionJSON, Type = Extract<AllKeys<JSON>, BlockStateDefinitionType>>
|
|
36
|
+
extends ResourceClass<BlockStateDefinitionNode<JSON>>
|
|
37
37
|
implements ListResource {
|
|
38
38
|
static readonly resourceType = 'block_definition'
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
blockStateDefinitionJSON: JSON
|
|
41
41
|
|
|
42
42
|
type: Type
|
|
43
43
|
|
|
44
44
|
constructor(
|
|
45
45
|
core: SandstoneCore,
|
|
46
46
|
name: string,
|
|
47
|
-
args:
|
|
47
|
+
args: BlockStateDefinitionArguments<JSON>,
|
|
48
48
|
) {
|
|
49
49
|
super(
|
|
50
50
|
core,
|
|
51
51
|
{ packType: core.pack.resourcePack() },
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
core.pack.resourceToPath(name, RESOURCE_PATHS[
|
|
52
|
+
BlockStateDefinitionNode,
|
|
53
|
+
BlockStateDefinitionClass.resourceType,
|
|
54
|
+
core.pack.resourceToPath(name, RESOURCE_PATHS[BlockStateDefinitionClass.resourceType].path),
|
|
55
55
|
args,
|
|
56
56
|
)
|
|
57
57
|
|
|
58
|
-
this.
|
|
58
|
+
this.blockStateDefinitionJSON = args.json
|
|
59
59
|
|
|
60
|
-
this.type = Object.keys(this.
|
|
60
|
+
this.type = Object.keys(this.blockStateDefinitionJSON)[0] as Type
|
|
61
61
|
|
|
62
62
|
this.handleConflicts()
|
|
63
63
|
}
|
|
64
64
|
|
|
65
|
-
push(...states:
|
|
65
|
+
push(...states: BlockStateDefinitionClass<any, Type>[] | BlockStateDefinitionJSON[]) {
|
|
66
66
|
if (this.type === 'variants') {
|
|
67
|
-
if (states[0] instanceof
|
|
67
|
+
if (states[0] instanceof BlockStateDefinitionClass) {
|
|
68
68
|
for (const state of states) {
|
|
69
69
|
/** @ts-ignore */
|
|
70
|
-
this.
|
|
70
|
+
this.blockStateDefinitionJSON.variants = { ...this.blockStateDefinitionJSON.variants, ...state.blockStateDefinitionJSON.variants }
|
|
71
71
|
}
|
|
72
72
|
} else {
|
|
73
73
|
for (const state of states) {
|
|
74
74
|
/** @ts-ignore */
|
|
75
|
-
this.
|
|
75
|
+
this.blockStateDefinitionJSON.variants = { ...this.blockStateDefinitionJSON.variants, ...state.variants }
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
78
|
}
|
|
79
79
|
if (this.type === 'multipart') {
|
|
80
|
-
if (states[0] instanceof
|
|
80
|
+
if (states[0] instanceof BlockStateDefinitionClass) {
|
|
81
81
|
for (const state of states) {
|
|
82
82
|
/** @ts-ignore */
|
|
83
|
-
this.
|
|
83
|
+
this.blockStateDefinitionJSON.multipart.push(...state.blockStateDefinitionJSON.multipart)
|
|
84
84
|
}
|
|
85
85
|
} else {
|
|
86
86
|
for (const state of states) {
|
|
87
87
|
/** @ts-ignore */
|
|
88
|
-
this.
|
|
88
|
+
this.blockStateDefinitionJSON.multipart.push(...state.multipart)
|
|
89
89
|
}
|
|
90
90
|
}
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
|
|
94
|
-
unshift(...states:
|
|
94
|
+
unshift(...states: BlockStateDefinitionClass<any, Type>[] | BlockStateDefinitionJSON[]) {
|
|
95
95
|
if (this.type === 'variants') {
|
|
96
|
-
if (states[0] instanceof
|
|
96
|
+
if (states[0] instanceof BlockStateDefinitionClass) {
|
|
97
97
|
for (const state of states) {
|
|
98
98
|
/** @ts-ignore */
|
|
99
|
-
this.
|
|
99
|
+
this.blockStateDefinitionJSON.variants = { ...state.blockStateDefinitionJSON.variants, ...this.blockStateDefinitionJSON.variants }
|
|
100
100
|
}
|
|
101
101
|
} else {
|
|
102
102
|
for (const state of states) {
|
|
103
103
|
/** @ts-ignore */
|
|
104
|
-
this.
|
|
104
|
+
this.blockStateDefinitionJSON.variants = { ...state.variants, ...this.blockStateDefinitionJSON.variants }
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
if (this.type === 'multipart') {
|
|
109
|
-
if (states[0] instanceof
|
|
109
|
+
if (states[0] instanceof BlockStateDefinitionClass) {
|
|
110
110
|
for (const state of states) {
|
|
111
111
|
/** @ts-ignore */
|
|
112
|
-
this.
|
|
112
|
+
this.blockStateDefinitionJSON.multipart.unshift(...state.blockStateDefinitionJSON.multipart)
|
|
113
113
|
}
|
|
114
114
|
} else {
|
|
115
115
|
for (const state of states) {
|
|
116
116
|
/** @ts-ignore */
|
|
117
|
-
this.
|
|
117
|
+
this.blockStateDefinitionJSON.multipart.unshift(...state.multipart)
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
}
|
package/src/pack/pack.ts
CHANGED
|
@@ -24,8 +24,8 @@ import type {
|
|
|
24
24
|
AdvancementClassArguments,
|
|
25
25
|
AtlasClassArguments,
|
|
26
26
|
BannerPatternClassArguments,
|
|
27
|
-
|
|
28
|
-
|
|
27
|
+
BlockStateDefinitionArguments,
|
|
28
|
+
BlockStateDefinitionJSON,
|
|
29
29
|
ChatTypeClassArguments,
|
|
30
30
|
DamageTypeClassArguments,
|
|
31
31
|
DataPointPickClass,
|
|
@@ -73,7 +73,7 @@ import {
|
|
|
73
73
|
AdvancementClass,
|
|
74
74
|
AtlasClass,
|
|
75
75
|
BannerPatternClass,
|
|
76
|
-
|
|
76
|
+
BlockStateDefinitionClass,
|
|
77
77
|
ChatTypeClass,
|
|
78
78
|
DamageTypeClass,
|
|
79
79
|
DialogClass,
|
|
@@ -134,9 +134,11 @@ import type {
|
|
|
134
134
|
} from 'sandstone/variables'
|
|
135
135
|
import {
|
|
136
136
|
coordinatesParser,
|
|
137
|
-
|
|
137
|
+
DataArrayType,
|
|
138
|
+
DataArrayInternal,
|
|
138
139
|
DataClass,
|
|
139
|
-
|
|
140
|
+
DataIndexMapType,
|
|
141
|
+
DataIndexMapInternal,
|
|
140
142
|
DataPointClass,
|
|
141
143
|
ItemPredicateClass,
|
|
142
144
|
LabelClass,
|
|
@@ -310,11 +312,11 @@ export class SandstonePack {
|
|
|
310
312
|
}
|
|
311
313
|
return {
|
|
312
314
|
datapack: {
|
|
313
|
-
packFormat:
|
|
315
|
+
packFormat: 111,
|
|
314
316
|
description: 'A Sandstone datapack',
|
|
315
317
|
},
|
|
316
318
|
resourcepack: {
|
|
317
|
-
packFormat:
|
|
319
|
+
packFormat: 92,
|
|
318
320
|
description: 'A Sandstone resource pack',
|
|
319
321
|
},
|
|
320
322
|
}
|
|
@@ -440,7 +442,7 @@ export class SandstonePack {
|
|
|
440
442
|
let pack = this.packTypes.get('datapack') as DataPack
|
|
441
443
|
|
|
442
444
|
if (!pack) {
|
|
443
|
-
const options = this.packOptions.datapack ?? { packFormat:
|
|
445
|
+
const options = this.packOptions.datapack ?? { packFormat: 111, description: 'A Sandstone datapack' }
|
|
444
446
|
pack = this.packTypes.set('datapack', new DataPack(false, options)).get('datapack') as DataPack
|
|
445
447
|
}
|
|
446
448
|
|
|
@@ -451,7 +453,7 @@ export class SandstonePack {
|
|
|
451
453
|
let pack = this.packTypes.get('resourcepack') as ResourcePack
|
|
452
454
|
|
|
453
455
|
if (!pack) {
|
|
454
|
-
const options = this.packOptions.resourcepack ?? { packFormat:
|
|
456
|
+
const options = this.packOptions.resourcepack ?? { packFormat: 92, description: 'A Sandstone resource pack' }
|
|
455
457
|
pack = this.packTypes
|
|
456
458
|
.set('resourcepack', new ResourcePack(options))
|
|
457
459
|
.get('resourcepack') as ResourcePack
|
|
@@ -826,14 +828,14 @@ export class SandstonePack {
|
|
|
826
828
|
initialize: INITIAL,
|
|
827
829
|
dataPoint?: DataPointClass<'storage'>,
|
|
828
830
|
) {
|
|
829
|
-
return
|
|
831
|
+
return DataIndexMapInternal(this, initialize, dataPoint) as DataIndexMapType<INITIAL>
|
|
830
832
|
}
|
|
831
833
|
|
|
832
834
|
DataArray<INITIAL extends readonly NBTObject[] | readonly [string, DataPointClass | DataPointPickClass]>(
|
|
833
835
|
initialize: INITIAL,
|
|
834
836
|
dataPoint?: DataPointClass<'storage'>,
|
|
835
837
|
) {
|
|
836
|
-
return
|
|
838
|
+
return DataArrayInternal(this, initialize, dataPoint) as DataArrayType<INITIAL>
|
|
837
839
|
}
|
|
838
840
|
|
|
839
841
|
getTempStorage = (name: string) => {
|
|
@@ -1333,16 +1335,16 @@ export class SandstonePack {
|
|
|
1333
1335
|
...options,
|
|
1334
1336
|
})
|
|
1335
1337
|
|
|
1336
|
-
|
|
1338
|
+
BlockStateDefinition<JSON extends BlockStateDefinitionJSON>(
|
|
1337
1339
|
name: string,
|
|
1338
1340
|
json: JSON,
|
|
1339
|
-
options?: Omit<Partial<
|
|
1341
|
+
options?: Omit<Partial<BlockStateDefinitionArguments<JSON>>, 'json'>,
|
|
1340
1342
|
) {
|
|
1341
|
-
return new
|
|
1343
|
+
return new BlockStateDefinitionClass(this.core, name, {
|
|
1342
1344
|
json,
|
|
1343
1345
|
creator: 'user',
|
|
1344
1346
|
addToSandstoneCore: true,
|
|
1345
|
-
onConflict: conflictDefaults('
|
|
1347
|
+
onConflict: conflictDefaults('block_definition') as BlockStateDefinitionArguments<JSON>['onConflict'],
|
|
1346
1348
|
...options,
|
|
1347
1349
|
})
|
|
1348
1350
|
}
|
package/src/sandstone.ts
CHANGED
|
@@ -5,7 +5,7 @@ import type {
|
|
|
5
5
|
AdvancementClassArguments,
|
|
6
6
|
AtlasClassArguments,
|
|
7
7
|
BannerPatternClassArguments,
|
|
8
|
-
|
|
8
|
+
BlockStateDefinitionArguments,
|
|
9
9
|
ChatTypeClassArguments,
|
|
10
10
|
DamageTypeClassArguments,
|
|
11
11
|
DialogClassArguments,
|
|
@@ -314,7 +314,7 @@ export const {
|
|
|
314
314
|
WorldClock,
|
|
315
315
|
|
|
316
316
|
Atlas,
|
|
317
|
-
|
|
317
|
+
BlockStateDefinition,
|
|
318
318
|
Equipment,
|
|
319
319
|
Font,
|
|
320
320
|
ItemModelDefinition,
|
|
@@ -352,7 +352,36 @@ export const {
|
|
|
352
352
|
defaultNamespace,
|
|
353
353
|
} = packMethodsProxy
|
|
354
354
|
|
|
355
|
-
export
|
|
355
|
+
// Explicit re-export (not `export *`) so the library builder can hoist
|
|
356
|
+
// these as top-level imports in the bundled main. Wildcard re-exports
|
|
357
|
+
// make it impossible for the bundler to know which names need to be
|
|
358
|
+
// imported into the bundled main's scope.
|
|
359
|
+
export {
|
|
360
|
+
NBTAnyValue,
|
|
361
|
+
NBTByte,
|
|
362
|
+
NBTByteArray,
|
|
363
|
+
NBTClass,
|
|
364
|
+
NBTDouble,
|
|
365
|
+
NBTFloat,
|
|
366
|
+
NBTInt,
|
|
367
|
+
NBTIntArray,
|
|
368
|
+
NBTList,
|
|
369
|
+
NBTLong,
|
|
370
|
+
NBTLongArray,
|
|
371
|
+
NBTPrimitive,
|
|
372
|
+
NBTRange,
|
|
373
|
+
NBTShort,
|
|
374
|
+
NBTString,
|
|
375
|
+
NBTTypedArray,
|
|
376
|
+
NotNBT,
|
|
377
|
+
ResolvedNBT,
|
|
378
|
+
type NBTAllArrays,
|
|
379
|
+
type NBTAllNumberClasses,
|
|
380
|
+
type NBTAllNumbers,
|
|
381
|
+
type NBTAllPrimitives,
|
|
382
|
+
type NBTAllValues,
|
|
383
|
+
type NBTSimpleClasses,
|
|
384
|
+
} from './variables/nbt/NBTs'
|
|
356
385
|
|
|
357
386
|
export type { Condition } from './flow'
|
|
358
387
|
export {
|
|
@@ -398,7 +427,7 @@ export {
|
|
|
398
427
|
|
|
399
428
|
// Resourcepack resources
|
|
400
429
|
AtlasClass,
|
|
401
|
-
|
|
430
|
+
BlockStateDefinitionClass,
|
|
402
431
|
EquipmentClass,
|
|
403
432
|
FontClass,
|
|
404
433
|
ItemModelDefinitionClass,
|
|
@@ -769,7 +798,7 @@ type ContentStrategy =
|
|
|
769
798
|
* The conflict strategy to use for Block states.
|
|
770
799
|
* Will override the defined `default` strategy.
|
|
771
800
|
*/
|
|
772
|
-
| ContentStrategyKind<'
|
|
801
|
+
| ContentStrategyKind<'block_definition', NonNullable<BlockStateDefinitionArguments<any>['onConflict']>>
|
|
773
802
|
/**
|
|
774
803
|
* The conflict strategy to use for Fonts.
|
|
775
804
|
* Will override the defined `default` strategy.
|
package/src/utils.ts
CHANGED
|
@@ -456,7 +456,7 @@ export class DataArrayClass<INITIAL extends DataArrayInitial> extends IterableDa
|
|
|
456
456
|
}
|
|
457
457
|
}
|
|
458
458
|
|
|
459
|
-
export function
|
|
459
|
+
export function DataIndexMapInternal<INITIAL extends DataIndexMapInitial>(
|
|
460
460
|
pack: SandstonePack,
|
|
461
461
|
initialize: INITIAL,
|
|
462
462
|
dataPoint?: DataPointClass<'storage'>,
|
|
@@ -486,11 +486,11 @@ export function DataIndexMap<INITIAL extends DataIndexMapInitial>(
|
|
|
486
486
|
}
|
|
487
487
|
}
|
|
488
488
|
|
|
489
|
-
export type
|
|
489
|
+
export type DataIndexMapType<INITIAL extends DataIndexMapInitial> = DataIndexMapClass<INITIAL> & {
|
|
490
490
|
[K in keyof INITIAL]: DataIndexMapInitial[`${any}${string}`]
|
|
491
491
|
} & { [K in string]: DataIndexMapInitial[`${any}${string}`] }
|
|
492
492
|
|
|
493
|
-
export function
|
|
493
|
+
export function DataArrayInternal<INITIAL extends DataArrayInitial>(
|
|
494
494
|
pack: SandstonePack,
|
|
495
495
|
initialize: INITIAL,
|
|
496
496
|
dataPoint?: DataPointClass<'storage'>,
|
|
@@ -520,6 +520,6 @@ export function DataArray<INITIAL extends DataArrayInitial>(
|
|
|
520
520
|
}
|
|
521
521
|
}
|
|
522
522
|
|
|
523
|
-
export type
|
|
523
|
+
export type DataArrayType<INITIAL extends DataArrayInitial> = DataArrayClass<INITIAL> & {
|
|
524
524
|
[K in keyof INITIAL]: DataArrayInitial[number]
|
|
525
525
|
} & { [K in number]: DataArrayInitial[number] }
|