@minecraft/server 1.7.0-beta.1.20.40-preview.21 → 1.7.0-beta.1.20.40-preview.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 (3) hide show
  1. package/README.md +1 -1
  2. package/index.d.ts +145 -41
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -6,4 +6,4 @@ Contains many types related to manipulating a Minecraft world, including entitie
6
6
 
7
7
  See full documentation for this module here:
8
8
 
9
- https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/@minecraft/server/@minecraft/server
9
+ https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server
package/index.d.ts CHANGED
@@ -16,7 +16,7 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "1.7.0-internal.1.20.40-preview.21"
19
+ * "version": "1.7.0-internal.1.20.40-preview.22"
20
20
  * }
21
21
  * ```
22
22
  *
@@ -103,6 +103,16 @@ export enum CompoundBlockVolumePositionRelativity {
103
103
  Absolute = 1,
104
104
  }
105
105
 
106
+ /**
107
+ * @beta
108
+ */
109
+ export enum Difficulty {
110
+ Peaceful = 0,
111
+ Easy = 1,
112
+ Normal = 2,
113
+ Hard = 3,
114
+ }
115
+
106
116
  /**
107
117
  * @beta
108
118
  * A general purpose relative direction enumeration.
@@ -835,6 +845,10 @@ export class Block {
835
845
  * space).
836
846
  *
837
847
  * @throws This property can throw when used.
848
+ *
849
+ * {@link LocationInUnloadedChunkError}
850
+ *
851
+ * {@link LocationOutOfWorldBoundariesError}
838
852
  */
839
853
  readonly isAir: boolean;
840
854
  /**
@@ -846,6 +860,10 @@ export class Block {
846
860
  * liquid blocks).
847
861
  *
848
862
  * @throws This property can throw when used.
863
+ *
864
+ * {@link LocationInUnloadedChunkError}
865
+ *
866
+ * {@link LocationOutOfWorldBoundariesError}
849
867
  */
850
868
  readonly isLiquid: boolean;
851
869
  /**
@@ -856,6 +874,10 @@ export class Block {
856
874
  * ladder block and a fence block are not).
857
875
  *
858
876
  * @throws This property can throw when used.
877
+ *
878
+ * {@link LocationInUnloadedChunkError}
879
+ *
880
+ * {@link LocationOutOfWorldBoundariesError}
859
881
  */
860
882
  readonly isSolid: boolean;
861
883
  /**
@@ -880,6 +902,10 @@ export class Block {
880
902
  * block.
881
903
  *
882
904
  * @throws This property can throw when used.
905
+ *
906
+ * {@link LocationInUnloadedChunkError}
907
+ *
908
+ * {@link LocationOutOfWorldBoundariesError}
883
909
  */
884
910
  readonly permutation: BlockPermutation;
885
911
  /**
@@ -888,6 +914,10 @@ export class Block {
888
914
  * Gets the type of block.
889
915
  *
890
916
  * @throws This property can throw when used.
917
+ *
918
+ * {@link LocationInUnloadedChunkError}
919
+ *
920
+ * {@link LocationOutOfWorldBoundariesError}
891
921
  */
892
922
  readonly 'type': BlockType;
893
923
  /**
@@ -896,6 +926,10 @@ export class Block {
896
926
  * Identifier of the type of block for this block.
897
927
  *
898
928
  * @throws This property can throw when used.
929
+ *
930
+ * {@link LocationInUnloadedChunkError}
931
+ *
932
+ * {@link LocationOutOfWorldBoundariesError}
899
933
  */
900
934
  readonly typeId: string;
901
935
  /**
@@ -919,11 +953,19 @@ export class Block {
919
953
  /**
920
954
  * @beta
921
955
  * @throws This function can throw errors.
956
+ *
957
+ * {@link LocationInUnloadedChunkError}
958
+ *
959
+ * {@link LocationOutOfWorldBoundariesError}
922
960
  */
923
961
  above(steps?: number): Block | undefined;
924
962
  /**
925
963
  * @beta
926
964
  * @throws This function can throw errors.
965
+ *
966
+ * {@link LocationInUnloadedChunkError}
967
+ *
968
+ * {@link LocationOutOfWorldBoundariesError}
927
969
  */
928
970
  below(steps?: number): Block | undefined;
929
971
  /**
@@ -946,6 +988,12 @@ export class Block {
946
988
  * Returns `true` if the block type or permutation can be
947
989
  * placed on this block, else `false`.
948
990
  * @throws This function can throw errors.
991
+ *
992
+ * {@link Error}
993
+ *
994
+ * {@link LocationInUnloadedChunkError}
995
+ *
996
+ * {@link LocationOutOfWorldBoundariesError}
949
997
  */
950
998
  canPlace(blockToPlace: BlockPermutation | BlockType | string, faceToPlaceOn?: Direction): boolean;
951
999
  /**
@@ -955,6 +1003,10 @@ export class Block {
955
1003
  /**
956
1004
  * @beta
957
1005
  * @throws This function can throw errors.
1006
+ *
1007
+ * {@link LocationInUnloadedChunkError}
1008
+ *
1009
+ * {@link LocationOutOfWorldBoundariesError}
958
1010
  */
959
1011
  east(steps?: number): Block | undefined;
960
1012
  /**
@@ -971,6 +1023,10 @@ export class Block {
971
1023
  * Returns the component object if it is present on the
972
1024
  * particular block.
973
1025
  * @throws This function can throw errors.
1026
+ *
1027
+ * {@link LocationInUnloadedChunkError}
1028
+ *
1029
+ * {@link LocationOutOfWorldBoundariesError}
974
1030
  */
975
1031
  getComponent(componentName: string): BlockComponent | undefined;
976
1032
  /**
@@ -986,6 +1042,10 @@ export class Block {
986
1042
  * Whether additional data facets of the item stack are
987
1043
  * included.
988
1044
  * @throws This function can throw errors.
1045
+ *
1046
+ * {@link LocationInUnloadedChunkError}
1047
+ *
1048
+ * {@link LocationOutOfWorldBoundariesError}
989
1049
  */
990
1050
  getItemStack(amount?: number, withData?: boolean): ItemStack;
991
1051
  /**
@@ -997,6 +1057,10 @@ export class Block {
997
1057
  * Returns undefined if redstone power is not applicable to
998
1058
  * this block.
999
1059
  * @throws This function can throw errors.
1060
+ *
1061
+ * {@link LocationInUnloadedChunkError}
1062
+ *
1063
+ * {@link LocationOutOfWorldBoundariesError}
1000
1064
  */
1001
1065
  getRedstonePower(): number | undefined;
1002
1066
  /**
@@ -1007,6 +1071,10 @@ export class Block {
1007
1071
  * @returns
1008
1072
  * The list of tags that the block has.
1009
1073
  * @throws This function can throw errors.
1074
+ *
1075
+ * {@link LocationInUnloadedChunkError}
1076
+ *
1077
+ * {@link LocationOutOfWorldBoundariesError}
1010
1078
  */
1011
1079
  getTags(): string[];
1012
1080
  /**
@@ -1021,6 +1089,10 @@ export class Block {
1021
1089
  * Returns `true` if the permutation of this block has the tag,
1022
1090
  * else `false`.
1023
1091
  * @throws This function can throw errors.
1092
+ *
1093
+ * {@link LocationInUnloadedChunkError}
1094
+ *
1095
+ * {@link LocationOutOfWorldBoundariesError}
1024
1096
  * @example check_block_tags.js
1025
1097
  * ```typescript
1026
1098
  * import { world } from "@minecraft/server";
@@ -1048,11 +1120,19 @@ export class Block {
1048
1120
  /**
1049
1121
  * @beta
1050
1122
  * @throws This function can throw errors.
1123
+ *
1124
+ * {@link LocationInUnloadedChunkError}
1125
+ *
1126
+ * {@link LocationOutOfWorldBoundariesError}
1051
1127
  */
1052
1128
  north(steps?: number): Block | undefined;
1053
1129
  /**
1054
1130
  * @beta
1055
1131
  * @throws This function can throw errors.
1132
+ *
1133
+ * {@link LocationInUnloadedChunkError}
1134
+ *
1135
+ * {@link LocationOutOfWorldBoundariesError}
1056
1136
  */
1057
1137
  offset(offset: Vector3): Block | undefined;
1058
1138
  /**
@@ -1066,6 +1146,10 @@ export class Block {
1066
1146
  * Permutation that contains a set of property states for the
1067
1147
  * Block.
1068
1148
  * @throws This function can throw errors.
1149
+ *
1150
+ * {@link LocationInUnloadedChunkError}
1151
+ *
1152
+ * {@link LocationOutOfWorldBoundariesError}
1069
1153
  */
1070
1154
  setPermutation(permutation: BlockPermutation): void;
1071
1155
  /**
@@ -1079,11 +1163,21 @@ export class Block {
1079
1163
  * Identifier of the type of block to apply - for example,
1080
1164
  * minecraft:powered_repeater.
1081
1165
  * @throws This function can throw errors.
1166
+ *
1167
+ * {@link Error}
1168
+ *
1169
+ * {@link LocationInUnloadedChunkError}
1170
+ *
1171
+ * {@link LocationOutOfWorldBoundariesError}
1082
1172
  */
1083
1173
  setType(blockType: BlockType | string): void;
1084
1174
  /**
1085
1175
  * @beta
1086
1176
  * @throws This function can throw errors.
1177
+ *
1178
+ * {@link LocationInUnloadedChunkError}
1179
+ *
1180
+ * {@link LocationOutOfWorldBoundariesError}
1087
1181
  */
1088
1182
  south(steps?: number): Block | undefined;
1089
1183
  /**
@@ -1101,11 +1195,19 @@ export class Block {
1101
1195
  * Returns `true` if the block permutation data was
1102
1196
  * successfully set, else `false`.
1103
1197
  * @throws This function can throw errors.
1198
+ *
1199
+ * {@link LocationInUnloadedChunkError}
1200
+ *
1201
+ * {@link LocationOutOfWorldBoundariesError}
1104
1202
  */
1105
1203
  trySetPermutation(permutation: BlockPermutation): boolean;
1106
1204
  /**
1107
1205
  * @beta
1108
1206
  * @throws This function can throw errors.
1207
+ *
1208
+ * {@link LocationInUnloadedChunkError}
1209
+ *
1210
+ * {@link LocationOutOfWorldBoundariesError}
1109
1211
  */
1110
1212
  west(steps?: number): Block | undefined;
1111
1213
  }
@@ -1251,7 +1353,7 @@ export class BlockInventoryComponent extends BlockComponent {
1251
1353
  *
1252
1354
  * @throws This property can throw when used.
1253
1355
  */
1254
- readonly container: Container;
1356
+ readonly container?: Container;
1255
1357
  static readonly componentId = 'minecraft:inventory';
1256
1358
  }
1257
1359
 
@@ -3277,6 +3379,10 @@ export class Dimension {
3277
3379
  * @param explosionOptions
3278
3380
  * Additional configurable options for the explosion.
3279
3381
  * @throws This function can throw errors.
3382
+ *
3383
+ * {@link LocationInUnloadedChunkError}
3384
+ *
3385
+ * {@link LocationOutOfWorldBoundariesError}
3280
3386
  * @example createExplosion.ts
3281
3387
  * ```typescript
3282
3388
  * const overworld = mc.world.getDimension("overworld");
@@ -3359,6 +3465,10 @@ export class Dimension {
3359
3465
  * trying to interact with a position outside of dimension
3360
3466
  * height range
3361
3467
  *
3468
+ *
3469
+ * {@link LocationInUnloadedChunkError}
3470
+ *
3471
+ * {@link LocationOutOfWorldBoundariesError}
3362
3472
  */
3363
3473
  getBlock(location: Vector3): Block | undefined;
3364
3474
  /**
@@ -3479,6 +3589,13 @@ export class Dimension {
3479
3589
  * @throws This function can throw errors.
3480
3590
  */
3481
3591
  getPlayers(options?: EntityQueryOptions): Player[];
3592
+ /**
3593
+ * @beta
3594
+ * @remarks
3595
+ * This function can't be called in read-only mode.
3596
+ *
3597
+ */
3598
+ getWeather(): WeatherType;
3482
3599
  /**
3483
3600
  * @beta
3484
3601
  * @remarks
@@ -3499,6 +3616,8 @@ export class Dimension {
3499
3616
  * command. Note that in many cases, if the command does not
3500
3617
  * operate (e.g., a target selector found no matches), this
3501
3618
  * method will not throw an exception.
3619
+ *
3620
+ * {@link CommandError}
3502
3621
  */
3503
3622
  runCommand(commandString: string): CommandResult;
3504
3623
  /**
@@ -3554,6 +3673,10 @@ export class Dimension {
3554
3673
  * @returns
3555
3674
  * Newly created entity at the specified location.
3556
3675
  * @throws This function can throw errors.
3676
+ *
3677
+ * {@link LocationInUnloadedChunkError}
3678
+ *
3679
+ * {@link LocationOutOfWorldBoundariesError}
3557
3680
  * @example createOldHorse.ts
3558
3681
  * ```typescript
3559
3682
  * const overworld = mc.world.getDimension("overworld");
@@ -3608,6 +3731,10 @@ export class Dimension {
3608
3731
  * @returns
3609
3732
  * Newly created item stack entity at the specified location.
3610
3733
  * @throws This function can throw errors.
3734
+ *
3735
+ * {@link LocationInUnloadedChunkError}
3736
+ *
3737
+ * {@link LocationOutOfWorldBoundariesError}
3611
3738
  * @example itemStacks.ts
3612
3739
  * ```typescript
3613
3740
  * const overworld = mc.world.getDimension('overworld');
@@ -3654,6 +3781,10 @@ export class Dimension {
3654
3781
  * A set of optional, customizable variables that can be
3655
3782
  * adjusted for this particle.
3656
3783
  * @throws This function can throw errors.
3784
+ *
3785
+ * {@link LocationInUnloadedChunkError}
3786
+ *
3787
+ * {@link LocationOutOfWorldBoundariesError}
3657
3788
  * @example spawnParticle.ts
3658
3789
  * ```typescript
3659
3790
  * for (let i = 0; i < 100; i++) {
@@ -4810,6 +4941,10 @@ export class Entity {
4810
4941
  * A command result containing whether the command was
4811
4942
  * successful.
4812
4943
  * @throws This function can throw errors.
4944
+ *
4945
+ * {@link CommandError}
4946
+ *
4947
+ * {@link Error}
4813
4948
  */
4814
4949
  runCommand(commandString: string): CommandResult;
4815
4950
  /**
@@ -9332,6 +9467,10 @@ export class Player extends Entity {
9332
9467
  * This function can't be called in read-only mode.
9333
9468
  *
9334
9469
  * @throws This function can throw errors.
9470
+ *
9471
+ * {@link Error}
9472
+ *
9473
+ * {@link LocationOutOfWorldBoundariesError}
9335
9474
  */
9336
9475
  setSpawnPoint(spawnPoint?: DimensionLocation): void;
9337
9476
  /**
@@ -9561,70 +9700,31 @@ export class PlayerDimensionChangeAfterEventSignal {
9561
9700
 
9562
9701
  /**
9563
9702
  * @beta
9564
- * Contains information related to a player's dimension
9565
- * changing.
9566
9703
  */
9567
9704
  export class PlayerDimensionChangeBeforeEvent {
9568
9705
  private constructor();
9569
- /**
9570
- * @remarks
9571
- * The dimension the player is changing from.
9572
- *
9573
- */
9574
9706
  readonly fromDimension: Dimension;
9575
- /**
9576
- * @remarks
9577
- * The location the player was at before changing dimensions.
9578
- *
9579
- */
9580
9707
  readonly fromLocation: Vector3;
9581
- /**
9582
- * @remarks
9583
- * Handle to the player that is changing dimensions.
9584
- *
9585
- */
9586
9708
  readonly player: Player;
9587
- /**
9588
- * @remarks
9589
- * The dimension that the player is changing to, property will
9590
- * modify dimension change request.
9591
- *
9592
- */
9593
9709
  readonly toDimension: Dimension;
9594
- /**
9595
- * @remarks
9596
- * The location the player will spawn to after changing
9597
- * dimensions, property will modify spawn location request.
9598
- *
9599
- */
9600
9710
  readonly toLocation: Vector3;
9601
9711
  }
9602
9712
 
9603
9713
  /**
9604
9714
  * @beta
9605
- * Manages callbacks that are connected to player dimension
9606
- * change requests.
9607
9715
  */
9608
9716
  export class PlayerDimensionChangeBeforeEventSignal {
9609
9717
  private constructor();
9610
9718
  /**
9611
9719
  * @remarks
9612
- * Subscribes the specified callback to player dimension change
9613
- * before events.
9614
- *
9615
9720
  * This function can't be called in read-only mode.
9616
9721
  *
9617
- * @param callback
9618
- * Callback function to subscribe to the event.
9619
9722
  */
9620
9723
  subscribe(
9621
9724
  callback: (arg: PlayerDimensionChangeBeforeEvent) => void,
9622
9725
  ): (arg: PlayerDimensionChangeBeforeEvent) => void;
9623
9726
  /**
9624
9727
  * @remarks
9625
- * Removes the specified callback from being called by player
9626
- * dimension change before events.
9627
- *
9628
9728
  * This function can't be called in read-only mode.
9629
9729
  *
9630
9730
  * @throws This function can throw errors.
@@ -11777,6 +11877,10 @@ export class World {
11777
11877
  * within the overworld dimension.
11778
11878
  * @throws
11779
11879
  * Throws if the provided spawn location is out of bounds.
11880
+ *
11881
+ * {@link Error}
11882
+ *
11883
+ * {@link LocationOutOfWorldBoundariesError}
11780
11884
  */
11781
11885
  setDefaultSpawnLocation(spawnLocation: Vector3): void;
11782
11886
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.7.0-beta.1.20.40-preview.21",
3
+ "version": "1.7.0-beta.1.20.40-preview.22",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {