@minecraft/server 2.0.0-beta.1.21.70-preview.24 → 2.0.0-beta.1.21.70-preview.26

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 (2) hide show
  1. package/index.d.ts +67 -197
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2435,12 +2435,21 @@ export enum WeatherType {
2435
2435
  }
2436
2436
 
2437
2437
  /**
2438
- * @beta
2438
+ * @rc
2439
+ */
2440
+ export type BlockComponentReturnType<T extends string> = T extends keyof BlockComponentTypeMap
2441
+ ? BlockComponentTypeMap[T]
2442
+ : BlockComponent;
2443
+
2444
+ /**
2445
+ * @rc
2439
2446
  */
2440
2447
  export type BlockComponentTypeMap = {
2448
+ destruction_particles: BlockDestructionParticlesComponent;
2441
2449
  fluid_container: BlockFluidContainerComponent;
2442
2450
  inventory: BlockInventoryComponent;
2443
2451
  map_color: BlockMapColorComponent;
2452
+ 'minecraft:destruction_particles': BlockDestructionParticlesComponent;
2444
2453
  'minecraft:fluid_container': BlockFluidContainerComponent;
2445
2454
  'minecraft:inventory': BlockInventoryComponent;
2446
2455
  'minecraft:map_color': BlockMapColorComponent;
@@ -2453,7 +2462,7 @@ export type BlockComponentTypeMap = {
2453
2462
  };
2454
2463
 
2455
2464
  /**
2456
- * @beta
2465
+ * @rc
2457
2466
  * Type alias used by the {@link BlockPermutation} matches and
2458
2467
  * resolve functions to narrow block state argument types to
2459
2468
  * those mapped by {@link
@@ -2466,7 +2475,14 @@ export type BlockStateArg<T> = T extends `${minecraftvanilladata.MinecraftBlockT
2466
2475
  : Record<string, boolean | number | string>;
2467
2476
 
2468
2477
  /**
2469
- * @beta
2478
+ * @rc
2479
+ */
2480
+ export type EntityComponentReturnType<T extends string> = T extends keyof EntityComponentTypeMap
2481
+ ? EntityComponentTypeMap[T]
2482
+ : EntityComponent;
2483
+
2484
+ /**
2485
+ * @rc
2470
2486
  */
2471
2487
  export type EntityComponentTypeMap = {
2472
2488
  addrider: EntityAddRiderComponent;
@@ -2604,7 +2620,14 @@ export type EntityComponentTypeMap = {
2604
2620
  };
2605
2621
 
2606
2622
  /**
2607
- * @beta
2623
+ * @rc
2624
+ */
2625
+ export type ItemComponentReturnType<T extends string> = T extends keyof ItemComponentTypeMap
2626
+ ? ItemComponentTypeMap[T]
2627
+ : ItemComponent;
2628
+
2629
+ /**
2630
+ * @rc
2608
2631
  */
2609
2632
  export type ItemComponentTypeMap = {
2610
2633
  compostable: ItemCompostableComponent;
@@ -2718,8 +2741,6 @@ export class AimAssistCategorySettings {
2718
2741
  * Constructor that takes a unique Id to associate with the
2719
2742
  * created AimAssistCategory. Must have a namespace.
2720
2743
  *
2721
- * This function can't be called in read-only mode.
2722
- *
2723
2744
  */
2724
2745
  constructor(identifier: string);
2725
2746
  /**
@@ -2872,8 +2893,6 @@ export class AimAssistPresetSettings {
2872
2893
  * Constructor that takes a unique Id to associate with the
2873
2894
  * created AimAssistPreset. Must have a namespace.
2874
2895
  *
2875
- * This function can't be called in read-only mode.
2876
- *
2877
2896
  */
2878
2897
  constructor(identifier: string);
2879
2898
  /**
@@ -3340,8 +3359,6 @@ export class Block {
3340
3359
  * for a block - for example, an inventory component of a chest
3341
3360
  * block.
3342
3361
  *
3343
- * This function can't be called in read-only mode.
3344
- *
3345
3362
  * @param componentId
3346
3363
  * The identifier of the component (e.g.,
3347
3364
  * 'minecraft:inventory'). If no namespace prefix is specified,
@@ -3356,7 +3373,7 @@ export class Block {
3356
3373
  *
3357
3374
  * {@link LocationOutOfWorldBoundariesError}
3358
3375
  */
3359
- getComponent<T extends keyof BlockComponentTypeMap>(componentId: T): BlockComponentTypeMap[T] | undefined;
3376
+ getComponent<T extends string>(componentId: T): BlockComponentReturnType<T> | undefined;
3360
3377
  /**
3361
3378
  * @remarks
3362
3379
  * Creates a prototype item stack based on this block that can
@@ -3867,6 +3884,35 @@ export class BlockComponentTickEvent extends BlockEvent {
3867
3884
  private constructor();
3868
3885
  }
3869
3886
 
3887
+ /**
3888
+ * @beta
3889
+ * Represents the particles that appear when the block is
3890
+ * destroyed.
3891
+ */
3892
+ // @ts-ignore Class inheritance allowed for native defined classes
3893
+ export class BlockDestructionParticlesComponent extends BlockComponent {
3894
+ private constructor();
3895
+ /**
3896
+ * @remarks
3897
+ * Name of the texture used for the particles.
3898
+ *
3899
+ * @throws This property can throw when used.
3900
+ *
3901
+ * {@link Error}
3902
+ */
3903
+ readonly texture: string;
3904
+ /**
3905
+ * @remarks
3906
+ * Type of tint applied to the particles.
3907
+ *
3908
+ * @throws This property can throw when used.
3909
+ *
3910
+ * {@link Error}
3911
+ */
3912
+ readonly tintMethod: TintMethod;
3913
+ static readonly componentId = 'minecraft:destruction_particles';
3914
+ }
3915
+
3870
3916
  /**
3871
3917
  * Contains information regarding an event that impacts a
3872
3918
  * specific block.
@@ -4111,38 +4157,32 @@ export class BlockLocationIterator implements Iterable<Vector3> {
4111
4157
  // @ts-ignore Class inheritance allowed for native defined classes
4112
4158
  export class BlockMapColorComponent extends BlockComponent {
4113
4159
  private constructor();
4114
- static readonly componentId = 'minecraft:map_color';
4115
4160
  /**
4116
4161
  * @remarks
4117
4162
  * Base map color defined for that block.
4118
4163
  *
4119
- * This function can't be called in read-only mode.
4120
- *
4121
- * @throws This function can throw errors.
4164
+ * @throws This property can throw when used.
4122
4165
  *
4123
4166
  * {@link Error}
4124
4167
  */
4125
- color(): RGBA;
4168
+ readonly color: RGBA;
4126
4169
  /**
4127
4170
  * @remarks
4128
4171
  * Returns the base color multiplied to the evaluated tint at
4129
4172
  * the given position.
4130
4173
  *
4131
- * This function can't be called in read-only mode.
4132
- *
4133
4174
  */
4134
- tintedColor(): RGBA;
4175
+ readonly tintedColor: RGBA;
4135
4176
  /**
4136
4177
  * @remarks
4137
4178
  * Type of tint applied to the color.
4138
4179
  *
4139
- * This function can't be called in read-only mode.
4140
- *
4141
- * @throws This function can throw errors.
4180
+ * @throws This property can throw when used.
4142
4181
  *
4143
4182
  * {@link Error}
4144
4183
  */
4145
- tintMethod(): TintMethod;
4184
+ readonly tintMethod: TintMethod;
4185
+ static readonly componentId = 'minecraft:map_color';
4146
4186
  }
4147
4187
 
4148
4188
  /**
@@ -4239,8 +4279,6 @@ export class BlockPermutation {
4239
4279
  * @remarks
4240
4280
  * Gets a state for the permutation.
4241
4281
  *
4242
- * This function can't be called in read-only mode.
4243
- *
4244
4282
  * @param stateName
4245
4283
  * Name of the block state who's value is to be returned.
4246
4284
  * @returns
@@ -4316,8 +4354,6 @@ export class BlockPermutation {
4316
4354
  * this permutation. If states is not specified, matches checks
4317
4355
  * against the set of types more broadly.
4318
4356
  *
4319
- * This function can't be called in read-only mode.
4320
- *
4321
4357
  * @param blockName
4322
4358
  * An optional set of states to compare against.
4323
4359
  */
@@ -4330,8 +4366,6 @@ export class BlockPermutation {
4330
4366
  * Returns a derived BlockPermutation with a specific property
4331
4367
  * set.
4332
4368
  *
4333
- * This function can't be called in read-only mode.
4334
- *
4335
4369
  * @param name
4336
4370
  * Identifier of the block property.
4337
4371
  * @param value
@@ -4348,8 +4382,6 @@ export class BlockPermutation {
4348
4382
  * will return a BlockPermutation object that is usable in
4349
4383
  * other block APIs (e.g., block.setPermutation)
4350
4384
  *
4351
- * This function can't be called in read-only mode.
4352
- *
4353
4385
  * @param blockName
4354
4386
  * Identifier of the block to check.
4355
4387
  * @throws This function can throw errors.
@@ -4845,11 +4877,6 @@ export class BlockVolume extends BlockVolumeBase {
4845
4877
  *
4846
4878
  */
4847
4879
  to: Vector3;
4848
- /**
4849
- * @remarks
4850
- * This function can't be called in read-only mode.
4851
- *
4852
- */
4853
4880
  constructor(from: Vector3, to: Vector3);
4854
4881
  /**
4855
4882
  * @remarks
@@ -5507,8 +5534,6 @@ export class CompoundBlockVolume {
5507
5534
  * @remarks
5508
5535
  * Create a CompoundBlockVolume object
5509
5536
  *
5510
- * This function can't be called in read-only mode.
5511
- *
5512
5537
  * @param origin
5513
5538
  * An optional world space origin on which to center the
5514
5539
  * compound volume.
@@ -7429,9 +7454,6 @@ export class EnchantmentType {
7429
7454
  */
7430
7455
  readonly maxLevel: number;
7431
7456
  /**
7432
- * @remarks
7433
- * This function can't be called in read-only mode.
7434
- *
7435
7457
  * @throws This function can throw errors.
7436
7458
  */
7437
7459
  constructor(enchantmentType: string);
@@ -7892,8 +7914,6 @@ export class Entity {
7892
7914
  * Gets a component (that represents additional capabilities)
7893
7915
  * for an entity.
7894
7916
  *
7895
- * This function can't be called in read-only mode.
7896
- *
7897
7917
  * @param componentId
7898
7918
  * The identifier of the component (e.g., 'minecraft:health').
7899
7919
  * If no namespace prefix is specified, 'minecraft:' is
@@ -7906,7 +7926,7 @@ export class Entity {
7906
7926
  *
7907
7927
  * {@link InvalidEntityError}
7908
7928
  */
7909
- getComponent<T extends keyof EntityComponentTypeMap>(componentId: T): EntityComponentTypeMap[T] | undefined;
7929
+ getComponent<T extends string>(componentId: T): EntityComponentReturnType<T> | undefined;
7910
7930
  /**
7911
7931
  * @remarks
7912
7932
  * Returns all components that are both present on this entity
@@ -10684,10 +10704,9 @@ export class EntityScaleComponent extends EntityComponent {
10684
10704
  * @remarks
10685
10705
  * Current value for the scale property set on entities.
10686
10706
  *
10687
- * This property can't be edited in read-only mode.
10688
- *
10707
+ * @throws This property can throw when used.
10689
10708
  */
10690
- value: number;
10709
+ readonly value: number;
10691
10710
  static readonly componentId = 'minecraft:scale';
10692
10711
  }
10693
10712
 
@@ -12533,8 +12552,6 @@ export class ItemStack {
12533
12552
  * Creates a new instance of a stack of items for use in the
12534
12553
  * world.
12535
12554
  *
12536
- * This function can't be called in read-only mode.
12537
- *
12538
12555
  * @param itemType
12539
12556
  * Type of item to create. See the {@link
12540
12557
  * @minecraft/vanilla-data.MinecraftItemTypes} enumeration for
@@ -12588,8 +12605,6 @@ export class ItemStack {
12588
12605
  * Gets a component (that represents additional capabilities)
12589
12606
  * for an item stack.
12590
12607
  *
12591
- * This function can't be called in read-only mode.
12592
- *
12593
12608
  * @param componentId
12594
12609
  * The identifier of the component (e.g., 'minecraft:food'). If
12595
12610
  * no namespace prefix is specified, 'minecraft:' is assumed.
@@ -12623,7 +12638,7 @@ export class ItemStack {
12623
12638
  * }
12624
12639
  * ```
12625
12640
  */
12626
- getComponent<T extends keyof ItemComponentTypeMap>(componentId: T): ItemComponentTypeMap[T] | undefined;
12641
+ getComponent<T extends string>(componentId: T): ItemComponentReturnType<T> | undefined;
12627
12642
  /**
12628
12643
  * @remarks
12629
12644
  * Returns all components that are both present on this item
@@ -13244,129 +13259,6 @@ export class ItemUseBeforeEventSignal {
13244
13259
  unsubscribe(callback: (arg0: ItemUseBeforeEvent) => void): void;
13245
13260
  }
13246
13261
 
13247
- /**
13248
- * Contains information related to an item being used on a
13249
- * block. This event fires when an item used by a player
13250
- * successfully triggers a block interaction.
13251
- */
13252
- export class ItemUseOnAfterEvent {
13253
- private constructor();
13254
- /**
13255
- * @remarks
13256
- * The block that the item is used on.
13257
- *
13258
- */
13259
- readonly block: Block;
13260
- /**
13261
- * @remarks
13262
- * The face of the block that an item is being used on.
13263
- *
13264
- */
13265
- readonly blockFace: Direction;
13266
- /**
13267
- * @remarks
13268
- * Location relative to the bottom north-west corner of the
13269
- * block where the item is placed.
13270
- *
13271
- */
13272
- readonly faceLocation: Vector3;
13273
- /**
13274
- * @remarks
13275
- * This value will be true if the event was triggered on
13276
- * players initial interaction button press and false on events
13277
- * triggered from holding the interaction button.
13278
- *
13279
- */
13280
- readonly isFirstEvent: boolean;
13281
- /**
13282
- * @remarks
13283
- * The impacted item stack that is being used on a block.
13284
- *
13285
- */
13286
- readonly itemStack: ItemStack;
13287
- /**
13288
- * @remarks
13289
- * Returns the source entity that triggered this item event.
13290
- *
13291
- */
13292
- readonly source: Player;
13293
- }
13294
-
13295
- /**
13296
- * Manages callbacks that are connected to an item being used
13297
- * on a block event.
13298
- */
13299
- export class ItemUseOnAfterEventSignal {
13300
- private constructor();
13301
- /**
13302
- * @remarks
13303
- * Adds a callback that will be called when an item is used on
13304
- * a block.
13305
- *
13306
- * This function can't be called in read-only mode.
13307
- *
13308
- * This function can be called in early-execution mode.
13309
- *
13310
- */
13311
- subscribe(callback: (arg0: ItemUseOnAfterEvent) => void): (arg0: ItemUseOnAfterEvent) => void;
13312
- /**
13313
- * @remarks
13314
- * Removes a callback from being called when an item is used on
13315
- * a block.
13316
- *
13317
- * This function can't be called in read-only mode.
13318
- *
13319
- * This function can be called in early-execution mode.
13320
- *
13321
- */
13322
- unsubscribe(callback: (arg0: ItemUseOnAfterEvent) => void): void;
13323
- }
13324
-
13325
- /**
13326
- * Contains information related to an item being used on a
13327
- * block.
13328
- */
13329
- // @ts-ignore Class inheritance allowed for native defined classes
13330
- export class ItemUseOnBeforeEvent extends ItemUseOnAfterEvent {
13331
- private constructor();
13332
- /**
13333
- * @remarks
13334
- * If set to true, this will cancel the item use behavior.
13335
- *
13336
- */
13337
- cancel: boolean;
13338
- }
13339
-
13340
- /**
13341
- * Manages callbacks that fire before an item being used on a
13342
- * block event.
13343
- */
13344
- export class ItemUseOnBeforeEventSignal {
13345
- private constructor();
13346
- /**
13347
- * @remarks
13348
- * Adds a callback that will be called before an item is used
13349
- * on a block.
13350
- *
13351
- * This function can't be called in read-only mode.
13352
- *
13353
- * This function can be called in early-execution mode.
13354
- *
13355
- */
13356
- subscribe(callback: (arg0: ItemUseOnBeforeEvent) => void): (arg0: ItemUseOnBeforeEvent) => void;
13357
- /**
13358
- * @remarks
13359
- * Removes a callback from being called before an item is used
13360
- * on a block.
13361
- *
13362
- * This function can't be called in read-only mode.
13363
- *
13364
- * This function can be called in early-execution mode.
13365
- *
13366
- */
13367
- unsubscribe(callback: (arg0: ItemUseOnBeforeEvent) => void): void;
13368
- }
13369
-
13370
13262
  /**
13371
13263
  * Contains information regarding the use of an item on a
13372
13264
  * block.
@@ -13530,8 +13422,6 @@ export class ListBlockVolume extends BlockVolumeBase {
13530
13422
  * @remarks
13531
13423
  * Creates a new instance of ListBlockVolume.
13532
13424
  *
13533
- * This function can't be called in read-only mode.
13534
- *
13535
13425
  * @param locations
13536
13426
  * Initial array of block locations that ListBlockVolume will
13537
13427
  * be constructed with.
@@ -17452,8 +17342,6 @@ export class Trigger {
17452
17342
  * @remarks
17453
17343
  * Creates a new trigger.
17454
17344
  *
17455
- * This function can't be called in read-only mode.
17456
- *
17457
17345
  */
17458
17346
  constructor(eventName: string);
17459
17347
  }
@@ -18462,15 +18350,6 @@ export class WorldAfterEvents {
18462
18350
  *
18463
18351
  */
18464
18352
  readonly itemUse: ItemUseAfterEventSignal;
18465
- /**
18466
- * @remarks
18467
- * This event fires when an item is used on a block by a
18468
- * player.
18469
- *
18470
- * This property can be read in early-execution mode.
18471
- *
18472
- */
18473
- readonly itemUseOn: ItemUseOnAfterEventSignal;
18474
18353
  /**
18475
18354
  * @remarks
18476
18355
  * A lever has been pulled.
@@ -18752,15 +18631,6 @@ export class WorldBeforeEvents {
18752
18631
  *
18753
18632
  */
18754
18633
  readonly itemUse: ItemUseBeforeEventSignal;
18755
- /**
18756
- * @remarks
18757
- * This event fires when an item is used on a block by a
18758
- * player.
18759
- *
18760
- * This property can be read in early-execution mode.
18761
- *
18762
- */
18763
- readonly itemUseOn: ItemUseOnBeforeEventSignal;
18764
18634
  /**
18765
18635
  * @remarks
18766
18636
  * This event fires before a block is broken by a player.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "2.0.0-beta.1.21.70-preview.24",
3
+ "version": "2.0.0-beta.1.21.70-preview.26",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {