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

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 +662 -44
  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
  /**
@@ -87,6 +91,10 @@ export enum BlockComponentTypes {
87
91
  * @beta
88
92
  */
89
93
  RecipeCrafting = 'minecraft:recipe_crafting',
94
+ /**
95
+ * @beta
96
+ */
97
+ RecipeProcessing = 'minecraft:recipe_processing',
90
98
  /**
91
99
  * @remarks
92
100
  * Represents a block that can play a record.
@@ -105,6 +113,10 @@ export enum BlockComponentTypes {
105
113
  *
106
114
  */
107
115
  Sign = 'minecraft:sign',
116
+ /**
117
+ * @beta
118
+ */
119
+ VibrationProperties = 'minecraft:vibration_properties',
108
120
  }
109
121
 
110
122
  /**
@@ -3167,11 +3179,13 @@ export type BlockComponentReturnType<T extends string> = T extends keyof BlockCo
3167
3179
 
3168
3180
  export type BlockComponentTypeMap = {
3169
3181
  dynamic_properties: BlockDynamicPropertiesComponent;
3182
+ entity_storage: BlockEntityStorageComponent;
3170
3183
  fluid_container: BlockFluidContainerComponent;
3171
3184
  instrument_sound: BlockInstrumentComponent;
3172
3185
  inventory: BlockInventoryComponent;
3173
3186
  map_color: BlockMapColorComponent;
3174
3187
  'minecraft:dynamic_properties': BlockDynamicPropertiesComponent;
3188
+ 'minecraft:entity_storage': BlockEntityStorageComponent;
3175
3189
  'minecraft:fluid_container': BlockFluidContainerComponent;
3176
3190
  'minecraft:instrument_sound': BlockInstrumentComponent;
3177
3191
  'minecraft:inventory': BlockInventoryComponent;
@@ -3180,16 +3194,20 @@ export type BlockComponentTypeMap = {
3180
3194
  'minecraft:piston': BlockPistonComponent;
3181
3195
  'minecraft:precipitation_interactions': BlockPrecipitationInteractionsComponent;
3182
3196
  'minecraft:recipe_crafting': BlockRecipeCraftingComponent;
3197
+ 'minecraft:recipe_processing': BlockRecipeProcessingComponent;
3183
3198
  'minecraft:record_player': BlockRecordPlayerComponent;
3184
3199
  'minecraft:redstone_producer': BlockRedstoneProducerComponent;
3185
3200
  'minecraft:sign': BlockSignComponent;
3201
+ 'minecraft:vibration_properties': BlockVibrationPropertiesComponent;
3186
3202
  movable: BlockMovableComponent;
3187
3203
  piston: BlockPistonComponent;
3188
3204
  precipitation_interactions: BlockPrecipitationInteractionsComponent;
3189
3205
  recipe_crafting: BlockRecipeCraftingComponent;
3206
+ recipe_processing: BlockRecipeProcessingComponent;
3190
3207
  record_player: BlockRecordPlayerComponent;
3191
3208
  redstone_producer: BlockRedstoneProducerComponent;
3192
3209
  sign: BlockSignComponent;
3210
+ vibration_properties: BlockVibrationPropertiesComponent;
3193
3211
  };
3194
3212
 
3195
3213
  /**
@@ -4987,6 +5005,28 @@ export class BlockComponentNamedTickEvent extends BlockEvent {
4987
5005
  isName(eventName: string): boolean;
4988
5006
  }
4989
5007
 
5008
+ /**
5009
+ * @beta
5010
+ * Contains information regarding neighboring block changes for
5011
+ * a specific block.
5012
+ */
5013
+ // @ts-ignore Class inheritance allowed for native defined classes
5014
+ export class BlockComponentNeighborChangedAfterEvent extends BlockEvent {
5015
+ private constructor();
5016
+ /**
5017
+ * @remarks
5018
+ * Returns the neighboring block changes for this event.
5019
+ *
5020
+ * @returns
5021
+ * One entry for each neighboring direction that changed,
5022
+ * ordered by when each direction first changed. If a direction
5023
+ * changed multiple times during the tick, the entry contains
5024
+ * the permutation before the first change and after the last
5025
+ * change. Intermediate permutations are not included.
5026
+ */
5027
+ getChanges(): NeighborChange[];
5028
+ }
5029
+
4990
5030
  /**
4991
5031
  * Contains information regarding a specific block that was
4992
5032
  * placed.
@@ -5404,6 +5444,181 @@ export class BlockDynamicPropertiesComponent extends BlockComponent {
5404
5444
  totalByteCount(): number;
5405
5445
  }
5406
5446
 
5447
+ /**
5448
+ * @beta
5449
+ * Represents storage for entities associated with a block
5450
+ * entity. This component is available on blocks whose behavior
5451
+ * pack definition enables entity storage with the
5452
+ * `minecraft:block_entity` component. Stored entities are
5453
+ * serialized and removed from the world until they are
5454
+ * released or transferred. A block can store up to four
5455
+ * entities. Entity storage is scoped to the content pack
5456
+ * accessing it.
5457
+ */
5458
+ // @ts-ignore Class inheritance allowed for native defined classes
5459
+ export class BlockEntityStorageComponent extends BlockComponent {
5460
+ private constructor();
5461
+ static readonly componentId = 'minecraft:entity_storage';
5462
+ /**
5463
+ * @remarks
5464
+ * Returns information about the entities stored in this
5465
+ * block's entity storage. The returned entities are not
5466
+ * present in the world while they are stored. Only entities
5467
+ * stored by the current content pack are included.
5468
+ *
5469
+ * @returns
5470
+ * An array of {@link BlockEntityStorageInfo} values containing
5471
+ * the unique ID and definition ID of each stored entity.
5472
+ * Returns an empty array when no entities are stored by the
5473
+ * current content pack.
5474
+ * @throws
5475
+ * Throws if the block entity is invalid or the block's
5476
+ * location is not loaded or is outside the world boundaries.
5477
+ *
5478
+ * {@link Error}
5479
+ *
5480
+ * {@link InvalidBlockComponentError}
5481
+ *
5482
+ * {@link LocationInUnloadedChunkError}
5483
+ *
5484
+ * {@link LocationOutOfWorldBoundariesError}
5485
+ */
5486
+ getEntities(): BlockEntityStorageInfo[];
5487
+ /**
5488
+ * @remarks
5489
+ * Releases a stored entity from this block's entity storage
5490
+ * and spawns it back into the world, at the same location it
5491
+ * was when stored.
5492
+ *
5493
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5494
+ *
5495
+ * @param entityId
5496
+ * The unique ID of the stored entity. Use the value returned
5497
+ * by {@link BlockEntityStorageComponent.store} or the
5498
+ * `uniqueId` property from {@link BlockEntityStorageInfo}.
5499
+ * @returns
5500
+ * The released {@link Entity}. The released entity receives a
5501
+ * new runtime ID.
5502
+ * @throws
5503
+ * Throws if the entity ID is invalid or does not identify an
5504
+ * entity stored by the current content pack, if the stored
5505
+ * entity cannot be loaded or spawned, or if the block entity
5506
+ * is invalid.
5507
+ *
5508
+ * {@link Error}
5509
+ *
5510
+ * {@link InvalidBlockComponentError}
5511
+ *
5512
+ * {@link LocationInUnloadedChunkError}
5513
+ *
5514
+ * {@link LocationOutOfWorldBoundariesError}
5515
+ */
5516
+ release(entityId: string): Entity;
5517
+ /**
5518
+ * @remarks
5519
+ * Returns the number of entities stored in this block's entity
5520
+ * storage by the current content pack.
5521
+ *
5522
+ * @returns
5523
+ * The number of entities stored by the current content pack.
5524
+ * @throws
5525
+ * Throws if the block entity is invalid or the block's
5526
+ * location is not loaded or is outside the world boundaries.
5527
+ *
5528
+ * {@link Error}
5529
+ *
5530
+ * {@link InvalidBlockComponentError}
5531
+ *
5532
+ * {@link LocationInUnloadedChunkError}
5533
+ *
5534
+ * {@link LocationOutOfWorldBoundariesError}
5535
+ */
5536
+ size(): number;
5537
+ /**
5538
+ * @remarks
5539
+ * Serializes and stores an entity in this block's entity
5540
+ * storage. The entity is removed from the world after it is
5541
+ * stored. Only non-player mob entities can be stored. Entities
5542
+ * with passengers or that are passengers cannot be stored.
5543
+ *
5544
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5545
+ *
5546
+ * @param entity
5547
+ * The {@link Entity} to store.
5548
+ * @returns
5549
+ * The unique ID assigned to the stored entity. Keep this ID to
5550
+ * release, transfer, or inspect the stored entity later.
5551
+ * @throws
5552
+ * Throws if the storage is full, the entity is already stored,
5553
+ * the entity cannot be serialized, or the block entity is
5554
+ * invalid.
5555
+ *
5556
+ * {@link Error}
5557
+ *
5558
+ * {@link InvalidBlockComponentError}
5559
+ *
5560
+ * {@link LocationInUnloadedChunkError}
5561
+ *
5562
+ * {@link LocationOutOfWorldBoundariesError}
5563
+ */
5564
+ store(entity: Entity): string;
5565
+ /**
5566
+ * @remarks
5567
+ * Moves a stored entity from this block's entity storage to
5568
+ * the target block's entity storage without releasing it into
5569
+ * the world.
5570
+ *
5571
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
5572
+ *
5573
+ * @param entityId
5574
+ * The unique ID of the stored entity. Use the value returned
5575
+ * by {@link BlockEntityStorageComponent.store} or the
5576
+ * `uniqueId` property from {@link BlockEntityStorageInfo}.
5577
+ * @param targetBlock
5578
+ * The target {@link Block} with an entity storage component.
5579
+ * The target block must be in the same dimension as this
5580
+ * block.
5581
+ * @throws
5582
+ * Throws if the entity ID is invalid or not stored by the
5583
+ * current content pack, if the target block is invalid, in
5584
+ * another dimension, lacks entity storage, or is full, or if
5585
+ * the source and target blocks are the same.
5586
+ *
5587
+ * {@link Error}
5588
+ *
5589
+ * {@link InvalidBlockComponentError}
5590
+ *
5591
+ * {@link LocationInUnloadedChunkError}
5592
+ *
5593
+ * {@link LocationOutOfWorldBoundariesError}
5594
+ */
5595
+ transfer(entityId: string, targetBlock: Block): void;
5596
+ }
5597
+
5598
+ /**
5599
+ * @beta
5600
+ * Contains identifying information about an entity stored in a
5601
+ * {@link BlockEntityStorageComponent}. Stored entities are not
5602
+ * present in the world until they are released.
5603
+ */
5604
+ export class BlockEntityStorageInfo {
5605
+ private constructor();
5606
+ /**
5607
+ * @remarks
5608
+ * The entity's definition ID, such as `minecraft:pig`.
5609
+ *
5610
+ */
5611
+ readonly definitionId: string;
5612
+ /**
5613
+ * @remarks
5614
+ * The unique ID of the stored entity. Use this ID with
5615
+ * {@link BlockEntityStorageComponent.release} or
5616
+ * {@link BlockEntityStorageComponent.transfer}.
5617
+ *
5618
+ */
5619
+ readonly uniqueId: string;
5620
+ }
5621
+
5407
5622
  /**
5408
5623
  * Contains information regarding an event that impacts a
5409
5624
  * specific block.
@@ -6109,6 +6324,104 @@ export class BlockRecipeCraftingComponent extends BlockComponent {
6109
6324
  getCraftingContext(player: Player): RecipeCraftingContext | undefined;
6110
6325
  }
6111
6326
 
6327
+ /**
6328
+ * @beta
6329
+ * Represents a block component that provides access to recipe
6330
+ * processing inputs and output.
6331
+ */
6332
+ // @ts-ignore Class inheritance allowed for native defined classes
6333
+ export class BlockRecipeProcessingComponent extends BlockComponent {
6334
+ private constructor();
6335
+ /**
6336
+ * @remarks
6337
+ * The number of addressable input slots for getInputItem,
6338
+ * setInputItem, setInputSlotEnabled, and getInputSlotEnabled.
6339
+ *
6340
+ * @throws This property can throw when used.
6341
+ *
6342
+ * {@link InvalidBlockComponentError}
6343
+ */
6344
+ readonly inputSlotCount: number;
6345
+ static readonly componentId = 'minecraft:recipe_processing';
6346
+ /**
6347
+ * @remarks
6348
+ * Gets the item in the provided input slot.
6349
+ *
6350
+ * @param slot
6351
+ * The zero-based input slot index.
6352
+ * @returns
6353
+ * The item stack in the input slot, or undefined if the slot
6354
+ * is empty.
6355
+ * @throws This function can throw errors.
6356
+ *
6357
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
6358
+ *
6359
+ * {@link InvalidBlockComponentError}
6360
+ */
6361
+ getInputItem(slot: number): ItemStack | undefined;
6362
+ /**
6363
+ * @remarks
6364
+ * Gets whether an input slot is enabled for recipe processing.
6365
+ *
6366
+ * @param slot
6367
+ * The zero-based input slot index.
6368
+ * @returns
6369
+ * Whether the input slot is enabled.
6370
+ * @throws This function can throw errors.
6371
+ *
6372
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
6373
+ *
6374
+ * {@link InvalidBlockComponentError}
6375
+ *
6376
+ * {@link minecraftcommon.UnsupportedFunctionalityError}
6377
+ */
6378
+ getInputSlotEnabled(slot: number): boolean;
6379
+ /**
6380
+ * @remarks
6381
+ * Gets the item produced by the current recipe processing
6382
+ * inputs.
6383
+ *
6384
+ * @returns
6385
+ * The output item stack, or undefined if the current inputs do
6386
+ * not produce an item.
6387
+ * @throws This function can throw errors.
6388
+ *
6389
+ * {@link InvalidBlockComponentError}
6390
+ */
6391
+ getOutputItem(): ItemStack | undefined;
6392
+ /**
6393
+ * @remarks
6394
+ * Sets or clears an item in an input slot.
6395
+ *
6396
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
6397
+ *
6398
+ * @param slot
6399
+ * The zero-based input slot index.
6400
+ * @param item
6401
+ * The item stack to place in the slot, or undefined to clear
6402
+ * the slot.
6403
+ * @throws This function can throw errors.
6404
+ *
6405
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
6406
+ *
6407
+ * {@link InvalidBlockComponentError}
6408
+ */
6409
+ setInputItem(slot: number, item?: ItemStack): void;
6410
+ /**
6411
+ * @remarks
6412
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
6413
+ *
6414
+ * @throws This function can throw errors.
6415
+ *
6416
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
6417
+ *
6418
+ * {@link InvalidBlockComponentError}
6419
+ *
6420
+ * {@link minecraftcommon.UnsupportedFunctionalityError}
6421
+ */
6422
+ setInputSlotEnabled(slot: number, enabled: boolean): void;
6423
+ }
6424
+
6112
6425
  /**
6113
6426
  * Represents a block that can play a record.
6114
6427
  */
@@ -6531,6 +6844,49 @@ export class BlockTypes {
6531
6844
  static getAll(): BlockType[];
6532
6845
  }
6533
6846
 
6847
+ /**
6848
+ * @beta
6849
+ * Represents the vibration properties of a block with a
6850
+ * 'minecraft:vibration_properties' component.
6851
+ */
6852
+ // @ts-ignore Class inheritance allowed for native defined classes
6853
+ export class BlockVibrationPropertiesComponent extends BlockComponent {
6854
+ private constructor();
6855
+ static readonly componentId = 'minecraft:vibration_properties';
6856
+ /**
6857
+ * @remarks
6858
+ * Gets whether this block can dampen vibrations. Vibrations
6859
+ * that occur on this block will be discarded by this block if
6860
+ * it can dampen vibrations. Returns false when the block does
6861
+ * not define a 'minecraft:vibration_properties' component.
6862
+ *
6863
+ * @returns
6864
+ * Whether this block can dampen vibrations.
6865
+ * @throws This function can throw errors.
6866
+ *
6867
+ * {@link LocationInUnloadedChunkError}
6868
+ *
6869
+ * {@link LocationOutOfWorldBoundariesError}
6870
+ */
6871
+ getCanDampenVibrations(): boolean;
6872
+ /**
6873
+ * @remarks
6874
+ * Gets whether this block can occlude vibrations. Vibrations
6875
+ * that pass through this block will be discarded if this block
6876
+ * can occlude vibrations. Returns false when the block does
6877
+ * not define a 'minecraft:vibration_properties' component.
6878
+ *
6879
+ * @returns
6880
+ * Whether this block can occlude vibrations.
6881
+ * @throws This function can throw errors.
6882
+ *
6883
+ * {@link LocationInUnloadedChunkError}
6884
+ *
6885
+ * {@link LocationOutOfWorldBoundariesError}
6886
+ */
6887
+ getCanOccludeVibrations(): boolean;
6888
+ }
6889
+
6534
6890
  /**
6535
6891
  * A BlockVolume is a simple interface to an object which
6536
6892
  * represents a 3D rectangle of a given size (in blocks) at a
@@ -12252,7 +12608,7 @@ export class EntityIsStunnedComponent extends EntityComponent {
12252
12608
  export class EntityIsTamedComponent extends EntityComponent {
12253
12609
  private constructor();
12254
12610
  /**
12255
- * @beta
12611
+ * @rc
12256
12612
  * @remarks
12257
12613
  * Returns the player that has tamed the entity, or 'undefined'
12258
12614
  * if the entity has no player owner.
@@ -12263,7 +12619,7 @@ export class EntityIsTamedComponent extends EntityComponent {
12263
12619
  */
12264
12620
  readonly tamedToPlayer?: Player;
12265
12621
  /**
12266
- * @beta
12622
+ * @rc
12267
12623
  * @remarks
12268
12624
  * Returns the id of the player that has tamed the entity, or
12269
12625
  * 'undefined' if the entity has no player owner.
@@ -19175,6 +19531,118 @@ export class PlayerCursorInventoryComponent extends EntityComponent {
19175
19531
  clear(): void;
19176
19532
  }
19177
19533
 
19534
+ /**
19535
+ * @beta
19536
+ * Contains information about an item moved from a container to
19537
+ * a player's cursor.
19538
+ */
19539
+ export class PlayerCursorItemGrabAfterEvent {
19540
+ private constructor();
19541
+ /**
19542
+ * @remarks
19543
+ * The item stack moved to the player's cursor.
19544
+ *
19545
+ */
19546
+ readonly item: ItemStack;
19547
+ /**
19548
+ * @remarks
19549
+ * The player whose cursor item changed.
19550
+ *
19551
+ */
19552
+ readonly player: Player;
19553
+ }
19554
+
19555
+ /**
19556
+ * @beta
19557
+ * Manages callbacks for items grabbed from a container to a
19558
+ * player's cursor.
19559
+ */
19560
+ export class PlayerCursorItemGrabAfterEventSignal {
19561
+ private constructor();
19562
+ /**
19563
+ * @remarks
19564
+ * Adds a callback that is called when a player grabs an item
19565
+ * from a container to their cursor.
19566
+ *
19567
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19568
+ *
19569
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19570
+ *
19571
+ * @param callback
19572
+ * The callback function invoked when the event fires.
19573
+ */
19574
+ subscribe(callback: (arg0: PlayerCursorItemGrabAfterEvent) => void): (arg0: PlayerCursorItemGrabAfterEvent) => void;
19575
+ /**
19576
+ * @remarks
19577
+ * Removes a previously registered event callback.
19578
+ *
19579
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19580
+ *
19581
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19582
+ *
19583
+ * @param callback
19584
+ * The callback function to remove.
19585
+ */
19586
+ unsubscribe(callback: (arg0: PlayerCursorItemGrabAfterEvent) => void): void;
19587
+ }
19588
+
19589
+ /**
19590
+ * @beta
19591
+ * Contains information about an item moved from a player's
19592
+ * cursor to a container.
19593
+ */
19594
+ export class PlayerCursorItemReleaseAfterEvent {
19595
+ private constructor();
19596
+ /**
19597
+ * @remarks
19598
+ * The item stack from the player's cursor.
19599
+ *
19600
+ */
19601
+ readonly item: ItemStack;
19602
+ /**
19603
+ * @remarks
19604
+ * The player whose cursor item changed.
19605
+ *
19606
+ */
19607
+ readonly player: Player;
19608
+ }
19609
+
19610
+ /**
19611
+ * @beta
19612
+ * Manages callbacks for items released from a player's cursor
19613
+ * to a container.
19614
+ */
19615
+ export class PlayerCursorItemReleaseAfterEventSignal {
19616
+ private constructor();
19617
+ /**
19618
+ * @remarks
19619
+ * Adds a callback that is called when a player releases an
19620
+ * item from their cursor to a container.
19621
+ *
19622
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19623
+ *
19624
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19625
+ *
19626
+ * @param callback
19627
+ * The callback function invoked when the event fires.
19628
+ */
19629
+ subscribe(
19630
+ callback: (arg0: PlayerCursorItemReleaseAfterEvent) => void,
19631
+ ): (arg0: PlayerCursorItemReleaseAfterEvent) => void;
19632
+ /**
19633
+ * @remarks
19634
+ * Removes a previously registered event callback.
19635
+ *
19636
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
19637
+ *
19638
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
19639
+ *
19640
+ * @param callback
19641
+ * The callback function to remove.
19642
+ */
19643
+ unsubscribe(callback: (arg0: PlayerCursorItemReleaseAfterEvent) => void): void;
19644
+ }
19645
+
19178
19646
  /**
19179
19647
  * Contains information related to changes to a player's
19180
19648
  * dimension having been changed.
@@ -19998,6 +20466,92 @@ export class PlayerInventoryItemChangeAfterEventSignal {
19998
20466
  unsubscribe(callback: (arg0: PlayerInventoryItemChangeAfterEvent) => void): void;
19999
20467
  }
20000
20468
 
20469
+ /**
20470
+ * @beta
20471
+ * Contains information about an attack initiated through a
20472
+ * player item interaction before it causes effects. Set cancel
20473
+ * to true to prevent the attack.
20474
+ */
20475
+ export class PlayerItemAttackEntityBeforeEvent {
20476
+ private constructor();
20477
+ /**
20478
+ * @remarks
20479
+ * The normalized world-space direction used for the attack.
20480
+ * For standard client-initiated transaction attacks, this
20481
+ * direction is derived from the client-provided hit position
20482
+ * and the player's server-side eye position. Other attack
20483
+ * paths can provide a server-derived direction. This property
20484
+ * is undefined when the attack path does not provide an aim
20485
+ * direction.
20486
+ *
20487
+ */
20488
+ readonly aimDirection?: Vector3;
20489
+ /**
20490
+ * @remarks
20491
+ * If set to true, the attack does not cause damage or other
20492
+ * authoritative attack effects.
20493
+ *
20494
+ */
20495
+ cancel: boolean;
20496
+ /**
20497
+ * @remarks
20498
+ * A snapshot of the item held by the attacking player. This
20499
+ * property is undefined when the player holds no item.
20500
+ *
20501
+ */
20502
+ readonly itemStack?: ItemStack;
20503
+ /**
20504
+ * @remarks
20505
+ * The player that initiated the attack.
20506
+ *
20507
+ */
20508
+ readonly player: Player;
20509
+ /**
20510
+ * @remarks
20511
+ * The entity targeted by the attack.
20512
+ *
20513
+ */
20514
+ readonly target: Entity;
20515
+ }
20516
+
20517
+ /**
20518
+ * @beta
20519
+ * Manages callbacks that run before a player attacks an entity
20520
+ * through an item interaction.
20521
+ */
20522
+ export class PlayerItemAttackEntityBeforeEventSignal {
20523
+ private constructor();
20524
+ /**
20525
+ * @remarks
20526
+ * Adds a callback that runs before a player attacks an entity
20527
+ * through an item interaction.
20528
+ *
20529
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
20530
+ *
20531
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
20532
+ *
20533
+ * @param callback
20534
+ * This closure is called with restricted-execution privilege.
20535
+ * @returns
20536
+ * Closure that is called with restricted-execution privilege.
20537
+ */
20538
+ subscribe(
20539
+ callback: (arg0: PlayerItemAttackEntityBeforeEvent) => void,
20540
+ ): (arg0: PlayerItemAttackEntityBeforeEvent) => void;
20541
+ /**
20542
+ * @remarks
20543
+ * Removes a callback from this event signal.
20544
+ *
20545
+ * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
20546
+ *
20547
+ * @privilege early-execution-allowed - This function can be called in early-execution mode.
20548
+ *
20549
+ * @param callback
20550
+ * This closure is called with restricted-execution privilege.
20551
+ */
20552
+ unsubscribe(callback: (arg0: PlayerItemAttackEntityBeforeEvent) => void): void;
20553
+ }
20554
+
20001
20555
  /**
20002
20556
  * Contains information regarding a player that has joined.
20003
20557
  * See the playerSpawn event for more detailed information that
@@ -20860,7 +21414,7 @@ export class PoiBlockType {
20860
21414
  * @returns
20861
21415
  * True if the POI conatains the tag; otherwise false.
20862
21416
  */
20863
- has(tag: string): boolean;
21417
+ hasTag(tag: string): boolean;
20864
21418
  }
20865
21419
 
20866
21420
  /**
@@ -22793,10 +23347,11 @@ export class SoundInstance {
22793
23347
  /**
22794
23348
  * @rc
22795
23349
  * @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`.
23350
+ * Fades this sound instance from its current volume multiplier
23351
+ * to the target multiplier over the specified duration. Volume
23352
+ * multipliers are relative to the selected sound variant's
23353
+ * volume. To fade in from silence, call `setVolume(0.0)`
23354
+ * first; to fade out, pass a target volume of `0.0`.
22800
23355
  *
22801
23356
  * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
22802
23357
  *
@@ -22804,7 +23359,8 @@ export class SoundInstance {
22804
23359
  * Duration of the fade in seconds. Must be non-negative.
22805
23360
  * Minimum value: 0
22806
23361
  * @param targetVolume
22807
- * Volume to fade to. Must be non-negative.
23362
+ * Volume multiplier to fade to, relative to the selected sound
23363
+ * variant's volume. Must be non-negative.
22808
23364
  * Minimum value: 0
22809
23365
  */
22810
23366
  fade(duration: number, targetVolume: number): void;
@@ -22859,12 +23415,14 @@ export class SoundInstance {
22859
23415
  /**
22860
23416
  * @rc
22861
23417
  * @remarks
22862
- * Sets the volume of this sound instance.
23418
+ * Sets the volume multiplier of this sound instance relative
23419
+ * to the volume of the selected sound variant.
22863
23420
  *
22864
23421
  * @privilege no-restricted-execution - This function can't be called in restricted-execution mode.
22865
23422
  *
22866
23423
  * @param volume
22867
- * Volume level between 0.0 and 10.0.
23424
+ * Volume multiplier between 0.0 and 10.0. A value of 1.0 uses
23425
+ * the selected sound variant's volume.
22868
23426
  * Bounds: [0, 10]
22869
23427
  */
22870
23428
  setVolume(volume: number): void;
@@ -22941,7 +23499,7 @@ export class StartupEvent {
22941
23499
  */
22942
23500
  readonly itemComponentRegistry: ItemComponentRegistry;
22943
23501
  /**
22944
- * @beta
23502
+ * @rc
22945
23503
  * @remarks
22946
23504
  * @privilege early-execution-readable - This property can be read in early-execution mode.
22947
23505
  *
@@ -23868,7 +24426,7 @@ export class TickingAreaManager {
23868
24426
  }
23869
24427
 
23870
24428
  /**
23871
- * @beta
24429
+ * @rc
23872
24430
  * A named point in time on a world clock that can occur once
23873
24431
  * or periodically.
23874
24432
  */
@@ -24463,7 +25021,7 @@ export class World {
24463
25021
  */
24464
25022
  getAllPlayers(): Player[];
24465
25023
  /**
24466
- * @beta
25024
+ * @rc
24467
25025
  * @remarks
24468
25026
  * Retrieves a world clock by its name.
24469
25027
  *
@@ -25250,6 +25808,26 @@ export class WorldAfterEvents {
25250
25808
  *
25251
25809
  */
25252
25810
  readonly playerCraftRecipe: PlayerCraftRecipeAfterEventSignal;
25811
+ /**
25812
+ * @beta
25813
+ * @remarks
25814
+ * Event signal that fires when a player grabs an item from a
25815
+ * container to their cursor.
25816
+ *
25817
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
25818
+ *
25819
+ */
25820
+ readonly playerCursorItemGrab: PlayerCursorItemGrabAfterEventSignal;
25821
+ /**
25822
+ * @beta
25823
+ * @remarks
25824
+ * Event signal that fires when a player releases an item from
25825
+ * their cursor into a container.
25826
+ *
25827
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
25828
+ *
25829
+ */
25830
+ readonly playerCursorItemRelease: PlayerCursorItemReleaseAfterEventSignal;
25253
25831
  /**
25254
25832
  * @remarks
25255
25833
  * Fires when a player moved to a different dimension.
@@ -25447,7 +26025,7 @@ export class WorldAfterEvents {
25447
26025
  */
25448
26026
  readonly weatherChange: WeatherChangeAfterEventSignal;
25449
26027
  /**
25450
- * @beta
26028
+ * @rc
25451
26029
  * @remarks
25452
26030
  * This event fires when a {@link WorldClock} is paused.
25453
26031
  *
@@ -25456,7 +26034,7 @@ export class WorldAfterEvents {
25456
26034
  */
25457
26035
  readonly worldClockOnPaused: WorldClockOnPausedAfterEventSignal;
25458
26036
  /**
25459
- * @beta
26037
+ * @rc
25460
26038
  * @remarks
25461
26039
  * This event fires when a {@link WorldClock} is resumed.
25462
26040
  *
@@ -25465,7 +26043,7 @@ export class WorldAfterEvents {
25465
26043
  */
25466
26044
  readonly worldClockOnResumed: WorldClockOnResumedAfterEventSignal;
25467
26045
  /**
25468
- * @beta
26046
+ * @rc
25469
26047
  * @remarks
25470
26048
  * This event fires when the time of a {@link WorldClock} hits
25471
26049
  * a {@link TimeMarker} on the clock. This can happen during a
@@ -25476,7 +26054,7 @@ export class WorldAfterEvents {
25476
26054
  */
25477
26055
  readonly worldClockOnTimeMarker: WorldClockOnTimeMarkerAfterEventSignal;
25478
26056
  /**
25479
- * @beta
26057
+ * @rc
25480
26058
  * @remarks
25481
26059
  * This event fires when a {@link WorldClock} time is changed.
25482
26060
  * This can happen when the time is directly set through
@@ -25634,6 +26212,13 @@ export class WorldBeforeEvents {
25634
26212
  *
25635
26213
  */
25636
26214
  readonly playerInteractWithEntity: PlayerInteractWithEntityBeforeEventSignal;
26215
+ /**
26216
+ * @beta
26217
+ * @remarks
26218
+ * @privilege early-execution-readable - This property can be read in early-execution mode.
26219
+ *
26220
+ */
26221
+ readonly playerItemAttackEntity: PlayerItemAttackEntityBeforeEventSignal;
25637
26222
  /**
25638
26223
  * @remarks
25639
26224
  * Fires when a player leaves the game.
@@ -25658,7 +26243,7 @@ export class WorldBeforeEvents {
25658
26243
  */
25659
26244
  readonly weatherChange: WeatherChangeBeforeEventSignal;
25660
26245
  /**
25661
- * @beta
26246
+ * @rc
25662
26247
  * @remarks
25663
26248
  * This event fires when a {@link WorldClock} reaches its
25664
26249
  * maximum time and is about to restart.
@@ -25670,7 +26255,7 @@ export class WorldBeforeEvents {
25670
26255
  }
25671
26256
 
25672
26257
  /**
25673
- * @beta
26258
+ * @rc
25674
26259
  * A class that represents a particular clock within a world.
25675
26260
  */
25676
26261
  export class WorldClock {
@@ -25797,7 +26382,7 @@ export class WorldClock {
25797
26382
  }
25798
26383
 
25799
26384
  /**
25800
- * @beta
26385
+ * @rc
25801
26386
  * Contains information related to a {@link WorldClock} being
25802
26387
  * paused.
25803
26388
  */
@@ -25812,7 +26397,7 @@ export class WorldClockOnPausedAfterEvent {
25812
26397
  }
25813
26398
 
25814
26399
  /**
25815
- * @beta
26400
+ * @rc
25816
26401
  * Manages callbacks that are connected to a {@link WorldClock}
25817
26402
  * being paused.
25818
26403
  */
@@ -25846,7 +26431,7 @@ export class WorldClockOnPausedAfterEventSignal {
25846
26431
  }
25847
26432
 
25848
26433
  /**
25849
- * @beta
26434
+ * @rc
25850
26435
  * Contains information related to a {@link WorldClock}
25851
26436
  * restarting.
25852
26437
  */
@@ -25877,7 +26462,7 @@ export class WorldClockOnRestartBeforeEvent {
25877
26462
  }
25878
26463
 
25879
26464
  /**
25880
- * @beta
26465
+ * @rc
25881
26466
  * Manages callbacks that are connected to a {@link WorldClock}
25882
26467
  * restarting.
25883
26468
  */
@@ -25917,7 +26502,7 @@ export class WorldClockOnRestartBeforeEventSignal {
25917
26502
  }
25918
26503
 
25919
26504
  /**
25920
- * @beta
26505
+ * @rc
25921
26506
  * Contains information related to a {@link WorldClock} being
25922
26507
  * resumed.
25923
26508
  */
@@ -25932,7 +26517,7 @@ export class WorldClockOnResumedAfterEvent {
25932
26517
  }
25933
26518
 
25934
26519
  /**
25935
- * @beta
26520
+ * @rc
25936
26521
  * Manages callbacks that are connected to a {@link WorldClock}
25937
26522
  * being resumed.
25938
26523
  */
@@ -25966,7 +26551,7 @@ export class WorldClockOnResumedAfterEventSignal {
25966
26551
  }
25967
26552
 
25968
26553
  /**
25969
- * @beta
26554
+ * @rc
25970
26555
  * Contains information related to when the time of a
25971
26556
  * {@link WorldClock} hits a {@link TimeMarker}.
25972
26557
  */
@@ -25987,7 +26572,7 @@ export class WorldClockOnTimeMarkerAfterEvent {
25987
26572
  }
25988
26573
 
25989
26574
  /**
25990
- * @beta
26575
+ * @rc
25991
26576
  * Manages callbacks that are connected to when the time of a
25992
26577
  * {@link WorldClock} hits a {@link TimeMarker}.
25993
26578
  */
@@ -26021,7 +26606,7 @@ export class WorldClockOnTimeMarkerAfterEventSignal {
26021
26606
  }
26022
26607
 
26023
26608
  /**
26024
- * @beta
26609
+ * @rc
26025
26610
  * Contains information related to changes to the time of a
26026
26611
  * {@link WorldClock}.
26027
26612
  */
@@ -26036,7 +26621,7 @@ export class WorldClockOnTimeModifiedAfterEvent {
26036
26621
  }
26037
26622
 
26038
26623
  /**
26039
- * @beta
26624
+ * @rc
26040
26625
  * Manages callbacks that are connected to changes to the time
26041
26626
  * of a {@link WorldClock}.
26042
26627
  */
@@ -26070,7 +26655,7 @@ export class WorldClockOnTimeModifiedAfterEventSignal {
26070
26655
  }
26071
26656
 
26072
26657
  /**
26073
- * @beta
26658
+ * @rc
26074
26659
  * Provides the functionality for registering custom world
26075
26660
  * clocks. World clocks can only be registered during the
26076
26661
  * system startup event.
@@ -26283,6 +26868,10 @@ export interface BlockCustomComponent {
26283
26868
  * @beta
26284
26869
  */
26285
26870
  onNamedTick?: (arg0: BlockComponentNamedTickEvent, arg1: CustomComponentParameters) => void;
26871
+ /**
26872
+ * @beta
26873
+ */
26874
+ onNeighborChanged?: (arg0: BlockComponentNeighborChangedAfterEvent, arg1: CustomComponentParameters) => void;
26286
26875
  /**
26287
26876
  * @remarks
26288
26877
  * This function will be called when the block that this custom
@@ -28160,6 +28749,35 @@ export interface MusicOptions {
28160
28749
  volume?: number;
28161
28750
  }
28162
28751
 
28752
+ /**
28753
+ * @beta
28754
+ * Contains information regarding a block change in one
28755
+ * neighboring direction.
28756
+ */
28757
+ export interface NeighborChange {
28758
+ /**
28759
+ * @remarks
28760
+ * The permutation of the neighboring block after its last
28761
+ * change during the tick.
28762
+ *
28763
+ */
28764
+ blockPermutation: BlockPermutation;
28765
+ /**
28766
+ * @remarks
28767
+ * Direction from the block receiving the event to the
28768
+ * neighboring block that changed.
28769
+ *
28770
+ */
28771
+ direction: Direction;
28772
+ /**
28773
+ * @remarks
28774
+ * The permutation of the neighboring block before its first
28775
+ * change during the tick.
28776
+ *
28777
+ */
28778
+ previousPermutation: BlockPermutation;
28779
+ }
28780
+
28163
28781
  /**
28164
28782
  * Not equal to operator.
28165
28783
  */
@@ -29214,7 +29832,7 @@ export interface TickingAreaOptions {
29214
29832
  }
29215
29833
 
29216
29834
  /**
29217
- * @beta
29835
+ * @rc
29218
29836
  * Options for creating time markers for world clocks.
29219
29837
  */
29220
29838
  export interface TimeMarkerOptions {
@@ -29382,7 +30000,7 @@ export interface WaypointTextureSelector {
29382
30000
  }
29383
30001
 
29384
30002
  /**
29385
- * @beta
30003
+ * @rc
29386
30004
  * Contains parameters for world clock events that filters out
29387
30005
  * which events are passed to the provided callback.
29388
30006
  */
@@ -29396,7 +30014,7 @@ export interface WorldClockEventOptions {
29396
30014
  }
29397
30015
 
29398
30016
  /**
29399
- * @beta
30017
+ * @rc
29400
30018
  * Contains additional options for registering world clocks.
29401
30019
  */
29402
30020
  export interface WorldClockRegistrationOptions {
@@ -29410,7 +30028,7 @@ export interface WorldClockRegistrationOptions {
29410
30028
  }
29411
30029
 
29412
30030
  /**
29413
- * @beta
30031
+ * @rc
29414
30032
  * Contains parameters for world clock time marker events that
29415
30033
  * filters out which events are passed to the provided
29416
30034
  * callback.
@@ -29915,7 +30533,7 @@ export class UnloadedChunksError extends Error {
29915
30533
  }
29916
30534
 
29917
30535
  /**
29918
- * @beta
30536
+ * @rc
29919
30537
  * Error thrown by {@link WorldClock.addTimeMarker} when
29920
30538
  * failing to add a time marker to a world clock.
29921
30539
  */
@@ -29925,7 +30543,7 @@ export class WorldClockAddTimeMarkerError extends Error {
29925
30543
  }
29926
30544
 
29927
30545
  /**
29928
- * @beta
30546
+ * @rc
29929
30547
  * Thrown when trying to register a world clock outside of the
29930
30548
  * system startup event.
29931
30549
  */
@@ -29935,7 +30553,7 @@ export class WorldClockInvalidRegistryError extends Error {
29935
30553
  }
29936
30554
 
29937
30555
  /**
29938
- * @beta
30556
+ * @rc
29939
30557
  * Error thrown when a time marker is invalid. This can occur
29940
30558
  * when trying to access data on a time marker that has been
29941
30559
  * removed.
@@ -29946,7 +30564,7 @@ export class WorldClockInvalidTimeMarkerError extends Error {
29946
30564
  }
29947
30565
 
29948
30566
  /**
29949
- * @beta
30567
+ * @rc
29950
30568
  * Error thrown when a world clock is not found in the world
29951
30569
  * clock registry.
29952
30570
  */
@@ -29956,7 +30574,7 @@ export class WorldClockNotFoundError extends Error {
29956
30574
  }
29957
30575
 
29958
30576
  /**
29959
- * @beta
30577
+ * @rc
29960
30578
  * Error thrown by {@link WorldClockRegistry.registerClock}
29961
30579
  * when failing to register a world clock.
29962
30580
  */
@@ -29966,7 +30584,7 @@ export class WorldClockRegistrationError extends Error {
29966
30584
  }
29967
30585
 
29968
30586
  /**
29969
- * @beta
30587
+ * @rc
29970
30588
  * Thrown after using the /reload command when trying to
29971
30589
  * register a world clock that was not previously registered.
29972
30590
  * New world clocks cannot be added during a reload.
@@ -29977,7 +30595,7 @@ export class WorldClockReloadNewWorldClockError extends Error {
29977
30595
  }
29978
30596
 
29979
30597
  /**
29980
- * @beta
30598
+ * @rc
29981
30599
  * Error thrown after using the /reload command when trying to
29982
30600
  * re-register an existing world clock with an invalid time
29983
30601
  * marker.
@@ -29988,7 +30606,7 @@ export class WorldClockReloadTimeMarkerError extends Error {
29988
30606
  }
29989
30607
 
29990
30608
  /**
29991
- * @beta
30609
+ * @rc
29992
30610
  * Error thrown by {@link WorldClock.removeTimeMarker} when
29993
30611
  * trying to remove a time marker with the 'minecraft'
29994
30612
  * namespace from a world clock.
@@ -29999,7 +30617,7 @@ export class WorldClockRemoveMinecraftTimeMarkerError extends Error {
29999
30617
  }
30000
30618
 
30001
30619
  /**
30002
- * @beta
30620
+ * @rc
30003
30621
  * Error thrown by {@link WorldClock.rewindTo} when the world
30004
30622
  * clock's time is already before the time marker's first
30005
30623
  * occurrence.
@@ -30010,7 +30628,7 @@ export class WorldClockRewindError extends Error {
30010
30628
  }
30011
30629
 
30012
30630
  /**
30013
- * @beta
30631
+ * @rc
30014
30632
  * Error thrown when performing actions on a world clock with a
30015
30633
  * time marker that does not exist.
30016
30634
  */
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.29",
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.29"
18
+ },
19
+ "license": "MIT"
20
20
  }