sandstone 1.1.2 → 1.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/_internal/index.d.ts +7 -15
  2. package/dist/_internal/index.d.ts.map +1 -1
  3. package/dist/_internal/index.js +43 -41
  4. package/dist/_internal/index.js.map +1 -1
  5. package/dist/_internal/types/arguments/coords.d.ts +6 -8
  6. package/dist/_internal/types/arguments/coords.d.ts.map +1 -1
  7. package/dist/_internal/types/arguments/generated/resources.d.ts +2 -2
  8. package/dist/_internal/types/arguments/generated/resources.d.ts.map +1 -1
  9. package/dist/_internal/types/commands/implementations/block/fill.d.ts +3 -2
  10. package/dist/_internal/types/commands/implementations/block/fill.d.ts.map +1 -1
  11. package/dist/_internal/types/commands/implementations/block/place.d.ts +1 -1
  12. package/dist/_internal/types/commands/implementations/block/place.d.ts.map +1 -1
  13. package/dist/_internal/types/commands/implementations/block/setblock.d.ts +34 -30
  14. package/dist/_internal/types/commands/implementations/block/setblock.d.ts.map +1 -1
  15. package/dist/_internal/types/commands/implementations/entity/execute.d.ts +3 -3
  16. package/dist/_internal/types/commands/implementations/entity/execute.d.ts.map +1 -1
  17. package/dist/_internal/types/commands/implementations/entity/summon.d.ts +2 -1
  18. package/dist/_internal/types/commands/implementations/entity/summon.d.ts.map +1 -1
  19. package/dist/_internal/types/commands/implementations/server/schedule.d.ts +1 -1
  20. package/dist/_internal/types/core/resources/index.d.ts +1 -1
  21. package/dist/_internal/types/core/resources/resourcepack/blockstate.d.ts +13 -13
  22. package/dist/_internal/types/core/resources/resourcepack/blockstate.d.ts.map +1 -1
  23. package/dist/_internal/types/flow/Flow.d.ts +11 -11
  24. package/dist/_internal/types/flow/loop.d.ts +1 -1
  25. package/dist/_internal/types/pack/index.d.ts +1 -1
  26. package/dist/_internal/types/pack/pack.d.ts +7 -7
  27. package/dist/_internal/types/pack/pack.d.ts.map +1 -1
  28. package/dist/_internal/types/utils.d.ts +1 -0
  29. package/dist/_internal/types/utils.d.ts.map +1 -1
  30. package/dist/_internal/types/variables/Data.d.ts +1 -1
  31. package/dist/_internal/types/variables/DataSets.d.ts +4 -4
  32. package/dist/_internal/types/variables/DataSets.d.ts.map +1 -1
  33. package/dist/_internal/types/variables/ResolveNBT.d.ts +2 -2
  34. package/dist/browser/sandstone.esm.js +43 -41
  35. package/dist/browser/sandstone.esm.js.map +1 -1
  36. package/dist/exports/core/index.d.ts +1 -1
  37. package/dist/exports/core/index.js +1 -1
  38. package/dist/exports/index.d.ts +1 -1
  39. package/dist/exports/index.js +1 -1
  40. package/dist/exports/variables/index.d.ts +1 -1
  41. package/dist/exports/variables/index.js +1 -1
  42. package/package.json +1 -1
  43. package/src/arguments/coords.ts +6 -12
  44. package/src/arguments/generated/resources.ts +2 -2
  45. package/src/commands/implementations/block/fill.ts +7 -3
  46. package/src/commands/implementations/block/place.ts +1 -1
  47. package/src/commands/implementations/block/setblock.ts +39 -32
  48. package/src/commands/implementations/entity/execute.ts +6 -4
  49. package/src/commands/implementations/entity/summon.ts +2 -1
  50. package/src/core/resources/datapack/itemModifier.ts +2 -2
  51. package/src/core/resources/resourcepack/blockstate.ts +32 -32
  52. package/src/pack/pack.ts +17 -37
  53. package/src/sandstone.ts +4 -20
  54. package/src/utils.ts +3 -1
  55. package/src/variables/DataSets.ts +4 -4
  56. package/src/core/resources/datapack/decoratedPotPattern.ts.disable +0 -47
  57. package/src/core/resources/datapack/slotSource.ts.disable +0 -47
package/src/pack/pack.ts CHANGED
@@ -24,12 +24,11 @@ import type {
24
24
  AdvancementClassArguments,
25
25
  AtlasClassArguments,
26
26
  BannerPatternClassArguments,
27
- BlockStateArguments,
28
- BlockStateJSON,
27
+ BlockStateDefinitionArguments,
28
+ BlockStateDefinitionJSON,
29
29
  ChatTypeClassArguments,
30
30
  DamageTypeClassArguments,
31
31
  DataPointPickClass,
32
- // DecoratedPotPatternClassArguments,
33
32
  DialogClassArguments,
34
33
  EnchantmentClassArguments,
35
34
  EnchantmentProviderClassArguments,
@@ -52,7 +51,6 @@ import type {
52
51
  PredicateClassArguments,
53
52
  RecipeClassArguments,
54
53
  ShaderClassArguments,
55
- // SlotSourceClassArguments,
56
54
  SoundEventArguments,
57
55
  SoundsIndexArguments,
58
56
  SulfurCubeArchetypeClassArguments,
@@ -76,10 +74,9 @@ import {
76
74
  AdvancementClass,
77
75
  AtlasClass,
78
76
  BannerPatternClass,
79
- BlockStateClass,
77
+ BlockStateDefinitionClass,
80
78
  ChatTypeClass,
81
79
  DamageTypeClass,
82
- // DecoratedPotPatternClass,
83
80
  DialogClass,
84
81
  EnchantmentClass,
85
82
  EnchantmentProviderClass,
@@ -102,7 +99,6 @@ import {
102
99
  RecipeClass,
103
100
  SandstoneCore,
104
101
  ShaderClass,
105
- // SlotSourceClass,
106
102
  SoundEventClass,
107
103
  SoundsIndexClass,
108
104
  SulfurCubeArchetypeClass,
@@ -140,9 +136,11 @@ import type {
140
136
  } from 'sandstone/variables'
141
137
  import {
142
138
  coordinatesParser,
143
- DataArray,
139
+ DataArrayType,
140
+ DataArrayInternal,
144
141
  DataClass,
145
- DataIndexMap,
142
+ DataIndexMapType,
143
+ DataIndexMapInternal,
146
144
  DataPointClass,
147
145
  ItemPredicateClass,
148
146
  LabelClass,
@@ -316,11 +314,11 @@ export class SandstonePack {
316
314
  }
317
315
  return {
318
316
  datapack: {
319
- packFormat: 61,
317
+ packFormat: 111,
320
318
  description: 'A Sandstone datapack',
321
319
  },
322
320
  resourcepack: {
323
- packFormat: 46,
321
+ packFormat: 92,
324
322
  description: 'A Sandstone resource pack',
325
323
  },
326
324
  }
@@ -446,7 +444,7 @@ export class SandstonePack {
446
444
  let pack = this.packTypes.get('datapack') as DataPack
447
445
 
448
446
  if (!pack) {
449
- const options = this.packOptions.datapack ?? { packFormat: 98, description: 'A Sandstone datapack' }
447
+ const options = this.packOptions.datapack ?? { packFormat: 111, description: 'A Sandstone datapack' }
450
448
  pack = this.packTypes.set('datapack', new DataPack(false, options)).get('datapack') as DataPack
451
449
  }
452
450
 
@@ -457,7 +455,7 @@ export class SandstonePack {
457
455
  let pack = this.packTypes.get('resourcepack') as ResourcePack
458
456
 
459
457
  if (!pack) {
460
- const options = this.packOptions.resourcepack ?? { packFormat: 79, description: 'A Sandstone resource pack' }
458
+ const options = this.packOptions.resourcepack ?? { packFormat: 92, description: 'A Sandstone resource pack' }
461
459
  pack = this.packTypes
462
460
  .set('resourcepack', new ResourcePack(options))
463
461
  .get('resourcepack') as ResourcePack
@@ -832,14 +830,14 @@ export class SandstonePack {
832
830
  initialize: INITIAL,
833
831
  dataPoint?: DataPointClass<'storage'>,
834
832
  ) {
835
- return DataIndexMap(this, initialize, dataPoint) as DataIndexMap<INITIAL>
833
+ return DataIndexMapInternal(this, initialize, dataPoint) as DataIndexMapType<INITIAL>
836
834
  }
837
835
 
838
836
  DataArray<INITIAL extends readonly NBTObject[] | readonly [string, DataPointClass | DataPointPickClass]>(
839
837
  initialize: INITIAL,
840
838
  dataPoint?: DataPointClass<'storage'>,
841
839
  ) {
842
- return DataArray(this, initialize, dataPoint) as DataArray<INITIAL>
840
+ return DataArrayInternal(this, initialize, dataPoint) as DataArrayType<INITIAL>
843
841
  }
844
842
 
845
843
  getTempStorage = (name: string) => {
@@ -1123,15 +1121,6 @@ export class SandstonePack {
1123
1121
  ...options,
1124
1122
  })
1125
1123
 
1126
- // DecoratedPotPattern = (name: string, decoratedPotPattern: NonNullable<SymbolResource['decorated_pot_pattern']>, options?: Partial<DecoratedPotPatternClassArguments>) =>
1127
- // new DecoratedPotPatternClass(this.core, name, {
1128
- // json: decoratedPotPattern,
1129
- // creator: 'user',
1130
- // addToSandstoneCore: true,
1131
- // onConflict: conflictDefaults('decorated_pot_pattern') as DecoratedPotPatternClassArguments['onConflict'],
1132
- // ...options,
1133
- // })
1134
-
1135
1124
  ItemModifier = (name: string, itemModifier: ItemModifierClassArguments['json'], options?: Omit<Partial<ItemModifierClassArguments>, 'json'>) =>
1136
1125
  new ItemModifierClass(this.core, name, {
1137
1126
  json: itemModifier,
@@ -1172,15 +1161,6 @@ export class SandstonePack {
1172
1161
  ...options,
1173
1162
  })
1174
1163
 
1175
- // SlotSource = (name: string, slotSource: NonNullable<SymbolResource['slot_source']>, options?: Partial<SlotSourceClassArguments>) =>
1176
- // new SlotSourceClass(this.core, name, {
1177
- // json: slotSource,
1178
- // creator: 'user',
1179
- // addToSandstoneCore: true,
1180
- // onConflict: conflictDefaults('slot_source') as SlotSourceClassArguments['onConflict'],
1181
- // ...options,
1182
- // })
1183
-
1184
1164
  SulfurCubeArchetype = (name: string, sulfurCubeArchetype: SulfurCubeArchetypeClassArguments['json'], options?: Omit<Partial<SulfurCubeArchetypeClassArguments>, 'json'>) =>
1185
1165
  new SulfurCubeArchetypeClass(this.core, name, {
1186
1166
  json: sulfurCubeArchetype,
@@ -1366,16 +1346,16 @@ export class SandstonePack {
1366
1346
  ...options,
1367
1347
  })
1368
1348
 
1369
- BlockState<JSON extends BlockStateJSON>(
1349
+ BlockStateDefinition<JSON extends BlockStateDefinitionJSON>(
1370
1350
  name: string,
1371
1351
  json: JSON,
1372
- options?: Omit<Partial<BlockStateArguments<JSON>>, 'json'>,
1352
+ options?: Omit<Partial<BlockStateDefinitionArguments<JSON>>, 'json'>,
1373
1353
  ) {
1374
- return new BlockStateClass(this.core, name, {
1354
+ return new BlockStateDefinitionClass(this.core, name, {
1375
1355
  json,
1376
1356
  creator: 'user',
1377
1357
  addToSandstoneCore: true,
1378
- onConflict: conflictDefaults('blockstate') as BlockStateArguments<JSON>['onConflict'],
1358
+ onConflict: conflictDefaults('block_definition') as BlockStateDefinitionArguments<JSON>['onConflict'],
1379
1359
  ...options,
1380
1360
  })
1381
1361
  }
package/src/sandstone.ts CHANGED
@@ -5,10 +5,9 @@ import type {
5
5
  AdvancementClassArguments,
6
6
  AtlasClassArguments,
7
7
  BannerPatternClassArguments,
8
- BlockStateArguments,
8
+ BlockStateDefinitionArguments,
9
9
  ChatTypeClassArguments,
10
10
  DamageTypeClassArguments,
11
- // DecoratedPotPatternClassArguments,
12
11
  DialogClassArguments,
13
12
  EnchantmentClassArguments,
14
13
  EnchantmentProviderClassArguments,
@@ -28,7 +27,6 @@ import type {
28
27
  PredicateClassArguments,
29
28
  RecipeClassArguments,
30
29
  ShaderClassArguments,
31
- // SlotSourceClassArguments,
32
30
  SoundEventArguments,
33
31
  SoundsIndexArguments,
34
32
  SulfurCubeArchetypeClassArguments,
@@ -295,7 +293,6 @@ export const {
295
293
  BannerPattern,
296
294
  ChatType,
297
295
  DamageType,
298
- // DecoratedPotPattern,
299
296
  Dialog,
300
297
  Enchantment,
301
298
  EnchantmentProvider,
@@ -305,7 +302,6 @@ export const {
305
302
  LootTable,
306
303
  Predicate,
307
304
  Recipe,
308
- // SlotSource,
309
305
  SulfurCubeArchetype,
310
306
  Tag,
311
307
  TestEnvironment,
@@ -320,7 +316,7 @@ export const {
320
316
  WorldClock,
321
317
 
322
318
  Atlas,
323
- BlockState,
319
+ BlockStateDefinition,
324
320
  Equipment,
325
321
  Font,
326
322
  ItemModelDefinition,
@@ -380,7 +376,6 @@ export {
380
376
  BannerPatternClass,
381
377
  ChatTypeClass,
382
378
  DamageTypeClass,
383
- // DecoratedPotPatternClass,
384
379
  DialogClass,
385
380
  EnchantmentClass,
386
381
  EnchantmentProviderClass,
@@ -390,7 +385,6 @@ export {
390
385
  LootTableClass,
391
386
  PredicateClass,
392
387
  RecipeClass,
393
- // SlotSourceClass,
394
388
  StructureClass,
395
389
  SulfurCubeArchetypeClass,
396
390
  TagClass,
@@ -407,7 +401,7 @@ export {
407
401
 
408
402
  // Resourcepack resources
409
403
  AtlasClass,
410
- BlockStateClass,
404
+ BlockStateDefinitionClass,
411
405
  EquipmentClass,
412
406
  FontClass,
413
407
  ItemModelDefinitionClass,
@@ -673,11 +667,6 @@ type ContentStrategy =
673
667
  * Will override the defined `default` strategy.
674
668
  */
675
669
  | ContentStrategyKind<'recipe', NonNullable<RecipeClassArguments['onConflict']>>
676
- /**
677
- * The conflict strategy to use for Slot sources.
678
- * Will override the defined `default` strategy.
679
- */
680
- // | ContentStrategyKind<'slot_source', NonNullable<SlotSourceClassArguments['onConflict']>>
681
670
  /**
682
671
  * The conflict strategy to use for Sulfur cube archetypes.
683
672
  * Will override the defined `default` strategy.
@@ -713,11 +702,6 @@ type ContentStrategy =
713
702
  * Will override the defined `default` strategy.
714
703
  */
715
704
  | ContentStrategyKind<'chat_type', NonNullable<ChatTypeClassArguments['onConflict']>>
716
- /**
717
- * The conflict strategy to use for Decorated pot patterns.
718
- * Will override the defined `default` strategy.
719
- */
720
- // | ContentStrategyKind<'decorated_pot_pattern', NonNullable<DecoratedPotPatternClassArguments['onConflict']>>
721
705
  /**
722
706
  * The conflict strategy to use for Dialogs.
723
707
  * Will override the defined `default` strategy.
@@ -793,7 +777,7 @@ type ContentStrategy =
793
777
  * The conflict strategy to use for Block states.
794
778
  * Will override the defined `default` strategy.
795
779
  */
796
- | ContentStrategyKind<'block_state', NonNullable<BlockStateArguments<any>['onConflict']>>
780
+ | ContentStrategyKind<'block_definition', NonNullable<BlockStateDefinitionArguments<any>['onConflict']>>
797
781
  /**
798
782
  * The conflict strategy to use for Fonts.
799
783
  * Will override the defined `default` strategy.
package/src/utils.ts CHANGED
@@ -721,4 +721,6 @@ export type SmartRange<Min extends number, Max extends number> = (
721
721
  : ToNegative<PositiveRange<1, Abs<Min>>> | 0 | PositiveRange<1, Max>
722
722
  :
723
723
  PositiveRange<Min, Max>
724
- )
724
+ )
725
+
726
+ export type AllowConst<T> = T | (readonly [T])[0]
@@ -456,7 +456,7 @@ export class DataArrayClass<INITIAL extends DataArrayInitial> extends IterableDa
456
456
  }
457
457
  }
458
458
 
459
- export function DataIndexMap<INITIAL extends DataIndexMapInitial>(
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 DataIndexMap<INITIAL extends DataIndexMapInitial> = DataIndexMapClass<INITIAL> & {
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 DataArray<INITIAL extends DataArrayInitial>(
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 DataArray<INITIAL extends DataArrayInitial> = DataArrayClass<INITIAL> & {
523
+ export type DataArrayType<INITIAL extends DataArrayInitial> = DataArrayClass<INITIAL> & {
524
524
  [K in keyof INITIAL]: DataArrayInitial[number]
525
525
  } & { [K in number]: DataArrayInitial[number] }
@@ -1,47 +0,0 @@
1
- import { RESOURCE_PATHS, type SymbolResource } from 'sandstone/arguments'
2
- import { ContainerNode } from '../../nodes'
3
- import type { SandstoneCore } from '../../sandstoneCore'
4
- import type { ResourceClassArguments, ResourceNode } from '../resource'
5
- import { ResourceClass, jsonStringify } from '../resource'
6
-
7
- /**
8
- * A node representing a Minecraft decorated pot pattern.
9
- */
10
- export class DecoratedPotPatternNode extends ContainerNode implements ResourceNode<DecoratedPotPatternClass> {
11
- constructor(
12
- sandstoneCore: SandstoneCore,
13
- public resource: DecoratedPotPatternClass,
14
- ) {
15
- super(sandstoneCore)
16
- }
17
-
18
- getValue = () => jsonStringify(this.resource.decoratedPotPatternJSON, this.resource._resourceType as keyof typeof RESOURCE_PATHS)
19
- }
20
-
21
- export type DecoratedPotPatternClassArguments = {
22
- /**
23
- * The decorated pot pattern's JSON.
24
- */
25
- json: SymbolResource[(typeof DecoratedPotPatternClass)['resourceType']]
26
- } & ResourceClassArguments<'default'>
27
-
28
- export class DecoratedPotPatternClass extends ResourceClass<DecoratedPotPatternNode> {
29
- static readonly resourceType = 'decorated_pot_pattern' as const
30
-
31
- public decoratedPotPatternJSON: NonNullable<DecoratedPotPatternClassArguments['json']>
32
-
33
- constructor(sandstoneCore: SandstoneCore, name: string, args: DecoratedPotPatternClassArguments) {
34
- super(
35
- sandstoneCore,
36
- { packType: sandstoneCore.pack.dataPack(), extension: 'json' },
37
- DecoratedPotPatternNode,
38
- DecoratedPotPatternClass.resourceType,
39
- sandstoneCore.pack.resourceToPath(name, RESOURCE_PATHS[DecoratedPotPatternClass.resourceType].path),
40
- args,
41
- )
42
-
43
- this.decoratedPotPatternJSON = args.json
44
-
45
- this.handleConflicts()
46
- }
47
- }
@@ -1,47 +0,0 @@
1
- import { RESOURCE_PATHS, type SymbolResource } from 'sandstone/arguments'
2
- import { ContainerNode } from '../../nodes'
3
- import type { SandstoneCore } from '../../sandstoneCore'
4
- import type { ResourceClassArguments, ResourceNode } from '../resource'
5
- import { ResourceClass, jsonStringify } from '../resource'
6
-
7
- /**
8
- * A node representing a Minecraft slot source.
9
- */
10
- export class SlotSourceNode extends ContainerNode implements ResourceNode<SlotSourceClass> {
11
- constructor(
12
- sandstoneCore: SandstoneCore,
13
- public resource: SlotSourceClass,
14
- ) {
15
- super(sandstoneCore)
16
- }
17
-
18
- getValue = () => jsonStringify(this.resource.slotSourceJSON, this.resource._resourceType as keyof typeof RESOURCE_PATHS)
19
- }
20
-
21
- export type SlotSourceClassArguments = {
22
- /**
23
- * The slot source's JSON.
24
- */
25
- json: NonNullable<SymbolResource[(typeof SlotSourceClass)['resourceType']]>
26
- } & ResourceClassArguments<'default'>
27
-
28
- export class SlotSourceClass extends ResourceClass<SlotSourceNode> {
29
- static readonly resourceType = 'slot_source' as const
30
-
31
- public slotSourceJSON: NonNullable<SlotSourceClassArguments['json']>
32
-
33
- constructor(sandstoneCore: SandstoneCore, name: string, args: SlotSourceClassArguments) {
34
- super(
35
- sandstoneCore,
36
- { packType: sandstoneCore.pack.dataPack(), extension: 'json' },
37
- SlotSourceNode,
38
- SlotSourceClass.resourceType,
39
- sandstoneCore.pack.resourceToPath(name, RESOURCE_PATHS[SlotSourceClass.resourceType].path),
40
- args,
41
- )
42
-
43
- this.slotSourceJSON = args.json
44
-
45
- this.handleConflicts()
46
- }
47
- }