@minecraft/server 1.1.0-rc.1.19.80-preview.21 → 1.1.0-rc.1.19.80-preview.24
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/index.d.ts +284 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -16,11 +16,44 @@
|
|
|
16
16
|
* ```json
|
|
17
17
|
* {
|
|
18
18
|
* "module_name": "@minecraft/server",
|
|
19
|
-
* "version": "1.2.0-internal.1.19.80-preview.
|
|
19
|
+
* "version": "1.2.0-internal.1.19.80-preview.24"
|
|
20
20
|
* }
|
|
21
21
|
* ```
|
|
22
22
|
*
|
|
23
23
|
*/
|
|
24
|
+
/**
|
|
25
|
+
* @beta
|
|
26
|
+
* Represents a game mode for the current world experience.
|
|
27
|
+
*/
|
|
28
|
+
export enum GameMode {
|
|
29
|
+
/**
|
|
30
|
+
* @beta
|
|
31
|
+
* World is in a more locked-down experience, where blocks may
|
|
32
|
+
* not be manipulated.
|
|
33
|
+
*/
|
|
34
|
+
adventure = 'adventure',
|
|
35
|
+
/**
|
|
36
|
+
* @beta
|
|
37
|
+
* World is in a full creative mode. In creative mode, the
|
|
38
|
+
* player has all the resources available in the item selection
|
|
39
|
+
* tabs and the survival selection tab. They can also destroy
|
|
40
|
+
* blocks instantly including those which would normally be
|
|
41
|
+
* indestructible. Command and structure blocks can also be
|
|
42
|
+
* used in creative mode. Items also do not lose durability or
|
|
43
|
+
* disappear.
|
|
44
|
+
*/
|
|
45
|
+
creative = 'creative',
|
|
46
|
+
spectator = 'spectator',
|
|
47
|
+
/**
|
|
48
|
+
* @beta
|
|
49
|
+
* World is in a survival mode, where players can take damage
|
|
50
|
+
* and entities may not be peaceful. Survival mode is where the
|
|
51
|
+
* player must collect resources, build structures while
|
|
52
|
+
* surviving in their generated world. Activities can, over
|
|
53
|
+
* time, chip away at player health and hunger bar.
|
|
54
|
+
*/
|
|
55
|
+
survival = 'survival',
|
|
56
|
+
}
|
|
24
57
|
/**
|
|
25
58
|
* @beta
|
|
26
59
|
* Represents a block in a dimension. A block represents a
|
|
@@ -115,6 +148,61 @@ export class Dimension {
|
|
|
115
148
|
* @throws This function can throw errors.
|
|
116
149
|
*/
|
|
117
150
|
getBlock(location: Vector3): Block;
|
|
151
|
+
/**
|
|
152
|
+
* @beta
|
|
153
|
+
* @remarks
|
|
154
|
+
* Returns a set of entities based on a set of conditions
|
|
155
|
+
* defined via the EntityQueryOptions set of filter criteria.
|
|
156
|
+
* @param options
|
|
157
|
+
* Additional options that can be used to filter the set of
|
|
158
|
+
* entities returned.
|
|
159
|
+
* @returns
|
|
160
|
+
* An entity array.
|
|
161
|
+
* @throws This function can throw errors.
|
|
162
|
+
* @example testThatEntityIsFeatherItem.ts
|
|
163
|
+
* ```typescript
|
|
164
|
+
* const query = {
|
|
165
|
+
* type: "item",
|
|
166
|
+
* location: targetLocation,
|
|
167
|
+
* };
|
|
168
|
+
* const items = overworld.getEntities(query);
|
|
169
|
+
*
|
|
170
|
+
* for (const item of items) {
|
|
171
|
+
* const itemComp = item.getComponent("item") as any;
|
|
172
|
+
*
|
|
173
|
+
* if (itemComp) {
|
|
174
|
+
* if (itemComp.itemStack.id.endsWith("feather")) {
|
|
175
|
+
* console.log("Success! Found a feather", 1);
|
|
176
|
+
* }
|
|
177
|
+
* }
|
|
178
|
+
* }
|
|
179
|
+
*
|
|
180
|
+
* ```
|
|
181
|
+
*/
|
|
182
|
+
getEntities(options?: EntityQueryOptions): Entity[];
|
|
183
|
+
/**
|
|
184
|
+
* @beta
|
|
185
|
+
* @remarks
|
|
186
|
+
* Returns a set of entities at a particular location.
|
|
187
|
+
* @param location
|
|
188
|
+
* The location at which to return entities.
|
|
189
|
+
* @returns
|
|
190
|
+
* Zero or more entities at the specified location.
|
|
191
|
+
*/
|
|
192
|
+
getEntitiesAtBlockLocation(location: Vector3): Entity[];
|
|
193
|
+
/**
|
|
194
|
+
* @beta
|
|
195
|
+
* @remarks
|
|
196
|
+
* Returns a set of players based on a set of conditions
|
|
197
|
+
* defined via the EntityQueryOptions set of filter criteria.
|
|
198
|
+
* @param options
|
|
199
|
+
* Additional options that can be used to filter the set of
|
|
200
|
+
* players returned.
|
|
201
|
+
* @returns
|
|
202
|
+
* A player array.
|
|
203
|
+
* @throws This function can throw errors.
|
|
204
|
+
*/
|
|
205
|
+
getPlayers(options?: EntityQueryOptions): Player[];
|
|
118
206
|
/**
|
|
119
207
|
* @remarks
|
|
120
208
|
* Runs a particular command asynchronously from the context of
|
|
@@ -137,6 +225,12 @@ export class Dimension {
|
|
|
137
225
|
*/
|
|
138
226
|
export class Entity {
|
|
139
227
|
protected constructor();
|
|
228
|
+
/**
|
|
229
|
+
* @beta
|
|
230
|
+
* Dimension that the entity is currently within.
|
|
231
|
+
* @throws This property can throw when used.
|
|
232
|
+
*/
|
|
233
|
+
readonly dimension: Dimension;
|
|
140
234
|
/**
|
|
141
235
|
* Unique identifier of the entity. This identifier is intended
|
|
142
236
|
* to be consistent across loads of a world instance. No
|
|
@@ -145,12 +239,38 @@ export class Entity {
|
|
|
145
239
|
* @throws This property can throw when used.
|
|
146
240
|
*/
|
|
147
241
|
readonly id: string;
|
|
242
|
+
/**
|
|
243
|
+
* @beta
|
|
244
|
+
* Current location of the entity.
|
|
245
|
+
* @throws This property can throw when used.
|
|
246
|
+
*/
|
|
247
|
+
readonly location: Vector3;
|
|
248
|
+
/**
|
|
249
|
+
* @beta
|
|
250
|
+
* Given name of the entity.
|
|
251
|
+
*/
|
|
252
|
+
nameTag: string;
|
|
148
253
|
/**
|
|
149
254
|
* Unique identifier of the type of the entity - for example,
|
|
150
255
|
* 'minecraft:skeleton'.
|
|
151
256
|
* @throws This property can throw when used.
|
|
152
257
|
*/
|
|
153
258
|
readonly typeId: string;
|
|
259
|
+
/**
|
|
260
|
+
* @beta
|
|
261
|
+
* @throws This function can throw errors.
|
|
262
|
+
*/
|
|
263
|
+
getHeadLocation(): Vector3;
|
|
264
|
+
/**
|
|
265
|
+
* @beta
|
|
266
|
+
* @throws This function can throw errors.
|
|
267
|
+
*/
|
|
268
|
+
getVelocity(): Vector3;
|
|
269
|
+
/**
|
|
270
|
+
* @beta
|
|
271
|
+
* @throws This function can throw errors.
|
|
272
|
+
*/
|
|
273
|
+
getViewDirection(): Vector3;
|
|
154
274
|
/**
|
|
155
275
|
* @remarks
|
|
156
276
|
* Runs a particular command asynchronously from the context of
|
|
@@ -169,7 +289,6 @@ export class Entity {
|
|
|
169
289
|
/**
|
|
170
290
|
* A collection of default Minecraft dimension types.
|
|
171
291
|
*/
|
|
172
|
-
// tslint:disable-next-line:no-unnecessary-class
|
|
173
292
|
export class MinecraftDimensionTypes {
|
|
174
293
|
protected constructor();
|
|
175
294
|
/**
|
|
@@ -268,7 +387,6 @@ export class System {
|
|
|
268
387
|
* @remarks
|
|
269
388
|
* Cancels the execution of a function run that was previously
|
|
270
389
|
* scheduled via the `run` function.
|
|
271
|
-
* @param runId
|
|
272
390
|
*/
|
|
273
391
|
clearRun(runId: number): void;
|
|
274
392
|
/**
|
|
@@ -328,13 +446,25 @@ export class World {
|
|
|
328
446
|
/**
|
|
329
447
|
* @remarks
|
|
330
448
|
* Returns a dimension object.
|
|
331
|
-
* @param dimensionId
|
|
332
449
|
* @returns
|
|
333
450
|
* The requested dimension
|
|
334
451
|
* @throws
|
|
335
452
|
* Throws if the given dimension name is invalid
|
|
336
453
|
*/
|
|
337
454
|
getDimension(dimensionId: string): Dimension;
|
|
455
|
+
/**
|
|
456
|
+
* @beta
|
|
457
|
+
* @remarks
|
|
458
|
+
* Returns a set of players based on a set of conditions
|
|
459
|
+
* defined via the EntityQueryOptions set of filter criteria.
|
|
460
|
+
* @param options
|
|
461
|
+
* Additional options that can be used to filter the set of
|
|
462
|
+
* players returned.
|
|
463
|
+
* @returns
|
|
464
|
+
* A player array.
|
|
465
|
+
* @throws This function can throw errors.
|
|
466
|
+
*/
|
|
467
|
+
getPlayers(options?: EntityQueryOptions): Player[];
|
|
338
468
|
/**
|
|
339
469
|
* @beta
|
|
340
470
|
* @remarks
|
|
@@ -378,6 +508,153 @@ export class World {
|
|
|
378
508
|
*/
|
|
379
509
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
380
510
|
}
|
|
511
|
+
/**
|
|
512
|
+
* @beta
|
|
513
|
+
* Contains options for selecting entities within an area.
|
|
514
|
+
*/
|
|
515
|
+
export interface EntityQueryOptions {
|
|
516
|
+
/**
|
|
517
|
+
* Limits the number of entities to return, opting for the
|
|
518
|
+
* closest N entities as specified by this property. The
|
|
519
|
+
* location value must also be specified on the query options
|
|
520
|
+
* object.
|
|
521
|
+
*/
|
|
522
|
+
closest?: number;
|
|
523
|
+
/**
|
|
524
|
+
* Excludes entities that match one or more of the specified
|
|
525
|
+
* families.
|
|
526
|
+
*/
|
|
527
|
+
excludeFamilies?: string[];
|
|
528
|
+
/**
|
|
529
|
+
* Excludes entities if have a specific gamemode that matches
|
|
530
|
+
* the specified gamemode.
|
|
531
|
+
*/
|
|
532
|
+
excludeGameModes?: GameMode[];
|
|
533
|
+
/**
|
|
534
|
+
* Excludes entities that have a name that match one of the
|
|
535
|
+
* specified values.
|
|
536
|
+
*/
|
|
537
|
+
excludeNames?: string[];
|
|
538
|
+
/**
|
|
539
|
+
* Excludes entities with a tag that matches one of the
|
|
540
|
+
* specified values.
|
|
541
|
+
*/
|
|
542
|
+
excludeTags?: string[];
|
|
543
|
+
/**
|
|
544
|
+
* Excludes entities if they are one of the specified types.
|
|
545
|
+
*/
|
|
546
|
+
excludeTypes?: string[];
|
|
547
|
+
/**
|
|
548
|
+
* If specified, includes entities that match all of the
|
|
549
|
+
* specified families.
|
|
550
|
+
*/
|
|
551
|
+
families?: string[];
|
|
552
|
+
/**
|
|
553
|
+
* Limits the number of entities to return, opting for the
|
|
554
|
+
* farthest N entities as specified by this property. The
|
|
555
|
+
* location value must also be specified on the query options
|
|
556
|
+
* object.
|
|
557
|
+
*/
|
|
558
|
+
farthest?: number;
|
|
559
|
+
/**
|
|
560
|
+
* If specified, includes entities with a gamemode that matches
|
|
561
|
+
* the specified gamemode.
|
|
562
|
+
*/
|
|
563
|
+
gameMode?: GameMode;
|
|
564
|
+
/**
|
|
565
|
+
* Adds a seed location to the query that is used in
|
|
566
|
+
* conjunction with closest, farthest, limit, volume, and
|
|
567
|
+
* distance properties.
|
|
568
|
+
*/
|
|
569
|
+
location?: Vector3;
|
|
570
|
+
/**
|
|
571
|
+
* If specified, includes entities that are less than this
|
|
572
|
+
* distance away from the location specified in the location
|
|
573
|
+
* property.
|
|
574
|
+
*/
|
|
575
|
+
maxDistance?: number;
|
|
576
|
+
/**
|
|
577
|
+
* If specified, will only include entities that have at most
|
|
578
|
+
* this horizontal rotation.
|
|
579
|
+
*/
|
|
580
|
+
maxHorizontalRotation?: number;
|
|
581
|
+
/**
|
|
582
|
+
* If defined, only players that have at most this level are
|
|
583
|
+
* returned.
|
|
584
|
+
*/
|
|
585
|
+
maxLevel?: number;
|
|
586
|
+
/**
|
|
587
|
+
* If specified, only entities that have at most this vertical
|
|
588
|
+
* rotation are returned.
|
|
589
|
+
*/
|
|
590
|
+
maxVerticalRotation?: number;
|
|
591
|
+
/**
|
|
592
|
+
* If specified, includes entities that are least this distance
|
|
593
|
+
* away from the location specified in the location property.
|
|
594
|
+
*/
|
|
595
|
+
minDistance?: number;
|
|
596
|
+
/**
|
|
597
|
+
* If specified, will only include entities that have at a
|
|
598
|
+
* minimum this horizontal rotation.
|
|
599
|
+
*/
|
|
600
|
+
minHorizontalRotation?: number;
|
|
601
|
+
/**
|
|
602
|
+
* If defined, only players that have at least this level are
|
|
603
|
+
* returned.
|
|
604
|
+
*/
|
|
605
|
+
minLevel?: number;
|
|
606
|
+
/**
|
|
607
|
+
* If specified, will only include entities that have at least
|
|
608
|
+
* this vertical rotation.
|
|
609
|
+
*/
|
|
610
|
+
minVerticalRotation?: number;
|
|
611
|
+
/**
|
|
612
|
+
* Includes entities with the specified name.
|
|
613
|
+
*/
|
|
614
|
+
name?: string;
|
|
615
|
+
/**
|
|
616
|
+
* Gets/sets a collection of EntityQueryScoreOptions objects
|
|
617
|
+
* with filters for specific scoreboard objectives.
|
|
618
|
+
*/
|
|
619
|
+
scoreOptions?: EntityQueryScoreOptions[];
|
|
620
|
+
/**
|
|
621
|
+
* Includes entities that match all of the specified tags.
|
|
622
|
+
*/
|
|
623
|
+
tags?: string[];
|
|
624
|
+
/**
|
|
625
|
+
* If defined, entities that match this type are included.
|
|
626
|
+
*/
|
|
627
|
+
type?: string;
|
|
628
|
+
}
|
|
629
|
+
/**
|
|
630
|
+
* @beta
|
|
631
|
+
* Contains additional options for filtering players based on
|
|
632
|
+
* their score for an objective.
|
|
633
|
+
*/
|
|
634
|
+
export interface EntityQueryScoreOptions {
|
|
635
|
+
/**
|
|
636
|
+
* If set to true, entities and players within this score range
|
|
637
|
+
* are excluded from query results.
|
|
638
|
+
*/
|
|
639
|
+
exclude?: boolean;
|
|
640
|
+
/**
|
|
641
|
+
* If defined, only players that have a score equal to or under
|
|
642
|
+
* maxScore are included.
|
|
643
|
+
*/
|
|
644
|
+
maxScore?: number;
|
|
645
|
+
/**
|
|
646
|
+
* If defined, only players that have a score equal to or over
|
|
647
|
+
* minScore are included.
|
|
648
|
+
*/
|
|
649
|
+
minScore?: number;
|
|
650
|
+
/**
|
|
651
|
+
* Identifier of the scoreboard objective to filter on.
|
|
652
|
+
*/
|
|
653
|
+
objective?: string;
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* @beta
|
|
657
|
+
*/
|
|
381
658
|
export interface RawMessage {
|
|
382
659
|
rawtext?: RawMessage[];
|
|
383
660
|
score?: RawMessageScore;
|
|
@@ -385,6 +662,9 @@ export interface RawMessage {
|
|
|
385
662
|
translate?: string;
|
|
386
663
|
with?: string[] | RawMessage;
|
|
387
664
|
}
|
|
665
|
+
/**
|
|
666
|
+
* @beta
|
|
667
|
+
*/
|
|
388
668
|
export interface RawMessageScore {
|
|
389
669
|
name?: string;
|
|
390
670
|
objective?: string;
|