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

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 +80 -16
  2. package/package.json +1 -1
package/index.d.ts CHANGED
@@ -2619,12 +2619,21 @@ export type EntityComponentTypeMap = {
2619
2619
  wants_jockey: EntityWantsJockeyComponent;
2620
2620
  };
2621
2621
 
2622
+ /**
2623
+ * @beta
2624
+ */
2625
+ export type EntityIdentifierType<T> = [T] extends [never]
2626
+ ? VanillaEntityIdentifier
2627
+ : T extends string
2628
+ ? VanillaEntityIdentifier | T
2629
+ : never;
2630
+
2622
2631
  /**
2623
2632
  * @rc
2624
2633
  */
2625
2634
  export type ItemComponentReturnType<T extends string> = T extends keyof ItemComponentTypeMap
2626
2635
  ? ItemComponentTypeMap[T]
2627
- : ItemComponent;
2636
+ : ItemCustomComponentInstance;
2628
2637
 
2629
2638
  /**
2630
2639
  * @rc
@@ -2646,6 +2655,15 @@ export type ItemComponentTypeMap = {
2646
2655
  potion: ItemPotionComponent;
2647
2656
  };
2648
2657
 
2658
+ /**
2659
+ * @beta
2660
+ */
2661
+ export type VanillaEntityIdentifier =
2662
+ | EntityType
2663
+ | minecraftvanilladata.MinecraftEntityTypes
2664
+ | `${minecraftvanilladata.MinecraftEntityTypes}`
2665
+ | `${minecraftvanilladata.MinecraftEntityTypes}<${string}>`;
2666
+
2649
2667
  /**
2650
2668
  * @beta
2651
2669
  * Handle to an aim-assist category that exists in the
@@ -3313,7 +3331,7 @@ export class Block {
3313
3331
  * @remarks
3314
3332
  * Checks to see whether it is valid to place the specified
3315
3333
  * block type or block permutation, on a specified face on this
3316
- * block
3334
+ * block.
3317
3335
  *
3318
3336
  * @param blockToPlace
3319
3337
  * Block type or block permutation to check placement for.
@@ -7093,7 +7111,11 @@ export class Dimension {
7093
7111
  * }
7094
7112
  * ```
7095
7113
  */
7096
- spawnEntity(identifier: EntityType | string, location: Vector3, options?: SpawnEntityOptions): Entity;
7114
+ spawnEntity<T = never>(
7115
+ identifier: EntityIdentifierType<NoInfer<T>>,
7116
+ location: Vector3,
7117
+ options?: SpawnEntityOptions,
7118
+ ): Entity;
7097
7119
  /**
7098
7120
  * @remarks
7099
7121
  * Creates a new item stack as an entity at the specified
@@ -9786,10 +9808,9 @@ export class EntityMarkVariantComponent extends EntityComponent {
9786
9808
  * @remarks
9787
9809
  * Value of the mark variant value for this entity.
9788
9810
  *
9789
- * This property can't be edited in read-only mode.
9790
- *
9811
+ * @throws This property can throw when used.
9791
9812
  */
9792
- value: number;
9813
+ readonly value: number;
9793
9814
  static readonly componentId = 'minecraft:mark_variant';
9794
9815
  }
9795
9816
 
@@ -10394,10 +10415,9 @@ export class EntityPushThroughComponent extends EntityComponent {
10394
10415
  * @remarks
10395
10416
  * Value of the push through distances of this entity.
10396
10417
  *
10397
- * This property can't be edited in read-only mode.
10398
- *
10418
+ * @throws This property can throw when used.
10399
10419
  */
10400
- value: number;
10420
+ readonly value: number;
10401
10421
  static readonly componentId = 'minecraft:push_through';
10402
10422
  }
10403
10423
 
@@ -11049,7 +11069,7 @@ export class EntityTypes {
11049
11069
  * Retrieves an entity type using a string-based identifier.
11050
11070
  *
11051
11071
  */
11052
- static get(identifier: string): EntityType | undefined;
11072
+ static get<T = never>(identifier: EntityIdentifierType<NoInfer<T>>): EntityType | undefined;
11053
11073
  /**
11054
11074
  * @remarks
11055
11075
  * Retrieves a set of all entity types within this world.
@@ -11999,6 +12019,15 @@ export class ItemCooldownComponent extends ItemComponent {
11999
12019
  startCooldown(player: Player): void;
12000
12020
  }
12001
12021
 
12022
+ /**
12023
+ * @beta
12024
+ * An instance of a custom component on an item.
12025
+ */
12026
+ // @ts-ignore Class inheritance allowed for native defined classes
12027
+ export class ItemCustomComponentInstance extends ItemComponent {
12028
+ private constructor();
12029
+ }
12030
+
12002
12031
  /**
12003
12032
  * When present on an item, this item can take damage in the
12004
12033
  * process of being used. Note that this component only applies
@@ -12608,8 +12637,9 @@ export class ItemStack {
12608
12637
  * @param componentId
12609
12638
  * The identifier of the component (e.g., 'minecraft:food'). If
12610
12639
  * no namespace prefix is specified, 'minecraft:' is assumed.
12611
- * Available component IDs can be found as part of the {@link
12612
- * ItemComponentTypes} enum.
12640
+ * Available component IDs are those in the {@link
12641
+ * ItemComponentTypes} enum and custom component IDs registered
12642
+ * with the {@link ItemComponentRegistry}.
12613
12643
  * @returns
12614
12644
  * Returns the component if it exists on the item stack,
12615
12645
  * otherwise undefined.
@@ -13815,7 +13845,7 @@ export class Player extends Entity {
13815
13845
  */
13816
13846
  addLevels(amount: number): number;
13817
13847
  /**
13818
- * @beta
13848
+ * @rc
13819
13849
  * @remarks
13820
13850
  * For this player, removes all overrides of any Entity
13821
13851
  * Properties on the target Entity. This change is not applied
@@ -13974,7 +14004,7 @@ export class Player extends Entity {
13974
14004
  */
13975
14005
  queueMusic(trackId: string, musicOptions?: MusicOptions): void;
13976
14006
  /**
13977
- * @beta
14007
+ * @rc
13978
14008
  * @remarks
13979
14009
  * For this player, removes the override on an Entity Property.
13980
14010
  * This change is not applied until the next tick and will not
@@ -14012,6 +14042,10 @@ export class Player extends Entity {
14012
14042
  * This method can throw if the provided {@link RawMessage} is
14013
14043
  * in an invalid format. For example, if an empty `name` string
14014
14044
  * is provided to `score`.
14045
+ *
14046
+ * {@link InvalidEntityError}
14047
+ *
14048
+ * {@link RawMessageError}
14015
14049
  * @example nestedTranslation.ts
14016
14050
  * ```typescript
14017
14051
  * import { world, DimensionLocation } from "@minecraft/server";
@@ -14111,7 +14145,7 @@ export class Player extends Entity {
14111
14145
  */
14112
14146
  setOp(isOp: boolean): void;
14113
14147
  /**
14114
- * @beta
14148
+ * @rc
14115
14149
  * @remarks
14116
14150
  * For this player, overrides an Entity Property on the target
14117
14151
  * Entity to the provided value. This property must be client
@@ -16224,6 +16258,8 @@ export class ScreenDisplay {
16224
16258
  * This function can't be called in read-only mode.
16225
16259
  *
16226
16260
  * @throws This function can throw errors.
16261
+ *
16262
+ * {@link InvalidEntityError}
16227
16263
  */
16228
16264
  getHiddenHudElements(): HudElement[];
16229
16265
  /**
@@ -16231,6 +16267,8 @@ export class ScreenDisplay {
16231
16267
  * This function can't be called in read-only mode.
16232
16268
  *
16233
16269
  * @throws This function can throw errors.
16270
+ *
16271
+ * {@link InvalidEntityError}
16234
16272
  */
16235
16273
  hideAllExcept(hudElements?: HudElement[]): void;
16236
16274
  /**
@@ -16238,15 +16276,20 @@ export class ScreenDisplay {
16238
16276
  * This function can't be called in read-only mode.
16239
16277
  *
16240
16278
  * @throws This function can throw errors.
16279
+ *
16280
+ * {@link InvalidEntityError}
16241
16281
  */
16242
16282
  isForcedHidden(hudElement: HudElement): boolean;
16243
16283
  /**
16284
+ * @beta
16244
16285
  * @remarks
16245
16286
  * This function can't be called in read-only mode.
16246
16287
  *
16247
16288
  * @throws This function can throw errors.
16289
+ *
16290
+ * {@link InvalidEntityError}
16248
16291
  */
16249
- resetHudElements(): void;
16292
+ resetHudElementsVisibility(): void;
16250
16293
  /**
16251
16294
  * @remarks
16252
16295
  * Set the action bar text - a piece of text that displays
@@ -16257,6 +16300,10 @@ export class ScreenDisplay {
16257
16300
  * @param text
16258
16301
  * New value for the action bar text.
16259
16302
  * @throws This function can throw errors.
16303
+ *
16304
+ * {@link InvalidEntityError}
16305
+ *
16306
+ * {@link RawMessageError}
16260
16307
  */
16261
16308
  setActionBar(text: (RawMessage | string)[] | RawMessage | string): void;
16262
16309
  /**
@@ -16272,6 +16319,8 @@ export class ScreenDisplay {
16272
16319
  * @param hudElements
16273
16320
  * Optional list of HUD elements to configure visibility for.
16274
16321
  * @throws This function can throw errors.
16322
+ *
16323
+ * {@link InvalidEntityError}
16275
16324
  */
16276
16325
  setHudVisibility(visible: HudVisibility, hudElements?: HudElement[]): void;
16277
16326
  /**
@@ -16284,6 +16333,12 @@ export class ScreenDisplay {
16284
16333
  * This function can't be called in read-only mode.
16285
16334
  *
16286
16335
  * @throws This function can throw errors.
16336
+ *
16337
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
16338
+ *
16339
+ * {@link InvalidEntityError}
16340
+ *
16341
+ * {@link RawMessageError}
16287
16342
  * @example setTitle.ts
16288
16343
  * ```typescript
16289
16344
  * import { world, DimensionLocation } from "@minecraft/server";
@@ -16349,6 +16404,10 @@ export class ScreenDisplay {
16349
16404
  * This function can't be called in read-only mode.
16350
16405
  *
16351
16406
  * @throws This function can throw errors.
16407
+ *
16408
+ * {@link InvalidEntityError}
16409
+ *
16410
+ * {@link RawMessageError}
16352
16411
  * @example countdown.ts
16353
16412
  * ```typescript
16354
16413
  * import { world, system, DimensionLocation } from "@minecraft/server";
@@ -21006,6 +21065,11 @@ export class PlaceJigsawError extends Error {
21006
21065
  private constructor();
21007
21066
  }
21008
21067
 
21068
+ // @ts-ignore Class inheritance allowed for native defined classes
21069
+ export class RawMessageError extends Error {
21070
+ private constructor();
21071
+ }
21072
+
21009
21073
  /**
21010
21074
  * Error thrown when the specified area contains one or more
21011
21075
  * unloaded chunks.
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.26",
3
+ "version": "2.0.0-beta.1.21.80-preview.21",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {