@minecraft/server 1.1.0-rc.1.20.0-preview.21 → 1.1.0
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.
- package/README.md +0 -2
- package/index.d.ts +60 -36
- 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
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
Copyright (c) Microsoft Corporation.
|
|
8
8
|
***************************************************************************** */
|
|
9
9
|
/**
|
|
10
|
-
* @beta
|
|
11
10
|
* @packageDocumentation
|
|
12
11
|
* Contains many types related to manipulating a Minecraft
|
|
13
12
|
* world, including entities, blocks, dimensions, and more.
|
|
@@ -16,18 +15,16 @@
|
|
|
16
15
|
* ```json
|
|
17
16
|
* {
|
|
18
17
|
* "module_name": "@minecraft/server",
|
|
19
|
-
* "version": "1.
|
|
18
|
+
* "version": "1.1.0"
|
|
20
19
|
* }
|
|
21
20
|
* ```
|
|
22
21
|
*
|
|
23
22
|
*/
|
|
24
23
|
/**
|
|
25
|
-
* @beta
|
|
26
24
|
* Represents a game mode for the current world experience.
|
|
27
25
|
*/
|
|
28
26
|
export enum GameMode {
|
|
29
27
|
/**
|
|
30
|
-
* @beta
|
|
31
28
|
* @remarks
|
|
32
29
|
* World is in a more locked-down experience, where blocks may
|
|
33
30
|
* not be manipulated.
|
|
@@ -35,7 +32,6 @@ export enum GameMode {
|
|
|
35
32
|
*/
|
|
36
33
|
adventure = 'adventure',
|
|
37
34
|
/**
|
|
38
|
-
* @beta
|
|
39
35
|
* @remarks
|
|
40
36
|
* World is in a full creative mode. In creative mode, the
|
|
41
37
|
* player has all the resources available in the item selection
|
|
@@ -49,7 +45,6 @@ export enum GameMode {
|
|
|
49
45
|
creative = 'creative',
|
|
50
46
|
spectator = 'spectator',
|
|
51
47
|
/**
|
|
52
|
-
* @beta
|
|
53
48
|
* @remarks
|
|
54
49
|
* World is in a survival mode, where players can take damage
|
|
55
50
|
* and entities may not be peaceful. Survival mode is where the
|
|
@@ -60,8 +55,8 @@ export enum GameMode {
|
|
|
60
55
|
*/
|
|
61
56
|
survival = 'survival',
|
|
62
57
|
}
|
|
58
|
+
|
|
63
59
|
/**
|
|
64
|
-
* @beta
|
|
65
60
|
* Represents a block in a dimension. A block represents a
|
|
66
61
|
* unique X, Y, and Z within a dimension and get/sets the state
|
|
67
62
|
* of the block at that location. This type was significantly
|
|
@@ -122,8 +117,8 @@ export class Block {
|
|
|
122
117
|
*/
|
|
123
118
|
setPermutation(permutation: BlockPermutation): void;
|
|
124
119
|
}
|
|
120
|
+
|
|
125
121
|
/**
|
|
126
|
-
* @beta
|
|
127
122
|
* Contains the combination of type {@link BlockType} and
|
|
128
123
|
* properties (also sometimes called block state) which
|
|
129
124
|
* describe a block (but does not belong to a specific {@link
|
|
@@ -137,22 +132,29 @@ export class BlockPermutation {
|
|
|
137
132
|
* this permutation. If states is not specified, matches checks
|
|
138
133
|
* against the set of types more broadly.
|
|
139
134
|
*
|
|
135
|
+
* This function can't be called in read-only mode.
|
|
136
|
+
*
|
|
140
137
|
* @param blockName
|
|
141
138
|
* An optional set of states to compare against.
|
|
142
139
|
*/
|
|
143
|
-
matches(blockName: string,
|
|
140
|
+
matches(blockName: string, properties?: Record<string, boolean | number | string>): boolean;
|
|
144
141
|
/**
|
|
145
142
|
* @remarks
|
|
146
143
|
* Given a type identifier and an optional set of properties,
|
|
147
144
|
* will return a BlockPermutation object that is usable in
|
|
148
145
|
* other block APIs (e.g., block.setPermutation)
|
|
149
146
|
*
|
|
147
|
+
* This function can't be called in read-only mode.
|
|
148
|
+
*
|
|
150
149
|
* @param blockName
|
|
151
150
|
* Identifier of the block to check.
|
|
151
|
+
* @param properties
|
|
152
|
+
* Optional additional set of properties to check against.
|
|
152
153
|
* @throws This function can throw errors.
|
|
153
154
|
*/
|
|
154
|
-
static resolve(blockName: string,
|
|
155
|
+
static resolve(blockName: string, properties?: Record<string, boolean | number | string>): BlockPermutation;
|
|
155
156
|
}
|
|
157
|
+
|
|
156
158
|
/**
|
|
157
159
|
* Contains return data on the result of a command execution.
|
|
158
160
|
*/
|
|
@@ -167,6 +169,7 @@ export class CommandResult {
|
|
|
167
169
|
*/
|
|
168
170
|
readonly successCount: number;
|
|
169
171
|
}
|
|
172
|
+
|
|
170
173
|
/**
|
|
171
174
|
* A class that represents a particular dimension (e.g., The
|
|
172
175
|
* End) within a world.
|
|
@@ -181,11 +184,12 @@ export class Dimension {
|
|
|
181
184
|
*/
|
|
182
185
|
readonly id: string;
|
|
183
186
|
/**
|
|
184
|
-
* @beta
|
|
185
187
|
* @remarks
|
|
186
188
|
* Returns a block instance at the given location. This method
|
|
187
189
|
* was introduced as of version 1.17.10.21.
|
|
188
190
|
*
|
|
191
|
+
* This function can't be called in read-only mode.
|
|
192
|
+
*
|
|
189
193
|
* @param location
|
|
190
194
|
* The location at which to return a block.
|
|
191
195
|
* @returns
|
|
@@ -194,11 +198,12 @@ export class Dimension {
|
|
|
194
198
|
*/
|
|
195
199
|
getBlock(location: Vector3): Block;
|
|
196
200
|
/**
|
|
197
|
-
* @beta
|
|
198
201
|
* @remarks
|
|
199
202
|
* Returns a set of entities based on a set of conditions
|
|
200
203
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
201
204
|
*
|
|
205
|
+
* This function can't be called in read-only mode.
|
|
206
|
+
*
|
|
202
207
|
* @param options
|
|
203
208
|
* Additional options that can be used to filter the set of
|
|
204
209
|
* entities returned.
|
|
@@ -227,10 +232,11 @@ export class Dimension {
|
|
|
227
232
|
*/
|
|
228
233
|
getEntities(options?: EntityQueryOptions): Entity[];
|
|
229
234
|
/**
|
|
230
|
-
* @beta
|
|
231
235
|
* @remarks
|
|
232
236
|
* Returns a set of entities at a particular location.
|
|
233
237
|
*
|
|
238
|
+
* This function can't be called in read-only mode.
|
|
239
|
+
*
|
|
234
240
|
* @param location
|
|
235
241
|
* The location at which to return entities.
|
|
236
242
|
* @returns
|
|
@@ -238,11 +244,12 @@ export class Dimension {
|
|
|
238
244
|
*/
|
|
239
245
|
getEntitiesAtBlockLocation(location: Vector3): Entity[];
|
|
240
246
|
/**
|
|
241
|
-
* @beta
|
|
242
247
|
* @remarks
|
|
243
248
|
* Returns a set of players based on a set of conditions
|
|
244
249
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
245
250
|
*
|
|
251
|
+
* This function can't be called in read-only mode.
|
|
252
|
+
*
|
|
246
253
|
* @param options
|
|
247
254
|
* Additional options that can be used to filter the set of
|
|
248
255
|
* players returned.
|
|
@@ -258,6 +265,8 @@ export class Dimension {
|
|
|
258
265
|
* of 128 asynchronous commands that can be run in a given
|
|
259
266
|
* tick.
|
|
260
267
|
*
|
|
268
|
+
* This function can't be called in read-only mode.
|
|
269
|
+
*
|
|
261
270
|
* @param commandString
|
|
262
271
|
* Command to run. Note that command strings should not start
|
|
263
272
|
* with slash.
|
|
@@ -268,6 +277,7 @@ export class Dimension {
|
|
|
268
277
|
*/
|
|
269
278
|
runCommandAsync(commandString: string): Promise<CommandResult>;
|
|
270
279
|
}
|
|
280
|
+
|
|
271
281
|
/**
|
|
272
282
|
* Represents the state of an entity (a mob, the player, or
|
|
273
283
|
* other moving objects like minecarts) in the world.
|
|
@@ -275,7 +285,6 @@ export class Dimension {
|
|
|
275
285
|
export class Entity {
|
|
276
286
|
protected constructor();
|
|
277
287
|
/**
|
|
278
|
-
* @beta
|
|
279
288
|
* @remarks
|
|
280
289
|
* Dimension that the entity is currently within.
|
|
281
290
|
*
|
|
@@ -293,7 +302,6 @@ export class Entity {
|
|
|
293
302
|
*/
|
|
294
303
|
readonly id: string;
|
|
295
304
|
/**
|
|
296
|
-
* @beta
|
|
297
305
|
* @remarks
|
|
298
306
|
* Current location of the entity.
|
|
299
307
|
*
|
|
@@ -301,7 +309,6 @@ export class Entity {
|
|
|
301
309
|
*/
|
|
302
310
|
readonly location: Vector3;
|
|
303
311
|
/**
|
|
304
|
-
* @beta
|
|
305
312
|
* @remarks
|
|
306
313
|
* Given name of the entity.
|
|
307
314
|
*
|
|
@@ -318,27 +325,30 @@ export class Entity {
|
|
|
318
325
|
*/
|
|
319
326
|
readonly typeId: string;
|
|
320
327
|
/**
|
|
321
|
-
* @beta
|
|
322
328
|
* @remarks
|
|
323
329
|
* Returns the current location of the head component of this
|
|
324
330
|
* entity.
|
|
325
331
|
*
|
|
332
|
+
* This function can't be called in read-only mode.
|
|
333
|
+
*
|
|
326
334
|
* @throws This function can throw errors.
|
|
327
335
|
*/
|
|
328
336
|
getHeadLocation(): Vector3;
|
|
329
337
|
/**
|
|
330
|
-
* @beta
|
|
331
338
|
* @remarks
|
|
332
339
|
* Returns the current velocity vector of the entity.
|
|
333
340
|
*
|
|
341
|
+
* This function can't be called in read-only mode.
|
|
342
|
+
*
|
|
334
343
|
* @throws This function can throw errors.
|
|
335
344
|
*/
|
|
336
345
|
getVelocity(): Vector3;
|
|
337
346
|
/**
|
|
338
|
-
* @beta
|
|
339
347
|
* @remarks
|
|
340
348
|
* Returns the current view direction of the entity.
|
|
341
349
|
*
|
|
350
|
+
* This function can't be called in read-only mode.
|
|
351
|
+
*
|
|
342
352
|
* @throws This function can throw errors.
|
|
343
353
|
*/
|
|
344
354
|
getViewDirection(): Vector3;
|
|
@@ -348,6 +358,8 @@ export class Entity {
|
|
|
348
358
|
* this entity. Note that there is a maximum queue of 128
|
|
349
359
|
* asynchronous commands that can be run in a given tick.
|
|
350
360
|
*
|
|
361
|
+
* This function can't be called in read-only mode.
|
|
362
|
+
*
|
|
351
363
|
* @param commandString
|
|
352
364
|
* Command to run. Note that command strings should not start
|
|
353
365
|
* with slash.
|
|
@@ -358,6 +370,7 @@ export class Entity {
|
|
|
358
370
|
*/
|
|
359
371
|
runCommandAsync(commandString: string): Promise<CommandResult>;
|
|
360
372
|
}
|
|
373
|
+
|
|
361
374
|
/**
|
|
362
375
|
* A collection of default Minecraft dimension types.
|
|
363
376
|
*/
|
|
@@ -397,6 +410,7 @@ export class MinecraftDimensionTypes {
|
|
|
397
410
|
*/
|
|
398
411
|
static readonly theEnd = 'minecraft:the_end';
|
|
399
412
|
}
|
|
413
|
+
|
|
400
414
|
/**
|
|
401
415
|
* Represents a player within the world.
|
|
402
416
|
*/
|
|
@@ -410,10 +424,11 @@ export class Player extends Entity {
|
|
|
410
424
|
*/
|
|
411
425
|
readonly name: string;
|
|
412
426
|
/**
|
|
413
|
-
* @beta
|
|
414
427
|
* @remarks
|
|
415
428
|
* Sends a message to the player.
|
|
416
429
|
*
|
|
430
|
+
* This function can't be called in read-only mode.
|
|
431
|
+
*
|
|
417
432
|
* @param message
|
|
418
433
|
* The message to be displayed.
|
|
419
434
|
* @throws
|
|
@@ -453,24 +468,25 @@ export class Player extends Entity {
|
|
|
453
468
|
*/
|
|
454
469
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
455
470
|
}
|
|
471
|
+
|
|
456
472
|
/**
|
|
457
473
|
* A class that provides system-level events and functions.
|
|
458
474
|
*/
|
|
459
475
|
export class System {
|
|
460
476
|
protected constructor();
|
|
461
477
|
/**
|
|
462
|
-
* @beta
|
|
463
478
|
* @remarks
|
|
464
479
|
* Represents the current world tick of the server.
|
|
465
480
|
*
|
|
466
481
|
*/
|
|
467
482
|
readonly currentTick: number;
|
|
468
483
|
/**
|
|
469
|
-
* @beta
|
|
470
484
|
* @remarks
|
|
471
485
|
* Cancels the execution of a function run that was previously
|
|
472
486
|
* scheduled via the `run` function.
|
|
473
487
|
*
|
|
488
|
+
* This function can't be called in read-only mode.
|
|
489
|
+
*
|
|
474
490
|
*/
|
|
475
491
|
clearRun(runId: number): void;
|
|
476
492
|
/**
|
|
@@ -479,6 +495,8 @@ export class System {
|
|
|
479
495
|
* frequently used to implement delayed behaviors and game
|
|
480
496
|
* loops.
|
|
481
497
|
*
|
|
498
|
+
* This function can't be called in read-only mode.
|
|
499
|
+
*
|
|
482
500
|
* @param callback
|
|
483
501
|
* Function callback to run when the tickDelay time criteria is
|
|
484
502
|
* met.
|
|
@@ -488,10 +506,11 @@ export class System {
|
|
|
488
506
|
*/
|
|
489
507
|
run(callback: () => void): number;
|
|
490
508
|
/**
|
|
491
|
-
* @beta
|
|
492
509
|
* @remarks
|
|
493
510
|
* Runs a set of code on an interval.
|
|
494
511
|
*
|
|
512
|
+
* This function can't be called in read-only mode.
|
|
513
|
+
*
|
|
495
514
|
* @param callback
|
|
496
515
|
* Functional code that will run when this interval occurs.
|
|
497
516
|
* @param tickInterval
|
|
@@ -503,10 +522,11 @@ export class System {
|
|
|
503
522
|
*/
|
|
504
523
|
runInterval(callback: () => void, tickInterval?: number): number;
|
|
505
524
|
/**
|
|
506
|
-
* @beta
|
|
507
525
|
* @remarks
|
|
508
526
|
* Runs a set of code at a future time specified by tickDelay.
|
|
509
527
|
*
|
|
528
|
+
* This function can't be called in read-only mode.
|
|
529
|
+
*
|
|
510
530
|
* @param callback
|
|
511
531
|
* Functional code that will run when this timeout occurs.
|
|
512
532
|
* @param tickDelay
|
|
@@ -518,6 +538,7 @@ export class System {
|
|
|
518
538
|
*/
|
|
519
539
|
runTimeout(callback: () => void, tickDelay?: number): number;
|
|
520
540
|
}
|
|
541
|
+
|
|
521
542
|
/**
|
|
522
543
|
* A class that wraps the state of a world - a set of
|
|
523
544
|
* dimensions and the environment of Minecraft.
|
|
@@ -528,6 +549,8 @@ export class World {
|
|
|
528
549
|
* @remarks
|
|
529
550
|
* Returns an array of all active players within the world.
|
|
530
551
|
*
|
|
552
|
+
* This function can't be called in read-only mode.
|
|
553
|
+
*
|
|
531
554
|
* @throws This function can throw errors.
|
|
532
555
|
*/
|
|
533
556
|
getAllPlayers(): Player[];
|
|
@@ -535,6 +558,8 @@ export class World {
|
|
|
535
558
|
* @remarks
|
|
536
559
|
* Returns a dimension object.
|
|
537
560
|
*
|
|
561
|
+
* This function can't be called in read-only mode.
|
|
562
|
+
*
|
|
538
563
|
* @returns
|
|
539
564
|
* The requested dimension
|
|
540
565
|
* @throws
|
|
@@ -542,11 +567,12 @@ export class World {
|
|
|
542
567
|
*/
|
|
543
568
|
getDimension(dimensionId: string): Dimension;
|
|
544
569
|
/**
|
|
545
|
-
* @beta
|
|
546
570
|
* @remarks
|
|
547
571
|
* Returns a set of players based on a set of conditions
|
|
548
572
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
549
573
|
*
|
|
574
|
+
* This function can't be called in read-only mode.
|
|
575
|
+
*
|
|
550
576
|
* @param options
|
|
551
577
|
* Additional options that can be used to filter the set of
|
|
552
578
|
* players returned.
|
|
@@ -556,10 +582,11 @@ export class World {
|
|
|
556
582
|
*/
|
|
557
583
|
getPlayers(options?: EntityQueryOptions): Player[];
|
|
558
584
|
/**
|
|
559
|
-
* @beta
|
|
560
585
|
* @remarks
|
|
561
586
|
* Sends a message to all players.
|
|
562
587
|
*
|
|
588
|
+
* This function can't be called in read-only mode.
|
|
589
|
+
*
|
|
563
590
|
* @param message
|
|
564
591
|
* The message to be displayed.
|
|
565
592
|
* @throws
|
|
@@ -599,8 +626,8 @@ export class World {
|
|
|
599
626
|
*/
|
|
600
627
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
601
628
|
}
|
|
629
|
+
|
|
602
630
|
/**
|
|
603
|
-
* @beta
|
|
604
631
|
* Contains options for selecting entities within an area.
|
|
605
632
|
*/
|
|
606
633
|
export interface EntityQueryOptions {
|
|
@@ -761,8 +788,8 @@ export interface EntityQueryOptions {
|
|
|
761
788
|
*/
|
|
762
789
|
type?: string;
|
|
763
790
|
}
|
|
791
|
+
|
|
764
792
|
/**
|
|
765
|
-
* @beta
|
|
766
793
|
* Contains additional options for filtering players based on
|
|
767
794
|
* their score for an objective.
|
|
768
795
|
*/
|
|
@@ -795,9 +822,7 @@ export interface EntityQueryScoreOptions {
|
|
|
795
822
|
*/
|
|
796
823
|
objective?: string;
|
|
797
824
|
}
|
|
798
|
-
|
|
799
|
-
* @beta
|
|
800
|
-
*/
|
|
825
|
+
|
|
801
826
|
export interface RawMessage {
|
|
802
827
|
rawtext?: RawMessage[];
|
|
803
828
|
score?: RawMessageScore;
|
|
@@ -805,15 +830,13 @@ export interface RawMessage {
|
|
|
805
830
|
translate?: string;
|
|
806
831
|
with?: string[] | RawMessage;
|
|
807
832
|
}
|
|
808
|
-
|
|
809
|
-
* @beta
|
|
810
|
-
*/
|
|
833
|
+
|
|
811
834
|
export interface RawMessageScore {
|
|
812
835
|
name?: string;
|
|
813
836
|
objective?: string;
|
|
814
837
|
}
|
|
838
|
+
|
|
815
839
|
/**
|
|
816
|
-
* @beta
|
|
817
840
|
* Contains a description of a vector.
|
|
818
841
|
*/
|
|
819
842
|
export interface Vector3 {
|
|
@@ -836,6 +859,7 @@ export interface Vector3 {
|
|
|
836
859
|
*/
|
|
837
860
|
z: number;
|
|
838
861
|
}
|
|
862
|
+
|
|
839
863
|
/**
|
|
840
864
|
* @remarks
|
|
841
865
|
* A class that provides system-level events and functions.
|