@minecraft/server 2.12.0-beta.1.26.60-preview.25 → 2.12.0-beta.1.26.60-preview.28

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 (3) hide show
  1. package/README.md +8 -8
  2. package/index.d.ts +195 -10
  3. package/package.json +19 -19
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # `@minecraft/server`
2
-
3
- Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.
4
-
5
- ## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
6
-
7
- See full documentation for this module here:
8
-
1
+ # `@minecraft/server`
2
+
3
+ Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.
4
+
5
+ ## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
6
+
7
+ See full documentation for this module here:
8
+
9
9
  https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server
package/index.d.ts CHANGED
@@ -48,6 +48,10 @@ export enum AimAssistTargetMode {
48
48
  */
49
49
  export enum BlockComponentTypes {
50
50
  DynamicProperties = 'minecraft:dynamic_properties',
51
+ /**
52
+ * @beta
53
+ */
54
+ EntityStorage = 'minecraft:entity_storage',
51
55
  FluidContainer = 'minecraft:fluid_container',
52
56
  Instrument = 'minecraft:instrument_sound',
53
57
  /**
@@ -3167,11 +3171,13 @@ export type BlockComponentReturnType<T extends string> = T extends keyof BlockCo
3167
3171
 
3168
3172
  export type BlockComponentTypeMap = {
3169
3173
  dynamic_properties: BlockDynamicPropertiesComponent;
3174
+ entity_storage: BlockEntityStorageComponent;
3170
3175
  fluid_container: BlockFluidContainerComponent;
3171
3176
  instrument_sound: BlockInstrumentComponent;
3172
3177
  inventory: BlockInventoryComponent;
3173
3178
  map_color: BlockMapColorComponent;
3174
3179
  'minecraft:dynamic_properties': BlockDynamicPropertiesComponent;
3180
+ 'minecraft:entity_storage': BlockEntityStorageComponent;
3175
3181
  'minecraft:fluid_container': BlockFluidContainerComponent;
3176
3182
  'minecraft:instrument_sound': BlockInstrumentComponent;
3177
3183
  'minecraft:inventory': BlockInventoryComponent;
@@ -5404,6 +5410,181 @@ export class BlockDynamicPropertiesComponent extends BlockComponent {
5404
5410
  totalByteCount(): number;
5405
5411
  }
5406
5412
 
5413
+ /**
5414
+ * @beta
5415
+ * Represents storage for entities associated with a block
5416
+ * entity. This component is available on blocks whose behavior
5417
+ * pack definition enables entity storage with the
5418
+ * `minecraft:block_entity` component. Stored entities are
5419
+ * serialized and removed from the world until they are
5420
+ * released or transferred. A block can store up to four
5421
+ * entities. Entity storage is scoped to the content pack
5422
+ * accessing it.
5423
+ */
5424
+ // @ts-ignore Class inheritance allowed for native defined classes
5425
+ export class BlockEntityStorageComponent extends BlockComponent {
5426
+ private constructor();
5427
+ static readonly componentId = 'minecraft:entity_storage';
5428
+ /**
5429
+ * @remarks
5430
+ * Returns information about the entities stored in this
5431
+ * block's entity storage. The returned entities are not
5432
+ * present in the world while they are stored. Only entities
5433
+ * stored by the current content pack are included.
5434
+ *
5435
+ * @returns
5436
+ * An array of {@link BlockEntityStorageInfo} values containing
5437
+ * the unique ID and definition ID of each stored entity.
5438
+ * Returns an empty array when no entities are stored by the
5439
+ * current content pack.
5440
+ * @throws
5441
+ * Throws if the block entity is invalid or the block's
5442
+ * location is not loaded or is outside the world boundaries.
5443
+ *
5444
+ * {@link Error}
5445
+ *
5446
+ * {@link InvalidBlockComponentError}
5447
+ *
5448
+ * {@link LocationInUnloadedChunkError}
5449
+ *
5450
+ * {@link LocationOutOfWorldBoundariesError}
5451
+ */
5452
+ getEntities(): BlockEntityStorageInfo[];
5453
+ /**
5454
+ * @remarks
5455
+ * Releases a stored entity from this block's entity storage
5456
+ * and spawns it back into the world, at the same location it
5457
+ * was when stored.
5458
+ *
5459
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5460
+ *
5461
+ * @param entityId
5462
+ * The unique ID of the stored entity. Use the value returned
5463
+ * by {@link BlockEntityStorageComponent.store} or the
5464
+ * `uniqueId` property from {@link BlockEntityStorageInfo}.
5465
+ * @returns
5466
+ * The released {@link Entity}. The released entity receives a
5467
+ * new runtime ID.
5468
+ * @throws
5469
+ * Throws if the entity ID is invalid or does not identify an
5470
+ * entity stored by the current content pack, if the stored
5471
+ * entity cannot be loaded or spawned, or if the block entity
5472
+ * is invalid.
5473
+ *
5474
+ * {@link Error}
5475
+ *
5476
+ * {@link InvalidBlockComponentError}
5477
+ *
5478
+ * {@link LocationInUnloadedChunkError}
5479
+ *
5480
+ * {@link LocationOutOfWorldBoundariesError}
5481
+ */
5482
+ release(entityId: string): Entity;
5483
+ /**
5484
+ * @remarks
5485
+ * Returns the number of entities stored in this block's entity
5486
+ * storage by the current content pack.
5487
+ *
5488
+ * @returns
5489
+ * The number of entities stored by the current content pack.
5490
+ * @throws
5491
+ * Throws if the block entity is invalid or the block's
5492
+ * location is not loaded or is outside the world boundaries.
5493
+ *
5494
+ * {@link Error}
5495
+ *
5496
+ * {@link InvalidBlockComponentError}
5497
+ *
5498
+ * {@link LocationInUnloadedChunkError}
5499
+ *
5500
+ * {@link LocationOutOfWorldBoundariesError}
5501
+ */
5502
+ size(): number;
5503
+ /**
5504
+ * @remarks
5505
+ * Serializes and stores an entity in this block's entity
5506
+ * storage. The entity is removed from the world after it is
5507
+ * stored. Only non-player mob entities can be stored. Entities
5508
+ * with passengers or that are passengers cannot be stored.
5509
+ *
5510
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5511
+ *
5512
+ * @param entity
5513
+ * The {@link Entity} to store.
5514
+ * @returns
5515
+ * The unique ID assigned to the stored entity. Keep this ID to
5516
+ * release, transfer, or inspect the stored entity later.
5517
+ * @throws
5518
+ * Throws if the storage is full, the entity is already stored,
5519
+ * the entity cannot be serialized, or the block entity is
5520
+ * invalid.
5521
+ *
5522
+ * {@link Error}
5523
+ *
5524
+ * {@link InvalidBlockComponentError}
5525
+ *
5526
+ * {@link LocationInUnloadedChunkError}
5527
+ *
5528
+ * {@link LocationOutOfWorldBoundariesError}
5529
+ */
5530
+ store(entity: Entity): string;
5531
+ /**
5532
+ * @remarks
5533
+ * Moves a stored entity from this block's entity storage to
5534
+ * the target block's entity storage without releasing it into
5535
+ * the world.
5536
+ *
5537
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5538
+ *
5539
+ * @param entityId
5540
+ * The unique ID of the stored entity. Use the value returned
5541
+ * by {@link BlockEntityStorageComponent.store} or the
5542
+ * `uniqueId` property from {@link BlockEntityStorageInfo}.
5543
+ * @param targetBlock
5544
+ * The target {@link Block} with an entity storage component.
5545
+ * The target block must be in the same dimension as this
5546
+ * block.
5547
+ * @throws
5548
+ * Throws if the entity ID is invalid or not stored by the
5549
+ * current content pack, if the target block is invalid, in
5550
+ * another dimension, lacks entity storage, or is full, or if
5551
+ * the source and target blocks are the same.
5552
+ *
5553
+ * {@link Error}
5554
+ *
5555
+ * {@link InvalidBlockComponentError}
5556
+ *
5557
+ * {@link LocationInUnloadedChunkError}
5558
+ *
5559
+ * {@link LocationOutOfWorldBoundariesError}
5560
+ */
5561
+ transfer(entityId: string, targetBlock: Block): void;
5562
+ }
5563
+
5564
+ /**
5565
+ * @beta
5566
+ * Contains identifying information about an entity stored in a
5567
+ * {@link BlockEntityStorageComponent}. Stored entities are not
5568
+ * present in the world until they are released.
5569
+ */
5570
+ export class BlockEntityStorageInfo {
5571
+ private constructor();
5572
+ /**
5573
+ * @remarks
5574
+ * The entity's definition ID, such as `minecraft:pig`.
5575
+ *
5576
+ */
5577
+ readonly definitionId: string;
5578
+ /**
5579
+ * @remarks
5580
+ * The unique ID of the stored entity. Use this ID with
5581
+ * {@link BlockEntityStorageComponent.release} or
5582
+ * {@link BlockEntityStorageComponent.transfer}.
5583
+ *
5584
+ */
5585
+ readonly uniqueId: string;
5586
+ }
5587
+
5407
5588
  /**
5408
5589
  * Contains information regarding an event that impacts a
5409
5590
  * specific block.
@@ -12252,7 +12433,7 @@ export class EntityIsStunnedComponent extends EntityComponent {
12252
12433
  export class EntityIsTamedComponent extends EntityComponent {
12253
12434
  private constructor();
12254
12435
  /**
12255
- * @beta
12436
+ * @rc
12256
12437
  * @remarks
12257
12438
  * Returns the player that has tamed the entity, or 'undefined'
12258
12439
  * if the entity has no player owner.
@@ -12263,7 +12444,7 @@ export class EntityIsTamedComponent extends EntityComponent {
12263
12444
  */
12264
12445
  readonly tamedToPlayer?: Player;
12265
12446
  /**
12266
- * @beta
12447
+ * @rc
12267
12448
  * @remarks
12268
12449
  * Returns the id of the player that has tamed the entity, or
12269
12450
  * 'undefined' if the entity has no player owner.
@@ -20860,7 +21041,7 @@ export class PoiBlockType {
20860
21041
  * @returns
20861
21042
  * True if the POI conatains the tag; otherwise false.
20862
21043
  */
20863
- has(tag: string): boolean;
21044
+ hasTag(tag: string): boolean;
20864
21045
  }
20865
21046
 
20866
21047
  /**
@@ -22793,10 +22974,11 @@ export class SoundInstance {
22793
22974
  /**
22794
22975
  * @rc
22795
22976
  * @remarks
22796
- * Fades this sound instance from its current volume to the
22797
- * target volume over the specified duration. To fade in from
22798
- * silence, call `setVolume(0.0)` first; to fade out, pass a
22799
- * target volume of `0.0`.
22977
+ * Fades this sound instance from its current volume multiplier
22978
+ * to the target multiplier over the specified duration. Volume
22979
+ * multipliers are relative to the selected sound variant's
22980
+ * volume. To fade in from silence, call `setVolume(0.0)`
22981
+ * first; to fade out, pass a target volume of `0.0`.
22800
22982
  *
22801
22983
  * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
22802
22984
  *
@@ -22804,7 +22986,8 @@ export class SoundInstance {
22804
22986
  * Duration of the fade in seconds. Must be non-negative.
22805
22987
  * Minimum value: 0
22806
22988
  * @param targetVolume
22807
- * Volume to fade to. Must be non-negative.
22989
+ * Volume multiplier to fade to, relative to the selected sound
22990
+ * variant's volume. Must be non-negative.
22808
22991
  * Minimum value: 0
22809
22992
  */
22810
22993
  fade(duration: number, targetVolume: number): void;
@@ -22859,12 +23042,14 @@ export class SoundInstance {
22859
23042
  /**
22860
23043
  * @rc
22861
23044
  * @remarks
22862
- * Sets the volume of this sound instance.
23045
+ * Sets the volume multiplier of this sound instance relative
23046
+ * to the volume of the selected sound variant.
22863
23047
  *
22864
23048
  * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
22865
23049
  *
22866
23050
  * @param volume
22867
- * Volume level between 0.0 and 10.0.
23051
+ * Volume multiplier between 0.0 and 10.0. A value of 1.0 uses
23052
+ * the selected sound variant's volume.
22868
23053
  * Bounds: [0, 10]
22869
23054
  */
22870
23055
  setVolume(volume: number): void;
package/package.json CHANGED
@@ -1,20 +1,20 @@
1
- {
2
- "name": "@minecraft/server",
3
- "version": "2.12.0-beta.1.26.60-preview.25",
4
- "description": "",
5
- "contributors": [
6
- {
7
- "name": "Jake Shirley",
8
- "email": "jake@xbox.com"
9
- },
10
- {
11
- "name": "Mike Ammerlaan",
12
- "email": "mikeam@microsoft.com"
13
- }
14
- ],
15
- "peerDependencies": {
16
- "@minecraft/common": "^1.2.0",
17
- "@minecraft/vanilla-data": ">=1.20.70 || 1.26.60-preview.25"
18
- },
19
- "license": "MIT"
1
+ {
2
+ "name": "@minecraft/server",
3
+ "version": "2.12.0-beta.1.26.60-preview.28",
4
+ "description": "",
5
+ "contributors": [
6
+ {
7
+ "name": "Jake Shirley",
8
+ "email": "jake@xbox.com"
9
+ },
10
+ {
11
+ "name": "Mike Ammerlaan",
12
+ "email": "mikeam@microsoft.com"
13
+ }
14
+ ],
15
+ "peerDependencies": {
16
+ "@minecraft/common": "^1.2.0",
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.26.60-preview.28"
18
+ },
19
+ "license": "MIT"
20
20
  }