@minecraft/server 1.1.0-beta.preview.1.19.50.25 → 1.1.0-beta.preview.1.19.60.22

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 +98 -142
  2. package/package.json +1 -1
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.50.25"
18
+ * "version": "1.1.0-internal.preview.1.19.60.22"
19
19
  * }
20
20
  * ```
21
21
  *
@@ -162,6 +162,8 @@ export enum GameMode {
162
162
  }
163
163
  export enum MessageSourceType {
164
164
  clientScript = 'clientScript',
165
+ commandBlock = 'commandBlock',
166
+ dialogueCommand = 'dialogueCommand',
165
167
  entityCommand = 'entityCommand',
166
168
  serverCommand = 'serverCommand',
167
169
  serverScript = 'serverScript',
@@ -696,6 +698,7 @@ export class Block {
696
698
  * @throws This function can throw errors.
697
699
  */
698
700
  getComponent(componentName: string): any;
701
+ getRedstonePower(): number;
699
702
  /**
700
703
  * @returns
701
704
  * The list of tags that the block has.
@@ -984,6 +987,8 @@ export class BlockInventoryComponentContainer extends Container {
984
987
  * @throws This function can throw errors.
985
988
  */
986
989
  addItem(itemStack: ItemStack): void;
990
+ clearAll(): void;
991
+ clearItem(slot: number): void;
987
992
  /**
988
993
  * @remarks
989
994
  * Gets the item stack for the set of items at the specified
@@ -1000,6 +1005,7 @@ export class BlockInventoryComponentContainer extends Container {
1000
1005
  * ```
1001
1006
  */
1002
1007
  getItem(slot: number): ItemStack;
1008
+ getSlot(slot: number): ContainerSlot;
1003
1009
  /**
1004
1010
  * @remarks
1005
1011
  * Sets an item stack within a particular slot.
@@ -1009,7 +1015,7 @@ export class BlockInventoryComponentContainer extends Container {
1009
1015
  * Stack of items to place within the specified slot.
1010
1016
  * @throws This function can throw errors.
1011
1017
  */
1012
- setItem(slot: number, itemStack: ItemStack): void;
1018
+ setItem(slot: number, itemStack?: ItemStack): void;
1013
1019
  /**
1014
1020
  * @remarks
1015
1021
  * Swaps items between two different slots within containers.
@@ -2297,6 +2303,8 @@ export class Container {
2297
2303
  * @throws This function can throw errors.
2298
2304
  */
2299
2305
  addItem(itemStack: ItemStack): void;
2306
+ clearAll(): void;
2307
+ clearItem(slot: number): void;
2300
2308
  /**
2301
2309
  * @remarks
2302
2310
  * Gets the item stack for the set of items at the specified
@@ -2317,6 +2325,7 @@ export class Container {
2317
2325
  * ```
2318
2326
  */
2319
2327
  getItem(slot: number): ItemStack;
2328
+ getSlot(slot: number): ContainerSlot;
2320
2329
  /**
2321
2330
  * @remarks
2322
2331
  * Sets an item stack within a particular slot.
@@ -2326,7 +2335,7 @@ export class Container {
2326
2335
  * Stack of items to place within the specified slot.
2327
2336
  * @throws This function can throw errors.
2328
2337
  */
2329
- setItem(slot: number, itemStack: ItemStack): void;
2338
+ setItem(slot: number, itemStack?: ItemStack): void;
2330
2339
  /**
2331
2340
  * @remarks
2332
2341
  * Swaps items between two different slots within containers.
@@ -2364,6 +2373,19 @@ export class Container {
2364
2373
  */
2365
2374
  transferItem(fromSlot: number, toSlot: number, toContainer: Container): boolean;
2366
2375
  }
2376
+ export class ContainerSlot {
2377
+ protected constructor();
2378
+ amount: number;
2379
+ data: number;
2380
+ readonly isValid: boolean;
2381
+ nameTag?: string;
2382
+ readonly typeId?: string;
2383
+ clearItem(): void;
2384
+ getItem(): ItemStack;
2385
+ getLore(): string[];
2386
+ setItem(itemStack?: ItemStack): void;
2387
+ setLore(loreList: string[]): void;
2388
+ }
2367
2389
  /**
2368
2390
  * Contains information related to firing of a data driven
2369
2391
  * entity event - for example, the minecraft:ageable_grow_up
@@ -2977,11 +2999,7 @@ export class Entity {
2977
2999
  * @throws This property can throw when used.
2978
3000
  */
2979
3001
  readonly velocity: Vector;
2980
- /**
2981
- * Vector of the current view of the entity.
2982
- * @throws This property can throw when used.
2983
- */
2984
- readonly viewVector: Vector;
3002
+ readonly viewDirection: Vector3;
2985
3003
  /**
2986
3004
  * @remarks
2987
3005
  * Adds an effect, like poison, to the entity.
@@ -3030,15 +3048,7 @@ export class Entity {
3030
3048
  * @throws This function can throw errors.
3031
3049
  */
3032
3050
  addTag(tag: string): boolean;
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;
3051
+ getBlockFromViewDirection(options?: BlockRaycastOptions): Block;
3042
3052
  /**
3043
3053
  * @remarks
3044
3054
  * Gets a component (that represents additional capabilities)
@@ -3077,15 +3087,7 @@ export class Entity {
3077
3087
  * @throws This function can throw errors.
3078
3088
  */
3079
3089
  getEffect(effectType: EffectType): Effect;
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[];
3090
+ getEntitiesFromViewDirection(options?: EntityRaycastOptions): Entity[];
3089
3091
  /**
3090
3092
  * @remarks
3091
3093
  * Returns all tags associated with an entity.
@@ -3438,60 +3440,6 @@ export class EntityColorComponent extends IEntityComponent {
3438
3440
  */
3439
3441
  static readonly componentId = 'minecraft:color';
3440
3442
  }
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
- }
3495
3443
  /**
3496
3444
  * As part of the Ageable component, represents a set of items
3497
3445
  * that can be fed to an entity and the rate at which that
@@ -5447,6 +5395,15 @@ export class EntitySkinIdComponent extends IEntityComponent {
5447
5395
  */
5448
5396
  static readonly componentId = 'minecraft:skin_id';
5449
5397
  }
5398
+ export class EntitySpawnEvent {
5399
+ protected constructor();
5400
+ entity: Entity;
5401
+ }
5402
+ export class EntitySpawnEventSignal {
5403
+ protected constructor();
5404
+ subscribe(callback: (arg: EntitySpawnEvent) => void): (arg: EntitySpawnEvent) => void;
5405
+ unsubscribe(callback: (arg: EntitySpawnEvent) => void): void;
5406
+ }
5450
5407
  /**
5451
5408
  * Defines the entity's strength to carry items.
5452
5409
  */
@@ -5728,10 +5685,6 @@ export class Events {
5728
5685
  * an entity.
5729
5686
  */
5730
5687
  readonly effectAdd: EffectAddEventSignal;
5731
- /**
5732
- * This event fires when a new entity is created.
5733
- */
5734
- readonly entityCreate: EntityCreateEventSignal;
5735
5688
  /**
5736
5689
  * This event fires when an entity hits (makes a melee attack)
5737
5690
  * and potentially impacts another entity or block.
@@ -5741,6 +5694,7 @@ export class Events {
5741
5694
  * This event fires when an entity is hurt (takes damage).
5742
5695
  */
5743
5696
  readonly entityHurt: EntityHurtEventSignal;
5697
+ readonly entitySpawn: EntitySpawnEventSignal;
5744
5698
  /**
5745
5699
  * This event is fired after an explosion occurs.
5746
5700
  */
@@ -5810,6 +5764,7 @@ export class Events {
5810
5764
  * This event fires when a player leaves a world.
5811
5765
  */
5812
5766
  readonly playerLeave: PlayerLeaveEventSignal;
5767
+ readonly playerSpawn: PlayerSpawnEventSignal;
5813
5768
  /**
5814
5769
  * This event fires when a projectile hits an entity or block.
5815
5770
  */
@@ -6018,6 +5973,8 @@ export class InventoryComponentContainer extends Container {
6018
5973
  * @throws This function can throw errors.
6019
5974
  */
6020
5975
  addItem(itemStack: ItemStack): void;
5976
+ clearAll(): void;
5977
+ clearItem(slot: number): void;
6021
5978
  /**
6022
5979
  * @remarks
6023
5980
  * Gets the item stack for the set of items at the specified
@@ -6034,6 +5991,7 @@ export class InventoryComponentContainer extends Container {
6034
5991
  * ```
6035
5992
  */
6036
5993
  getItem(slot: number): ItemStack;
5994
+ getSlot(slot: number): ContainerSlot;
6037
5995
  /**
6038
5996
  * @remarks
6039
5997
  * Sets an item stack within a particular slot.
@@ -6043,7 +6001,7 @@ export class InventoryComponentContainer extends Container {
6043
6001
  * Stack of items to place within the specified slot.
6044
6002
  * @throws This function can throw errors.
6045
6003
  */
6046
- setItem(slot: number, itemStack: ItemStack): void;
6004
+ setItem(slot: number, itemStack?: ItemStack): void;
6047
6005
  /**
6048
6006
  * @remarks
6049
6007
  * Swaps items between two different slots within containers.
@@ -6928,6 +6886,7 @@ export class MinecraftBlockTypes {
6928
6886
  * Represents a bamboo tree within Minecraft.
6929
6887
  */
6930
6888
  static readonly bamboo: BlockType;
6889
+ static readonly bambooBlock: BlockType;
6931
6890
  static readonly bambooButton: BlockType;
6932
6891
  static readonly bambooDoor: BlockType;
6933
6892
  static readonly bambooDoubleSlab: BlockType;
@@ -9509,6 +9468,7 @@ export class MinecraftBlockTypes {
9509
9468
  * Represents a stripped acacia log within Minecraft.
9510
9469
  */
9511
9470
  static readonly strippedAcaciaLog: BlockType;
9471
+ static readonly strippedBambooBlock: BlockType;
9512
9472
  /**
9513
9473
  * Represents a stripped birch log within Minecraft.
9514
9474
  */
@@ -11059,6 +11019,7 @@ export class MinecraftItemTypes {
11059
11019
  * Minecraft.
11060
11020
  */
11061
11021
  static readonly enderChest: ItemType;
11022
+ static readonly enderDragonSpawnEgg: ItemType;
11062
11023
  static readonly enderEye: ItemType;
11063
11024
  static readonly endermanSpawnEgg: ItemType;
11064
11025
  static readonly endermiteSpawnEgg: ItemType;
@@ -11344,6 +11305,7 @@ export class MinecraftItemTypes {
11344
11305
  * Minecraft.
11345
11306
  */
11346
11307
  static readonly ironDoor: ItemType;
11308
+ static readonly ironGolemSpawnEgg: ItemType;
11347
11309
  static readonly ironHelmet: ItemType;
11348
11310
  static readonly ironHoe: ItemType;
11349
11311
  static readonly ironHorseArmor: ItemType;
@@ -12225,6 +12187,7 @@ export class MinecraftItemTypes {
12225
12187
  */
12226
12188
  static readonly snow: ItemType;
12227
12189
  static readonly snowball: ItemType;
12190
+ static readonly snowGolemSpawnEgg: ItemType;
12228
12191
  /**
12229
12192
  * Represents an item that can place a layer of snow within
12230
12193
  * Minecraft.
@@ -12726,6 +12689,7 @@ export class MinecraftItemTypes {
12726
12689
  */
12727
12690
  static readonly witherRose: ItemType;
12728
12691
  static readonly witherSkeletonSpawnEgg: ItemType;
12692
+ static readonly witherSpawnEgg: ItemType;
12729
12693
  static readonly wolfSpawnEgg: ItemType;
12730
12694
  /**
12731
12695
  * Represents an item that can place a block of wood within
@@ -13003,11 +12967,7 @@ export class Player extends Entity {
13003
12967
  * @throws This property can throw when used.
13004
12968
  */
13005
12969
  readonly velocity: Vector;
13006
- /**
13007
- * Vector of the current view of the player.
13008
- * @throws This property can throw when used.
13009
- */
13010
- readonly viewVector: Vector;
12970
+ readonly viewDirection: Vector3;
13011
12971
  /**
13012
12972
  * @remarks
13013
12973
  * Adds an effect, like poison, to the entity.
@@ -13029,15 +12989,7 @@ export class Player extends Entity {
13029
12989
  * @throws This function can throw errors.
13030
12990
  */
13031
12991
  addTag(tag: string): boolean;
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;
12992
+ getBlockFromViewDirection(options?: BlockRaycastOptions): Block;
13041
12993
  /**
13042
12994
  * @remarks
13043
12995
  * Gets a component (that represents additional capabilities)
@@ -13076,15 +13028,7 @@ export class Player extends Entity {
13076
13028
  * @throws This function can throw errors.
13077
13029
  */
13078
13030
  getEffect(effectType: EffectType): Effect;
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[];
13031
+ getEntitiesFromViewDirection(options?: EntityRaycastOptions): Entity[];
13088
13032
  /**
13089
13033
  * @remarks
13090
13034
  * Gets the current item cooldown time for a particular
@@ -13246,7 +13190,7 @@ export class Player extends Entity {
13246
13190
  * @param message
13247
13191
  * @throws This function can throw errors.
13248
13192
  */
13249
- tell(message: IRawMessage | string): void;
13193
+ tell(message: RawMessage | string): void;
13250
13194
  /**
13251
13195
  * @remarks
13252
13196
  * Triggers an entity type event. For every entity, a number of
@@ -13287,6 +13231,8 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13287
13231
  * @throws This function can throw errors.
13288
13232
  */
13289
13233
  addItem(itemStack: ItemStack): void;
13234
+ clearAll(): void;
13235
+ clearItem(slot: number): void;
13290
13236
  /**
13291
13237
  * @remarks
13292
13238
  * Gets the item stack for the set of items at the specified
@@ -13297,6 +13243,7 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13297
13243
  * @throws This function can throw errors.
13298
13244
  */
13299
13245
  getItem(slot: number): ItemStack;
13246
+ getSlot(slot: number): ContainerSlot;
13300
13247
  /**
13301
13248
  * @remarks
13302
13249
  * Sets an item stack within a particular slot.
@@ -13306,7 +13253,7 @@ export class PlayerInventoryComponentContainer extends InventoryComponentContain
13306
13253
  * Stack of items to place within the specified slot.
13307
13254
  * @throws This function can throw errors.
13308
13255
  */
13309
- setItem(slot: number, itemStack: ItemStack): void;
13256
+ setItem(slot: number, itemStack?: ItemStack): void;
13310
13257
  /**
13311
13258
  * @remarks
13312
13259
  * Swaps items between two different slots within containers.
@@ -13355,10 +13302,8 @@ export class PlayerIterator implements Iterable<Player> {
13355
13302
  */
13356
13303
  export class PlayerJoinEvent {
13357
13304
  protected constructor();
13358
- /**
13359
- * Player that has joined the world.
13360
- */
13361
- player: Player;
13305
+ readonly playerId: string;
13306
+ readonly playerName: string;
13362
13307
  }
13363
13308
  /**
13364
13309
  * Manages callbacks that are connected to a player joining the
@@ -13388,6 +13333,7 @@ export class PlayerJoinEventSignal {
13388
13333
  */
13389
13334
  export class PlayerLeaveEvent {
13390
13335
  protected constructor();
13336
+ readonly playerId: string;
13391
13337
  /**
13392
13338
  * Player that has left the world.
13393
13339
  */
@@ -13415,6 +13361,16 @@ export class PlayerLeaveEventSignal {
13415
13361
  */
13416
13362
  unsubscribe(callback: (arg: PlayerLeaveEvent) => void): void;
13417
13363
  }
13364
+ export class PlayerSpawnEvent {
13365
+ protected constructor();
13366
+ initialSpawn: boolean;
13367
+ player: Player;
13368
+ }
13369
+ export class PlayerSpawnEventSignal {
13370
+ protected constructor();
13371
+ subscribe(callback: (arg: PlayerSpawnEvent) => void): (arg: PlayerSpawnEvent) => void;
13372
+ unsubscribe(callback: (arg: PlayerSpawnEvent) => void): void;
13373
+ }
13418
13374
  /**
13419
13375
  * Contains information related to a projectile hitting an
13420
13376
  * entity or block.
@@ -13684,6 +13640,23 @@ export class ScreenDisplay {
13684
13640
  */
13685
13641
  updateSubtitle(subtitle: string): void;
13686
13642
  }
13643
+ export class ScriptEventCommandMessageSignal {
13644
+ protected constructor();
13645
+ subscribe(
13646
+ callback: (arg: ScriptScriptCommandMessageEvent) => void,
13647
+ options?: ScriptEventMessageFilterOptions,
13648
+ ): (arg: ScriptScriptCommandMessageEvent) => void;
13649
+ unsubscribe(callback: (arg: ScriptScriptCommandMessageEvent) => void): void;
13650
+ }
13651
+ export class ScriptScriptCommandMessageEvent {
13652
+ protected constructor();
13653
+ readonly id: string;
13654
+ readonly initiator: Entity;
13655
+ readonly message: string;
13656
+ readonly sourceBlock: Block;
13657
+ readonly sourceEntity: Entity;
13658
+ readonly sourceType: MessageSourceType;
13659
+ }
13687
13660
  /**
13688
13661
  * Describes a particular seating position on this rideable
13689
13662
  * entity.
@@ -13829,6 +13802,7 @@ export class SystemEvents {
13829
13802
  * ability to override termination events may be disabled.
13830
13803
  */
13831
13804
  readonly beforeWatchdogTerminate: BeforeWatchdogTerminateEventSignal;
13805
+ readonly scriptEventReceive: ScriptEventCommandMessageSignal;
13832
13806
  }
13833
13807
  /**
13834
13808
  * An event for handling updates, that fires 20 times every
@@ -14163,7 +14137,7 @@ export class World {
14163
14137
  * @param message
14164
14138
  * @throws This function can throw errors.
14165
14139
  */
14166
- say(message: IRawMessage | string): void;
14140
+ say(message: RawMessage | string): void;
14167
14141
  /**
14168
14142
  * @remarks
14169
14143
  * Sets a specified property to a value.
@@ -14492,33 +14466,6 @@ export interface ExplosionOptions {
14492
14466
  */
14493
14467
  source?: Entity;
14494
14468
  }
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
- }
14522
14469
  /**
14523
14470
  * Additional configuration options for {@link
14524
14471
  * World.playMusic}/{@link World.queueMusic} methods.
@@ -14537,6 +14484,12 @@ export interface MusicOptions {
14537
14484
  */
14538
14485
  volume?: number;
14539
14486
  }
14487
+ export interface RawMessage {
14488
+ rawtext?: RawMessage[] | string[];
14489
+ text?: string;
14490
+ translate?: string;
14491
+ with?: RawMessage[] | string[];
14492
+ }
14540
14493
  /**
14541
14494
  * Contains additional options for how a scoreboard should be
14542
14495
  * displayed within its display slot.
@@ -14551,6 +14504,9 @@ export interface ScoreboardObjectiveDisplayOptions {
14551
14504
  */
14552
14505
  sortOrder?: ObjectiveSortOrder;
14553
14506
  }
14507
+ export interface ScriptEventMessageFilterOptions {
14508
+ namespaces: string[];
14509
+ }
14554
14510
  /**
14555
14511
  * Additional configuration options for the {@link
14556
14512
  * Player.playSound}/{@link World.playSound} method.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.1.0-beta.preview.1.19.50.25",
3
+ "version": "1.1.0-beta.preview.1.19.60.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {