@minecraft/server 1.1.0-beta.preview.1.19.60.20 → 1.1.0-beta.release.1.19.50

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 +0 -2
  2. package/index.d.ts +142 -74
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,8 +2,6 @@
2
2
 
3
3
  Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.
4
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
5
  See full documentation for this module here:
8
6
 
9
7
  https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/@minecraft/server/@minecraft/server
package/index.d.ts CHANGED
@@ -15,7 +15,7 @@
15
15
  * ```json
16
16
  * {
17
17
  * "module_name": "@minecraft/server",
18
- * "version": "1.1.0-internal.preview.1.19.60.20"
18
+ * "version": "1.0.0"
19
19
  * }
20
20
  * ```
21
21
  *
@@ -984,8 +984,6 @@ export class BlockInventoryComponentContainer extends Container {
984
984
  * @throws This function can throw errors.
985
985
  */
986
986
  addItem(itemStack: ItemStack): void;
987
- clearAll(): void;
988
- clearItem(slot: number): void;
989
987
  /**
990
988
  * @remarks
991
989
  * Gets the item stack for the set of items at the specified
@@ -1002,7 +1000,6 @@ export class BlockInventoryComponentContainer extends Container {
1002
1000
  * ```
1003
1001
  */
1004
1002
  getItem(slot: number): ItemStack;
1005
- getSlot(slot: number): ContainerSlot;
1006
1003
  /**
1007
1004
  * @remarks
1008
1005
  * Sets an item stack within a particular slot.
@@ -1012,7 +1009,7 @@ export class BlockInventoryComponentContainer extends Container {
1012
1009
  * Stack of items to place within the specified slot.
1013
1010
  * @throws This function can throw errors.
1014
1011
  */
1015
- setItem(slot: number, itemStack?: ItemStack): void;
1012
+ setItem(slot: number, itemStack: ItemStack): void;
1016
1013
  /**
1017
1014
  * @remarks
1018
1015
  * Swaps items between two different slots within containers.
@@ -2300,8 +2297,6 @@ export class Container {
2300
2297
  * @throws This function can throw errors.
2301
2298
  */
2302
2299
  addItem(itemStack: ItemStack): void;
2303
- clearAll(): void;
2304
- clearItem(slot: number): void;
2305
2300
  /**
2306
2301
  * @remarks
2307
2302
  * Gets the item stack for the set of items at the specified
@@ -2322,7 +2317,6 @@ export class Container {
2322
2317
  * ```
2323
2318
  */
2324
2319
  getItem(slot: number): ItemStack;
2325
- getSlot(slot: number): ContainerSlot;
2326
2320
  /**
2327
2321
  * @remarks
2328
2322
  * Sets an item stack within a particular slot.
@@ -2332,7 +2326,7 @@ export class Container {
2332
2326
  * Stack of items to place within the specified slot.
2333
2327
  * @throws This function can throw errors.
2334
2328
  */
2335
- setItem(slot: number, itemStack?: ItemStack): void;
2329
+ setItem(slot: number, itemStack: ItemStack): void;
2336
2330
  /**
2337
2331
  * @remarks
2338
2332
  * Swaps items between two different slots within containers.
@@ -2370,19 +2364,6 @@ export class Container {
2370
2364
  */
2371
2365
  transferItem(fromSlot: number, toSlot: number, toContainer: Container): boolean;
2372
2366
  }
2373
- export class ContainerSlot {
2374
- protected constructor();
2375
- amount: number;
2376
- data: number;
2377
- readonly isValid: boolean;
2378
- nameTag?: string;
2379
- readonly typeId?: string;
2380
- clearItem(): void;
2381
- getItem(): ItemStack;
2382
- getLore(): string[];
2383
- setItem(itemStack?: ItemStack): void;
2384
- setLore(loreList: string[]): void;
2385
- }
2386
2367
  /**
2387
2368
  * Contains information related to firing of a data driven
2388
2369
  * entity event - for example, the minecraft:ageable_grow_up
@@ -2996,7 +2977,11 @@ export class Entity {
2996
2977
  * @throws This property can throw when used.
2997
2978
  */
2998
2979
  readonly velocity: Vector;
2999
- readonly viewDirection: Vector3;
2980
+ /**
2981
+ * Vector of the current view of the entity.
2982
+ * @throws This property can throw when used.
2983
+ */
2984
+ readonly viewVector: Vector;
3000
2985
  /**
3001
2986
  * @remarks
3002
2987
  * Adds an effect, like poison, to the entity.
@@ -3045,7 +3030,15 @@ export class Entity {
3045
3030
  * @throws This function can throw errors.
3046
3031
  */
3047
3032
  addTag(tag: string): boolean;
3048
- getBlockFromViewDirection(options?: BlockRaycastOptions): Block;
3033
+ /**
3034
+ * @remarks
3035
+ * Gets the first block that intersects with the vector of the
3036
+ * view of this entity.
3037
+ * @param options
3038
+ * Additional options for processing this raycast query.
3039
+ * @throws This function can throw errors.
3040
+ */
3041
+ getBlockFromViewVector(options?: BlockRaycastOptions): Block;
3049
3042
  /**
3050
3043
  * @remarks
3051
3044
  * Gets a component (that represents additional capabilities)
@@ -3084,7 +3077,15 @@ export class Entity {
3084
3077
  * @throws This function can throw errors.
3085
3078
  */
3086
3079
  getEffect(effectType: EffectType): Effect;
3087
- getEntitiesFromViewDirection(options?: EntityRaycastOptions): Entity[];
3080
+ /**
3081
+ * @remarks
3082
+ * Gets the first entity that intersects with the vector of the
3083
+ * view of this entity.
3084
+ * @param options
3085
+ * Additional options for processing this raycast query.
3086
+ * @throws This function can throw errors.
3087
+ */
3088
+ getEntitiesFromViewVector(options?: EntityRaycastOptions): Entity[];
3088
3089
  /**
3089
3090
  * @remarks
3090
3091
  * Returns all tags associated with an entity.
@@ -3437,6 +3438,60 @@ export class EntityColorComponent extends IEntityComponent {
3437
3438
  */
3438
3439
  static readonly componentId = 'minecraft:color';
3439
3440
  }
3441
+ /**
3442
+ * Contains information related to the creation of a new
3443
+ * entity.
3444
+ */
3445
+ export class EntityCreateEvent {
3446
+ protected constructor();
3447
+ /**
3448
+ * New entity that was created.
3449
+ */
3450
+ entity: Entity;
3451
+ }
3452
+ /**
3453
+ * Manages callbacks that are connected to when a new entity is
3454
+ * created.
3455
+ */
3456
+ export class EntityCreateEventSignal {
3457
+ protected constructor();
3458
+ /**
3459
+ * @remarks
3460
+ * Adds a callback that will be called when a new entity is
3461
+ * created.
3462
+ * @param callback
3463
+ * @example runEntityCreatedEvent.ts
3464
+ * ```typescript
3465
+ * // register a new function that is called when a new entity is created.
3466
+ * const entityCreatedCallback = mc.world.events.entityCreate.subscribe((entityEvent: mc.EntityCreateEvent) => {
3467
+ * if (entityEvent && entityEvent.entity) {
3468
+ * log("New entity of type '" + +entityEvent.entity + "' created!", 1);
3469
+ * } else {
3470
+ * log("The entity event didn't work as expected.", -1);
3471
+ * }
3472
+ * });
3473
+ * ```
3474
+ */
3475
+ subscribe(callback: (arg: EntityCreateEvent) => void): (arg: EntityCreateEvent) => void;
3476
+ /**
3477
+ * @remarks
3478
+ * Removes a callback from being called when a new entity is
3479
+ * created.
3480
+ * @param callback
3481
+ * @throws This function can throw errors.
3482
+ * @example unsubscribeEntityCreatedEvent.ts
3483
+ * ```typescript
3484
+ * if (entityCreatedCallbacks.length > 0) {
3485
+ * let callback = entityCreatedCallbacks.pop();
3486
+ *
3487
+ * if (callback) {
3488
+ * mc.world.events.entityCreate.unsubscribe(callback);
3489
+ * }
3490
+ * }
3491
+ * ```
3492
+ */
3493
+ unsubscribe(callback: (arg: EntityCreateEvent) => void): void;
3494
+ }
3440
3495
  /**
3441
3496
  * As part of the Ageable component, represents a set of items
3442
3497
  * that can be fed to an entity and the rate at which that
@@ -5392,15 +5447,6 @@ export class EntitySkinIdComponent extends IEntityComponent {
5392
5447
  */
5393
5448
  static readonly componentId = 'minecraft:skin_id';
5394
5449
  }
5395
- export class EntitySpawnEvent {
5396
- protected constructor();
5397
- entity: Entity;
5398
- }
5399
- export class EntitySpawnEventSignal {
5400
- protected constructor();
5401
- subscribe(callback: (arg: EntitySpawnEvent) => void): (arg: EntitySpawnEvent) => void;
5402
- unsubscribe(callback: (arg: EntitySpawnEvent) => void): void;
5403
- }
5404
5450
  /**
5405
5451
  * Defines the entity's strength to carry items.
5406
5452
  */
@@ -5682,6 +5728,10 @@ export class Events {
5682
5728
  * an entity.
5683
5729
  */
5684
5730
  readonly effectAdd: EffectAddEventSignal;
5731
+ /**
5732
+ * This event fires when a new entity is created.
5733
+ */
5734
+ readonly entityCreate: EntityCreateEventSignal;
5685
5735
  /**
5686
5736
  * This event fires when an entity hits (makes a melee attack)
5687
5737
  * and potentially impacts another entity or block.
@@ -5691,7 +5741,6 @@ export class Events {
5691
5741
  * This event fires when an entity is hurt (takes damage).
5692
5742
  */
5693
5743
  readonly entityHurt: EntityHurtEventSignal;
5694
- readonly entitySpawn: EntitySpawnEventSignal;
5695
5744
  /**
5696
5745
  * This event is fired after an explosion occurs.
5697
5746
  */
@@ -5761,7 +5810,6 @@ export class Events {
5761
5810
  * This event fires when a player leaves a world.
5762
5811
  */
5763
5812
  readonly playerLeave: PlayerLeaveEventSignal;
5764
- readonly playerSpawn: PlayerSpawnEventSignal;
5765
5813
  /**
5766
5814
  * This event fires when a projectile hits an entity or block.
5767
5815
  */
@@ -5970,8 +6018,6 @@ export class InventoryComponentContainer extends Container {
5970
6018
  * @throws This function can throw errors.
5971
6019
  */
5972
6020
  addItem(itemStack: ItemStack): void;
5973
- clearAll(): void;
5974
- clearItem(slot: number): void;
5975
6021
  /**
5976
6022
  * @remarks
5977
6023
  * Gets the item stack for the set of items at the specified
@@ -5988,7 +6034,6 @@ export class InventoryComponentContainer extends Container {
5988
6034
  * ```
5989
6035
  */
5990
6036
  getItem(slot: number): ItemStack;
5991
- getSlot(slot: number): ContainerSlot;
5992
6037
  /**
5993
6038
  * @remarks
5994
6039
  * Sets an item stack within a particular slot.
@@ -5998,7 +6043,7 @@ export class InventoryComponentContainer extends Container {
5998
6043
  * Stack of items to place within the specified slot.
5999
6044
  * @throws This function can throw errors.
6000
6045
  */
6001
- setItem(slot: number, itemStack?: ItemStack): void;
6046
+ setItem(slot: number, itemStack: ItemStack): void;
6002
6047
  /**
6003
6048
  * @remarks
6004
6049
  * Swaps items between two different slots within containers.
@@ -6883,7 +6928,6 @@ export class MinecraftBlockTypes {
6883
6928
  * Represents a bamboo tree within Minecraft.
6884
6929
  */
6885
6930
  static readonly bamboo: BlockType;
6886
- static readonly bambooBlock: BlockType;
6887
6931
  static readonly bambooButton: BlockType;
6888
6932
  static readonly bambooDoor: BlockType;
6889
6933
  static readonly bambooDoubleSlab: BlockType;
@@ -9465,7 +9509,6 @@ export class MinecraftBlockTypes {
9465
9509
  * Represents a stripped acacia log within Minecraft.
9466
9510
  */
9467
9511
  static readonly strippedAcaciaLog: BlockType;
9468
- static readonly strippedBambooBlock: BlockType;
9469
9512
  /**
9470
9513
  * Represents a stripped birch log within Minecraft.
9471
9514
  */
@@ -11016,7 +11059,6 @@ export class MinecraftItemTypes {
11016
11059
  * Minecraft.
11017
11060
  */
11018
11061
  static readonly enderChest: ItemType;
11019
- static readonly enderDragonSpawnEgg: ItemType;
11020
11062
  static readonly enderEye: ItemType;
11021
11063
  static readonly endermanSpawnEgg: ItemType;
11022
11064
  static readonly endermiteSpawnEgg: ItemType;
@@ -11302,7 +11344,6 @@ export class MinecraftItemTypes {
11302
11344
  * Minecraft.
11303
11345
  */
11304
11346
  static readonly ironDoor: ItemType;
11305
- static readonly ironGolemSpawnEgg: ItemType;
11306
11347
  static readonly ironHelmet: ItemType;
11307
11348
  static readonly ironHoe: ItemType;
11308
11349
  static readonly ironHorseArmor: ItemType;
@@ -12184,7 +12225,6 @@ export class MinecraftItemTypes {
12184
12225
  */
12185
12226
  static readonly snow: ItemType;
12186
12227
  static readonly snowball: ItemType;
12187
- static readonly snowGolemSpawnEgg: ItemType;
12188
12228
  /**
12189
12229
  * Represents an item that can place a layer of snow within
12190
12230
  * Minecraft.
@@ -12686,7 +12726,6 @@ export class MinecraftItemTypes {
12686
12726
  */
12687
12727
  static readonly witherRose: ItemType;
12688
12728
  static readonly witherSkeletonSpawnEgg: ItemType;
12689
- static readonly witherSpawnEgg: ItemType;
12690
12729
  static readonly wolfSpawnEgg: ItemType;
12691
12730
  /**
12692
12731
  * Represents an item that can place a block of wood within
@@ -12964,7 +13003,11 @@ export class Player extends Entity {
12964
13003
  * @throws This property can throw when used.
12965
13004
  */
12966
13005
  readonly velocity: Vector;
12967
- readonly viewDirection: Vector3;
13006
+ /**
13007
+ * Vector of the current view of the player.
13008
+ * @throws This property can throw when used.
13009
+ */
13010
+ readonly viewVector: Vector;
12968
13011
  /**
12969
13012
  * @remarks
12970
13013
  * Adds an effect, like poison, to the entity.
@@ -12986,7 +13029,15 @@ export class Player extends Entity {
12986
13029
  * @throws This function can throw errors.
12987
13030
  */
12988
13031
  addTag(tag: string): boolean;
12989
- getBlockFromViewDirection(options?: BlockRaycastOptions): Block;
13032
+ /**
13033
+ * @remarks
13034
+ * Gets the first block that intersects with the vector of the
13035
+ * view of this entity.
13036
+ * @param options
13037
+ * Additional options for processing this raycast query.
13038
+ * @throws This function can throw errors.
13039
+ */
13040
+ getBlockFromViewVector(options?: BlockRaycastOptions): Block;
12990
13041
  /**
12991
13042
  * @remarks
12992
13043
  * Gets a component (that represents additional capabilities)
@@ -13025,7 +13076,15 @@ export class Player extends Entity {
13025
13076
  * @throws This function can throw errors.
13026
13077
  */
13027
13078
  getEffect(effectType: EffectType): Effect;
13028
- getEntitiesFromViewDirection(options?: EntityRaycastOptions): Entity[];
13079
+ /**
13080
+ * @remarks
13081
+ * Gets the first entity that intersects with the vector of the
13082
+ * view of this entity.
13083
+ * @param options
13084
+ * Additional options for processing this raycast query.
13085
+ * @throws This function can throw errors.
13086
+ */
13087
+ getEntitiesFromViewVector(options?: EntityRaycastOptions): Entity[];
13029
13088
  /**
13030
13089
  * @remarks
13031
13090
  * Gets the current item cooldown time for a particular
@@ -13187,7 +13246,7 @@ export class Player extends Entity {
13187
13246
  * @param message
13188
13247
  * @throws This function can throw errors.
13189
13248
  */
13190
- tell(message: RawMessage | string): void;
13249
+ tell(message: IRawMessage | string): void;
13191
13250
  /**
13192
13251
  * @remarks
13193
13252
  * Triggers an entity type event. For every entity, a number of
@@ -13228,8 +13287,6 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13228
13287
  * @throws This function can throw errors.
13229
13288
  */
13230
13289
  addItem(itemStack: ItemStack): void;
13231
- clearAll(): void;
13232
- clearItem(slot: number): void;
13233
13290
  /**
13234
13291
  * @remarks
13235
13292
  * Gets the item stack for the set of items at the specified
@@ -13240,7 +13297,6 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13240
13297
  * @throws This function can throw errors.
13241
13298
  */
13242
13299
  getItem(slot: number): ItemStack;
13243
- getSlot(slot: number): ContainerSlot;
13244
13300
  /**
13245
13301
  * @remarks
13246
13302
  * Sets an item stack within a particular slot.
@@ -13250,7 +13306,7 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13250
13306
  * Stack of items to place within the specified slot.
13251
13307
  * @throws This function can throw errors.
13252
13308
  */
13253
- setItem(slot: number, itemStack?: ItemStack): void;
13309
+ setItem(slot: number, itemStack: ItemStack): void;
13254
13310
  /**
13255
13311
  * @remarks
13256
13312
  * Swaps items between two different slots within containers.
@@ -13299,8 +13355,10 @@ export class PlayerIterator implements Iterable<Player> {
13299
13355
  */
13300
13356
  export class PlayerJoinEvent {
13301
13357
  protected constructor();
13302
- readonly playerId: string;
13303
- readonly playerName: string;
13358
+ /**
13359
+ * Player that has joined the world.
13360
+ */
13361
+ player: Player;
13304
13362
  }
13305
13363
  /**
13306
13364
  * Manages callbacks that are connected to a player joining the
@@ -13330,7 +13388,6 @@ export class PlayerJoinEventSignal {
13330
13388
  */
13331
13389
  export class PlayerLeaveEvent {
13332
13390
  protected constructor();
13333
- readonly playerId: string;
13334
13391
  /**
13335
13392
  * Player that has left the world.
13336
13393
  */
@@ -13358,16 +13415,6 @@ export class PlayerLeaveEventSignal {
13358
13415
  */
13359
13416
  unsubscribe(callback: (arg: PlayerLeaveEvent) => void): void;
13360
13417
  }
13361
- export class PlayerSpawnEvent {
13362
- protected constructor();
13363
- initialSpawn: boolean;
13364
- player: Player;
13365
- }
13366
- export class PlayerSpawnEventSignal {
13367
- protected constructor();
13368
- subscribe(callback: (arg: PlayerSpawnEvent) => void): (arg: PlayerSpawnEvent) => void;
13369
- unsubscribe(callback: (arg: PlayerSpawnEvent) => void): void;
13370
- }
13371
13418
  /**
13372
13419
  * Contains information related to a projectile hitting an
13373
13420
  * entity or block.
@@ -14116,7 +14163,7 @@ export class World {
14116
14163
  * @param message
14117
14164
  * @throws This function can throw errors.
14118
14165
  */
14119
- say(message: RawMessage | string): void;
14166
+ say(message: IRawMessage | string): void;
14120
14167
  /**
14121
14168
  * @remarks
14122
14169
  * Sets a specified property to a value.
@@ -14445,6 +14492,33 @@ export interface ExplosionOptions {
14445
14492
  */
14446
14493
  source?: Entity;
14447
14494
  }
14495
+ /**
14496
+ * An interface that describes the signature of a message that
14497
+ * is passed into a say/tell API request.
14498
+ */
14499
+ // tslint:disable-next-line:interface-name
14500
+ export interface IRawMessage {
14501
+ /**
14502
+ * A list of text objects used to build a message.
14503
+ */
14504
+ rawtext?: IRawMessage[] | string[];
14505
+ /**
14506
+ * Contains plain text to display directly. Only valid when
14507
+ * used as a sub member in a parent _rawtext_ or _with_ member.
14508
+ */
14509
+ text?: string;
14510
+ /**
14511
+ * Contains a resource pack translation identifier that can be
14512
+ * used to translate text in the player's selected language.
14513
+ */
14514
+ translate?: string;
14515
+ /**
14516
+ * A list of text object arguments that can be used to fill
14517
+ * values in the _translate_ text. Ignored when _translate_ is
14518
+ * not present.
14519
+ */
14520
+ with?: IRawMessage[] | string[];
14521
+ }
14448
14522
  /**
14449
14523
  * Additional configuration options for {@link
14450
14524
  * World.playMusic}/{@link World.queueMusic} methods.
@@ -14463,12 +14537,6 @@ export interface MusicOptions {
14463
14537
  */
14464
14538
  volume?: number;
14465
14539
  }
14466
- export interface RawMessage {
14467
- rawtext?: RawMessage[] | string[];
14468
- text?: string;
14469
- translate?: string;
14470
- with?: RawMessage[] | string[];
14471
- }
14472
14540
  /**
14473
14541
  * Contains additional options for how a scoreboard should be
14474
14542
  * displayed within its display slot.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.1.0-beta.preview.1.19.60.20",
3
+ "version": "1.1.0-beta.release.1.19.50",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {