@minecraft/server 1.3.0-rc.1.20.10-preview.24 → 1.3.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 +568 -451
- package/package.json +1 -1
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,14 +15,11 @@
|
|
|
16
15
|
* ```json
|
|
17
16
|
* {
|
|
18
17
|
* "module_name": "@minecraft/server",
|
|
19
|
-
* "version": "1.
|
|
18
|
+
* "version": "1.3.0"
|
|
20
19
|
* }
|
|
21
20
|
* ```
|
|
22
21
|
*
|
|
23
22
|
*/
|
|
24
|
-
/**
|
|
25
|
-
* @beta
|
|
26
|
-
*/
|
|
27
23
|
export enum EntityDamageCause {
|
|
28
24
|
anvil = 'anvil',
|
|
29
25
|
blockExplosion = 'blockExplosion',
|
|
@@ -59,12 +55,10 @@ export enum EntityDamageCause {
|
|
|
59
55
|
}
|
|
60
56
|
|
|
61
57
|
/**
|
|
62
|
-
* @beta
|
|
63
58
|
* Represents a game mode for the current world experience.
|
|
64
59
|
*/
|
|
65
60
|
export enum GameMode {
|
|
66
61
|
/**
|
|
67
|
-
* @beta
|
|
68
62
|
* @remarks
|
|
69
63
|
* World is in a more locked-down experience, where blocks may
|
|
70
64
|
* not be manipulated.
|
|
@@ -72,7 +66,6 @@ export enum GameMode {
|
|
|
72
66
|
*/
|
|
73
67
|
adventure = 'adventure',
|
|
74
68
|
/**
|
|
75
|
-
* @beta
|
|
76
69
|
* @remarks
|
|
77
70
|
* World is in a full creative mode. In creative mode, the
|
|
78
71
|
* player has all the resources available in the item selection
|
|
@@ -84,9 +77,19 @@ export enum GameMode {
|
|
|
84
77
|
*
|
|
85
78
|
*/
|
|
86
79
|
creative = 'creative',
|
|
80
|
+
/**
|
|
81
|
+
* @remarks
|
|
82
|
+
* World is in spectator mode. In spectator mode, spectators
|
|
83
|
+
* are always flying and cannot become grounded. Spectators can
|
|
84
|
+
* pass through solid blocks and entities without any
|
|
85
|
+
* collisions, and cannot use items or interact with blocks or
|
|
86
|
+
* mobs. Spectators cannot be seen by mobs or other players,
|
|
87
|
+
* except for other spectators; spectators appear as a
|
|
88
|
+
* transparent floating head.
|
|
89
|
+
*
|
|
90
|
+
*/
|
|
87
91
|
spectator = 'spectator',
|
|
88
92
|
/**
|
|
89
|
-
* @beta
|
|
90
93
|
* @remarks
|
|
91
94
|
* World is in a survival mode, where players can take damage
|
|
92
95
|
* and entities may not be peaceful. Survival mode is where the
|
|
@@ -99,16 +102,31 @@ export enum GameMode {
|
|
|
99
102
|
}
|
|
100
103
|
|
|
101
104
|
/**
|
|
102
|
-
*
|
|
105
|
+
* Describes how an an item can be moved within a container.
|
|
103
106
|
*/
|
|
104
107
|
export enum ItemLockMode {
|
|
108
|
+
/**
|
|
109
|
+
* @remarks
|
|
110
|
+
* The item cannot be dropped or crafted with.
|
|
111
|
+
*
|
|
112
|
+
*/
|
|
105
113
|
inventory = 'inventory',
|
|
114
|
+
/**
|
|
115
|
+
* @remarks
|
|
116
|
+
* The item has no container restrictions.
|
|
117
|
+
*
|
|
118
|
+
*/
|
|
106
119
|
none = 'none',
|
|
120
|
+
/**
|
|
121
|
+
* @remarks
|
|
122
|
+
* The item cannot be moved from its slot, dropped or crafted
|
|
123
|
+
* with.
|
|
124
|
+
*
|
|
125
|
+
*/
|
|
107
126
|
slot = 'slot',
|
|
108
127
|
}
|
|
109
128
|
|
|
110
129
|
/**
|
|
111
|
-
* @beta
|
|
112
130
|
* Represents a block in a dimension. A block represents a
|
|
113
131
|
* unique X, Y, and Z within a dimension and get/sets the state
|
|
114
132
|
* of the block at that location. This type was significantly
|
|
@@ -156,7 +174,6 @@ export class Block {
|
|
|
156
174
|
*/
|
|
157
175
|
readonly z: number;
|
|
158
176
|
/**
|
|
159
|
-
* @beta
|
|
160
177
|
* @remarks
|
|
161
178
|
* Gets additional configuration properties (a component) for
|
|
162
179
|
* specific capabilities of particular blocks - for example, an
|
|
@@ -187,14 +204,12 @@ export class Block {
|
|
|
187
204
|
}
|
|
188
205
|
|
|
189
206
|
/**
|
|
190
|
-
* @beta
|
|
191
207
|
* Base type for components associated with blocks.
|
|
192
208
|
*/
|
|
193
209
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
194
210
|
export class BlockComponent extends Component {
|
|
195
211
|
private constructor();
|
|
196
212
|
/**
|
|
197
|
-
* @beta
|
|
198
213
|
* @remarks
|
|
199
214
|
* Block instance that this component pertains to.
|
|
200
215
|
*
|
|
@@ -203,7 +218,6 @@ export class BlockComponent extends Component {
|
|
|
203
218
|
}
|
|
204
219
|
|
|
205
220
|
/**
|
|
206
|
-
* @beta
|
|
207
221
|
* Contains information regarding an event that impacts a
|
|
208
222
|
* specific block.
|
|
209
223
|
*/
|
|
@@ -225,7 +239,6 @@ export class BlockEvent {
|
|
|
225
239
|
}
|
|
226
240
|
|
|
227
241
|
/**
|
|
228
|
-
* @beta
|
|
229
242
|
* Represents the inventory of a block in the world. Used with
|
|
230
243
|
* blocks like chests.
|
|
231
244
|
*/
|
|
@@ -239,21 +252,14 @@ export class BlockInventoryComponent extends BlockComponent {
|
|
|
239
252
|
* @throws This property can throw when used.
|
|
240
253
|
*/
|
|
241
254
|
readonly container: Container;
|
|
242
|
-
/**
|
|
243
|
-
* @remarks
|
|
244
|
-
* Identifier of this component. Should always be
|
|
245
|
-
* minecraft:inventory.
|
|
246
|
-
*
|
|
247
|
-
*/
|
|
248
255
|
static readonly componentId = 'minecraft:inventory';
|
|
249
256
|
}
|
|
250
257
|
|
|
251
258
|
/**
|
|
252
|
-
* @beta
|
|
253
259
|
* Contains the combination of type {@link BlockType} and
|
|
254
260
|
* properties (also sometimes called block state) which
|
|
255
261
|
* describe a block (but does not belong to a specific {@link
|
|
256
|
-
* Block}).
|
|
262
|
+
* Block}).
|
|
257
263
|
*/
|
|
258
264
|
export class BlockPermutation {
|
|
259
265
|
private constructor();
|
|
@@ -276,12 +282,51 @@ export class BlockPermutation {
|
|
|
276
282
|
* @param blockName
|
|
277
283
|
* Identifier of the block to check.
|
|
278
284
|
* @throws This function can throw errors.
|
|
285
|
+
* @example addBlockColorCube.ts
|
|
286
|
+
* ```typescript
|
|
287
|
+
* const allColorNames: string[] = [
|
|
288
|
+
* "white",
|
|
289
|
+
* "orange",
|
|
290
|
+
* "magenta",
|
|
291
|
+
* "light_blue",
|
|
292
|
+
* "yellow",
|
|
293
|
+
* "lime",
|
|
294
|
+
* "pink",
|
|
295
|
+
* "gray",
|
|
296
|
+
* "silver",
|
|
297
|
+
* "cyan",
|
|
298
|
+
* "purple",
|
|
299
|
+
* "blue",
|
|
300
|
+
* "brown",
|
|
301
|
+
* "green",
|
|
302
|
+
* "red",
|
|
303
|
+
* "black",
|
|
304
|
+
* ];
|
|
305
|
+
*
|
|
306
|
+
* const cubeDim = 7;
|
|
307
|
+
*
|
|
308
|
+
* let colorIndex = 0;
|
|
309
|
+
*
|
|
310
|
+
* for (let x = 0; x <= cubeDim; x++) {
|
|
311
|
+
* for (let y = 0; y <= cubeDim; y++) {
|
|
312
|
+
* for (let z = 0; z <= cubeDim; z++) {
|
|
313
|
+
* colorIndex++;
|
|
314
|
+
* overworld
|
|
315
|
+
* .getBlock({ x: targetLocation.x + x, y: targetLocation.y + y, z: targetLocation.z + z })
|
|
316
|
+
* ?.setPermutation(
|
|
317
|
+
* mc.BlockPermutation.resolve("minecraft:wool", {
|
|
318
|
+
* color: allColorNames[colorIndex % allColorNames.length],
|
|
319
|
+
* })
|
|
320
|
+
* );
|
|
321
|
+
* }
|
|
322
|
+
* }
|
|
323
|
+
* }
|
|
324
|
+
* ```
|
|
279
325
|
*/
|
|
280
326
|
static resolve(blockName: string, states?: Record<string, boolean | number | string>): BlockPermutation;
|
|
281
327
|
}
|
|
282
328
|
|
|
283
329
|
/**
|
|
284
|
-
* @beta
|
|
285
330
|
* Contains information related to changes to a button push.
|
|
286
331
|
*/
|
|
287
332
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -296,7 +341,6 @@ export class ButtonPushAfterEvent extends BlockEvent {
|
|
|
296
341
|
}
|
|
297
342
|
|
|
298
343
|
/**
|
|
299
|
-
* @beta
|
|
300
344
|
* Manages callbacks that are connected to when a button is
|
|
301
345
|
* pushed.
|
|
302
346
|
*/
|
|
@@ -321,7 +365,6 @@ export class CommandResult {
|
|
|
321
365
|
}
|
|
322
366
|
|
|
323
367
|
/**
|
|
324
|
-
* @beta
|
|
325
368
|
* Base class for downstream Component implementations.
|
|
326
369
|
*/
|
|
327
370
|
export class Component {
|
|
@@ -335,7 +378,6 @@ export class Component {
|
|
|
335
378
|
}
|
|
336
379
|
|
|
337
380
|
/**
|
|
338
|
-
* @beta
|
|
339
381
|
* Represents a container that can hold sets of items. Used
|
|
340
382
|
* with entities such as Players, Chest Minecarts, Llamas, and
|
|
341
383
|
* more.
|
|
@@ -515,19 +557,26 @@ export class Dimension {
|
|
|
515
557
|
*/
|
|
516
558
|
readonly id: string;
|
|
517
559
|
/**
|
|
518
|
-
* @beta
|
|
519
560
|
* @remarks
|
|
520
561
|
* Returns a block instance at the given location.
|
|
521
562
|
*
|
|
522
563
|
* @param location
|
|
523
564
|
* The location at which to return a block.
|
|
524
565
|
* @returns
|
|
525
|
-
* Block at the specified location
|
|
526
|
-
*
|
|
566
|
+
* Block at the specified location, or 'undefined' if asking
|
|
567
|
+
* for a block at an unloaded chunk.
|
|
568
|
+
* @throws
|
|
569
|
+
* PositionInUnloadedChunkError: Exception thrown when trying
|
|
570
|
+
* to interact with a Block object that isn't in a loaded and
|
|
571
|
+
* ticking chunk anymore
|
|
572
|
+
*
|
|
573
|
+
* PositionOutOfWorldBoundariesError: Exception thrown when
|
|
574
|
+
* trying to interact with a position outside of dimension
|
|
575
|
+
* height range
|
|
576
|
+
*
|
|
527
577
|
*/
|
|
528
578
|
getBlock(location: Vector3): Block | undefined;
|
|
529
579
|
/**
|
|
530
|
-
* @beta
|
|
531
580
|
* @remarks
|
|
532
581
|
* Returns a set of entities based on a set of conditions
|
|
533
582
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
@@ -538,28 +587,64 @@ export class Dimension {
|
|
|
538
587
|
* @returns
|
|
539
588
|
* An entity array.
|
|
540
589
|
* @throws This function can throw errors.
|
|
590
|
+
* @example bounceSkeletons.ts
|
|
591
|
+
* ```typescript
|
|
592
|
+
* let mobs = ["creeper", "skeleton", "sheep"];
|
|
593
|
+
*
|
|
594
|
+
* // create some sample mob data
|
|
595
|
+
* for (let i = 0; i < 10; i++) {
|
|
596
|
+
* overworld.spawnEntity(mobs[i % mobs.length], targetLocation);
|
|
597
|
+
* }
|
|
598
|
+
*
|
|
599
|
+
* let eqo: mc.EntityQueryOptions = {
|
|
600
|
+
* type: "skeleton",
|
|
601
|
+
* };
|
|
602
|
+
*
|
|
603
|
+
* for (let entity of overworld.getEntities(eqo)) {
|
|
604
|
+
* entity.applyKnockback(0, 0, 0, 1);
|
|
605
|
+
* }
|
|
606
|
+
* ```
|
|
607
|
+
* @example tagsQuery.ts
|
|
608
|
+
* ```typescript
|
|
609
|
+
* let mobs = ["creeper", "skeleton", "sheep"];
|
|
610
|
+
*
|
|
611
|
+
* // create some sample mob data
|
|
612
|
+
* for (let i = 0; i < 10; i++) {
|
|
613
|
+
* let mobTypeId = mobs[i % mobs.length];
|
|
614
|
+
* let entity = overworld.spawnEntity(mobTypeId, targetLocation);
|
|
615
|
+
* entity.addTag("mobparty." + mobTypeId);
|
|
616
|
+
* }
|
|
617
|
+
*
|
|
618
|
+
* let eqo: mc.EntityQueryOptions = {
|
|
619
|
+
* tags: ["mobparty.skeleton"],
|
|
620
|
+
* };
|
|
621
|
+
*
|
|
622
|
+
* for (let entity of overworld.getEntities(eqo)) {
|
|
623
|
+
* entity.kill();
|
|
624
|
+
* }
|
|
625
|
+
* ```
|
|
541
626
|
* @example testThatEntityIsFeatherItem.ts
|
|
542
627
|
* ```typescript
|
|
543
|
-
*
|
|
544
|
-
*
|
|
545
|
-
*
|
|
546
|
-
*
|
|
547
|
-
*
|
|
628
|
+
* const overworld = mc.world.getDimension("overworld");
|
|
629
|
+
*
|
|
630
|
+
* const items = overworld.getEntities({
|
|
631
|
+
* location: targetLocation,
|
|
632
|
+
* maxDistance: 20,
|
|
633
|
+
* });
|
|
548
634
|
*
|
|
549
|
-
*
|
|
550
|
-
*
|
|
635
|
+
* for (const item of items) {
|
|
636
|
+
* const itemComp = item.getComponent("item") as mc.EntityItemComponent;
|
|
551
637
|
*
|
|
552
|
-
*
|
|
553
|
-
*
|
|
554
|
-
*
|
|
638
|
+
* if (itemComp) {
|
|
639
|
+
* if (itemComp.itemStack.typeId.endsWith("feather")) {
|
|
640
|
+
* log("Success! Found a feather", 1);
|
|
641
|
+
* }
|
|
555
642
|
* }
|
|
556
643
|
* }
|
|
557
|
-
* }
|
|
558
644
|
* ```
|
|
559
645
|
*/
|
|
560
646
|
getEntities(options?: EntityQueryOptions): Entity[];
|
|
561
647
|
/**
|
|
562
|
-
* @beta
|
|
563
648
|
* @remarks
|
|
564
649
|
* Returns a set of entities at a particular location.
|
|
565
650
|
*
|
|
@@ -570,7 +655,6 @@ export class Dimension {
|
|
|
570
655
|
*/
|
|
571
656
|
getEntitiesAtBlockLocation(location: Vector3): Entity[];
|
|
572
657
|
/**
|
|
573
|
-
* @beta
|
|
574
658
|
* @remarks
|
|
575
659
|
* Returns a set of players based on a set of conditions
|
|
576
660
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
@@ -584,11 +668,24 @@ export class Dimension {
|
|
|
584
668
|
*/
|
|
585
669
|
getPlayers(options?: EntityQueryOptions): Player[];
|
|
586
670
|
/**
|
|
587
|
-
* @beta
|
|
588
671
|
* @remarks
|
|
672
|
+
* Runs a command synchronously using the context of the
|
|
673
|
+
* broader dimenion.
|
|
674
|
+
*
|
|
589
675
|
* This function can't be called in read-only mode.
|
|
590
676
|
*
|
|
591
|
-
* @
|
|
677
|
+
* @param commandString
|
|
678
|
+
* Command to run. Note that command strings should not start
|
|
679
|
+
* with slash.
|
|
680
|
+
* @returns
|
|
681
|
+
* Returns a command result with a count of successful values
|
|
682
|
+
* from the command.
|
|
683
|
+
* @throws
|
|
684
|
+
* Throws an exception if the command fails due to incorrect
|
|
685
|
+
* parameters or command syntax, or in erroneous cases for the
|
|
686
|
+
* command. Note that in many cases, if the command does not
|
|
687
|
+
* operate (e.g., a target selector found no matches), this
|
|
688
|
+
* method will not throw an exception.
|
|
592
689
|
*/
|
|
593
690
|
runCommand(commandString: string): CommandResult;
|
|
594
691
|
/**
|
|
@@ -604,11 +701,15 @@ export class Dimension {
|
|
|
604
701
|
* @returns
|
|
605
702
|
* For commands that return data, returns a CommandResult with
|
|
606
703
|
* an indicator of command results.
|
|
607
|
-
* @throws
|
|
704
|
+
* @throws
|
|
705
|
+
* Throws an exception if the command fails due to incorrect
|
|
706
|
+
* parameters or command syntax, or in erroneous cases for the
|
|
707
|
+
* command. Note that in many cases, if the command does not
|
|
708
|
+
* operate (e.g., a target selector found no matches), this
|
|
709
|
+
* method will not throw an exception.
|
|
608
710
|
*/
|
|
609
711
|
runCommandAsync(commandString: string): Promise<CommandResult>;
|
|
610
712
|
/**
|
|
611
|
-
* @beta
|
|
612
713
|
* @remarks
|
|
613
714
|
* Creates a new entity (e.g., a mob) at the specified
|
|
614
715
|
* location.
|
|
@@ -625,45 +726,46 @@ export class Dimension {
|
|
|
625
726
|
* @throws This function can throw errors.
|
|
626
727
|
* @example createOldHorse.ts
|
|
627
728
|
* ```typescript
|
|
628
|
-
*
|
|
729
|
+
* const overworld = mc.world.getDimension("overworld");
|
|
730
|
+
*
|
|
731
|
+
* log("Create a horse and triggering the 'ageable_grow_up' event, ensuring the horse is created as an adult");
|
|
629
732
|
* overworld.spawnEntity("minecraft:horse<minecraft:ageable_grow_up>", targetLocation);
|
|
630
733
|
* ```
|
|
631
734
|
* @example quickFoxLazyDog.ts
|
|
632
735
|
* ```typescript
|
|
633
|
-
*
|
|
634
|
-
* x: targetLocation.x + 1,
|
|
635
|
-
* y: targetLocation.y + 2,
|
|
636
|
-
* z: targetLocation.z + 3,
|
|
637
|
-
* });
|
|
638
|
-
* fox.addEffect(mc.MinecraftEffectTypes.Speed, 10, 20);
|
|
639
|
-
* log("Created a fox.");
|
|
640
|
-
*
|
|
641
|
-
* const wolf = overworld.spawnEntity("minecraft:wolf", {
|
|
642
|
-
* x: targetLocation.x + 4,
|
|
643
|
-
* y: targetLocation.y + 2,
|
|
644
|
-
* z: targetLocation.z + 3,
|
|
645
|
-
* });
|
|
646
|
-
* wolf.addEffect(mc.MinecraftEffectTypes.Slowness, 10, 20);
|
|
647
|
-
* wolf.isSneaking = true;
|
|
648
|
-
* log("Created a sneaking wolf.", 1);
|
|
649
|
-
* ```
|
|
650
|
-
* @example trapTick.ts
|
|
651
|
-
* ```typescript
|
|
652
|
-
* let ticks = 0;
|
|
736
|
+
* const overworld = mc.world.getDimension("overworld");
|
|
653
737
|
*
|
|
654
|
-
*
|
|
655
|
-
*
|
|
738
|
+
* const fox = overworld.spawnEntity("minecraft:fox", {
|
|
739
|
+
* x: targetLocation.x + 1,
|
|
740
|
+
* y: targetLocation.y + 2,
|
|
741
|
+
* z: targetLocation.z + 3,
|
|
742
|
+
* });
|
|
656
743
|
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
744
|
+
* fox.addEffect("speed", 10, {
|
|
745
|
+
* amplifier: 2,
|
|
746
|
+
* });
|
|
747
|
+
* log("Created a fox.");
|
|
748
|
+
*
|
|
749
|
+
* const wolf = overworld.spawnEntity("minecraft:wolf", {
|
|
750
|
+
* x: targetLocation.x + 4,
|
|
751
|
+
* y: targetLocation.y + 2,
|
|
752
|
+
* z: targetLocation.z + 3,
|
|
661
753
|
* });
|
|
754
|
+
* wolf.addEffect("slowness", 10, {
|
|
755
|
+
* amplifier: 2,
|
|
756
|
+
* });
|
|
757
|
+
* wolf.isSneaking = true;
|
|
758
|
+
* log("Created a sneaking wolf.", 1);
|
|
759
|
+
* ```
|
|
760
|
+
* @example triggerEvent.ts
|
|
761
|
+
* ```typescript
|
|
762
|
+
* const creeper = overworld.spawnEntity("minecraft:creeper", targetLocation);
|
|
763
|
+
*
|
|
764
|
+
* creeper.triggerEvent("minecraft:start_exploding_forced");
|
|
662
765
|
* ```
|
|
663
766
|
*/
|
|
664
767
|
spawnEntity(identifier: string, location: Vector3): Entity;
|
|
665
768
|
/**
|
|
666
|
-
* @beta
|
|
667
769
|
* @remarks
|
|
668
770
|
* Creates a new item stack as an entity at the specified
|
|
669
771
|
* location.
|
|
@@ -677,31 +779,37 @@ export class Dimension {
|
|
|
677
779
|
* @throws This function can throw errors.
|
|
678
780
|
* @example itemStacks.ts
|
|
679
781
|
* ```typescript
|
|
680
|
-
* const
|
|
681
|
-
*
|
|
682
|
-
* const
|
|
782
|
+
* const overworld = mc.world.getDimension('overworld');
|
|
783
|
+
*
|
|
784
|
+
* const oneItemLoc = { x: targetLocation.x + targetLocation.y + 3, y: 2, z: targetLocation.z + 1 };
|
|
785
|
+
* const fiveItemsLoc = { x: targetLocation.x + 1, y: targetLocation.y + 2, z: targetLocation.z + 1 };
|
|
786
|
+
* const diamondPickaxeLoc = { x: targetLocation.x + 2, y: targetLocation.y + 2, z: targetLocation.z + 4 };
|
|
683
787
|
*
|
|
684
|
-
* const oneEmerald = new mc.ItemStack(mc.MinecraftItemTypes.
|
|
685
|
-
* const onePickaxe = new mc.ItemStack(mc.MinecraftItemTypes.
|
|
686
|
-
* const fiveEmeralds = new mc.ItemStack(mc.MinecraftItemTypes.
|
|
788
|
+
* const oneEmerald = new mc.ItemStack(mc.MinecraftItemTypes.Emerald, 1);
|
|
789
|
+
* const onePickaxe = new mc.ItemStack(mc.MinecraftItemTypes.DiamondPickaxe, 1);
|
|
790
|
+
* const fiveEmeralds = new mc.ItemStack(mc.MinecraftItemTypes.Emerald, 5);
|
|
687
791
|
*
|
|
792
|
+
* log(`Spawning an emerald at (${oneItemLoc.x}, ${oneItemLoc.y}, ${oneItemLoc.z})`);
|
|
688
793
|
* overworld.spawnItem(oneEmerald, oneItemLoc);
|
|
794
|
+
*
|
|
795
|
+
* log(`Spawning five emeralds at (${fiveItemsLoc.x}, ${fiveItemsLoc.y}, ${fiveItemsLoc.z})`);
|
|
689
796
|
* overworld.spawnItem(fiveEmeralds, fiveItemsLoc);
|
|
797
|
+
*
|
|
798
|
+
* log(`Spawning a diamond pickaxe at (${diamondPickaxeLoc.x}, ${diamondPickaxeLoc.y}, ${diamondPickaxeLoc.z})`);
|
|
690
799
|
* overworld.spawnItem(onePickaxe, diamondPickaxeLoc);
|
|
691
800
|
* ```
|
|
692
801
|
* @example spawnItem.ts
|
|
693
802
|
* ```typescript
|
|
694
|
-
*
|
|
803
|
+
* const featherItem = new mc.ItemStack(mc.MinecraftItemTypes.Feather, 1);
|
|
695
804
|
*
|
|
696
|
-
*
|
|
697
|
-
*
|
|
805
|
+
* overworld.spawnItem(featherItem, targetLocation);
|
|
806
|
+
* log(`New feather created at ${targetLocation.x}, ${targetLocation.y}, ${targetLocation.z}!`);
|
|
698
807
|
* ```
|
|
699
808
|
*/
|
|
700
809
|
spawnItem(itemStack: ItemStack, location: Vector3): Entity;
|
|
701
810
|
}
|
|
702
811
|
|
|
703
812
|
/**
|
|
704
|
-
* @beta
|
|
705
813
|
* Represents an effect - like poison - that has been added to
|
|
706
814
|
* an Entity.
|
|
707
815
|
*/
|
|
@@ -740,11 +848,16 @@ export class Effect {
|
|
|
740
848
|
* @throws This property can throw when used.
|
|
741
849
|
*/
|
|
742
850
|
readonly typeId: string;
|
|
851
|
+
/**
|
|
852
|
+
* @remarks
|
|
853
|
+
* Returns whether an effect instance is available for use in
|
|
854
|
+
* this context.
|
|
855
|
+
*
|
|
856
|
+
*/
|
|
743
857
|
isValid(): boolean;
|
|
744
858
|
}
|
|
745
859
|
|
|
746
860
|
/**
|
|
747
|
-
* @beta
|
|
748
861
|
* Represents a type of effect - like poison - that can be
|
|
749
862
|
* applied to an entity.
|
|
750
863
|
*/
|
|
@@ -767,7 +880,6 @@ export class EffectType {
|
|
|
767
880
|
export class Entity {
|
|
768
881
|
private constructor();
|
|
769
882
|
/**
|
|
770
|
-
* @beta
|
|
771
883
|
* @remarks
|
|
772
884
|
* Dimension that the entity is currently within.
|
|
773
885
|
*
|
|
@@ -779,13 +891,14 @@ export class Entity {
|
|
|
779
891
|
* Unique identifier of the entity. This identifier is intended
|
|
780
892
|
* to be consistent across loads of a world instance. No
|
|
781
893
|
* meaning should be inferred from the value and structure of
|
|
782
|
-
* this unique identifier - do not parse or interpret it.
|
|
894
|
+
* this unique identifier - do not parse or interpret it. This
|
|
895
|
+
* property is accessible even if {@link Entity.isValid} is
|
|
896
|
+
* false.
|
|
783
897
|
*
|
|
784
898
|
* @throws This property can throw when used.
|
|
785
899
|
*/
|
|
786
900
|
readonly id: string;
|
|
787
901
|
/**
|
|
788
|
-
* @beta
|
|
789
902
|
* @remarks
|
|
790
903
|
* Current location of the entity.
|
|
791
904
|
*
|
|
@@ -793,7 +906,6 @@ export class Entity {
|
|
|
793
906
|
*/
|
|
794
907
|
readonly location: Vector3;
|
|
795
908
|
/**
|
|
796
|
-
* @beta
|
|
797
909
|
* @remarks
|
|
798
910
|
* Given name of the entity.
|
|
799
911
|
*
|
|
@@ -804,13 +916,13 @@ export class Entity {
|
|
|
804
916
|
/**
|
|
805
917
|
* @remarks
|
|
806
918
|
* Unique identifier of the type of the entity - for example,
|
|
807
|
-
* 'minecraft:skeleton'.
|
|
919
|
+
* 'minecraft:skeleton'. This property is accessible even if
|
|
920
|
+
* {@link Entity.isValid} is false.
|
|
808
921
|
*
|
|
809
922
|
* @throws This property can throw when used.
|
|
810
923
|
*/
|
|
811
924
|
readonly typeId: string;
|
|
812
925
|
/**
|
|
813
|
-
* @beta
|
|
814
926
|
* @remarks
|
|
815
927
|
* Adds or updates an effect, like poison, to the entity.
|
|
816
928
|
*
|
|
@@ -842,42 +954,67 @@ export class Entity {
|
|
|
842
954
|
* ```
|
|
843
955
|
* @example quickFoxLazyDog.ts
|
|
844
956
|
* ```typescript
|
|
845
|
-
*
|
|
957
|
+
* const overworld = mc.world.getDimension("overworld");
|
|
958
|
+
*
|
|
959
|
+
* const fox = overworld.spawnEntity("minecraft:fox", {
|
|
846
960
|
* x: targetLocation.x + 1,
|
|
847
961
|
* y: targetLocation.y + 2,
|
|
848
962
|
* z: targetLocation.z + 3,
|
|
849
|
-
*
|
|
850
|
-
*
|
|
851
|
-
*
|
|
963
|
+
* });
|
|
964
|
+
*
|
|
965
|
+
* fox.addEffect("speed", 10, {
|
|
966
|
+
* amplifier: 2,
|
|
967
|
+
* });
|
|
968
|
+
* log("Created a fox.");
|
|
852
969
|
*
|
|
853
|
-
*
|
|
970
|
+
* const wolf = overworld.spawnEntity("minecraft:wolf", {
|
|
854
971
|
* x: targetLocation.x + 4,
|
|
855
972
|
* y: targetLocation.y + 2,
|
|
856
973
|
* z: targetLocation.z + 3,
|
|
857
|
-
*
|
|
858
|
-
*
|
|
859
|
-
*
|
|
860
|
-
*
|
|
974
|
+
* });
|
|
975
|
+
* wolf.addEffect("slowness", 10, {
|
|
976
|
+
* amplifier: 2,
|
|
977
|
+
* });
|
|
978
|
+
* wolf.isSneaking = true;
|
|
979
|
+
* log("Created a sneaking wolf.", 1);
|
|
861
980
|
* ```
|
|
862
981
|
*/
|
|
863
982
|
addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions): void;
|
|
864
983
|
/**
|
|
865
|
-
* @beta
|
|
866
984
|
* @remarks
|
|
867
985
|
* Adds a specified tag to an entity.
|
|
868
986
|
*
|
|
869
987
|
* This function can't be called in read-only mode.
|
|
870
988
|
*
|
|
871
989
|
* @param tag
|
|
872
|
-
* Content of the tag to add.
|
|
990
|
+
* Content of the tag to add. The tag must be less than 256
|
|
991
|
+
* characters.
|
|
873
992
|
* @returns
|
|
874
993
|
* Returns true if the tag was added successfully. This can
|
|
875
994
|
* fail if the tag already exists on the entity.
|
|
876
995
|
* @throws This function can throw errors.
|
|
996
|
+
* @example tagsQuery.ts
|
|
997
|
+
* ```typescript
|
|
998
|
+
* let mobs = ["creeper", "skeleton", "sheep"];
|
|
999
|
+
*
|
|
1000
|
+
* // create some sample mob data
|
|
1001
|
+
* for (let i = 0; i < 10; i++) {
|
|
1002
|
+
* let mobTypeId = mobs[i % mobs.length];
|
|
1003
|
+
* let entity = overworld.spawnEntity(mobTypeId, targetLocation);
|
|
1004
|
+
* entity.addTag("mobparty." + mobTypeId);
|
|
1005
|
+
* }
|
|
1006
|
+
*
|
|
1007
|
+
* let eqo: mc.EntityQueryOptions = {
|
|
1008
|
+
* tags: ["mobparty.skeleton"],
|
|
1009
|
+
* };
|
|
1010
|
+
*
|
|
1011
|
+
* for (let entity of overworld.getEntities(eqo)) {
|
|
1012
|
+
* entity.kill();
|
|
1013
|
+
* }
|
|
1014
|
+
* ```
|
|
877
1015
|
*/
|
|
878
1016
|
addTag(tag: string): boolean;
|
|
879
1017
|
/**
|
|
880
|
-
* @beta
|
|
881
1018
|
* @remarks
|
|
882
1019
|
* Applies a set of damage to an entity.
|
|
883
1020
|
*
|
|
@@ -894,10 +1031,22 @@ export class Entity {
|
|
|
894
1031
|
* if the entity is invulnerable or if the damage applied is
|
|
895
1032
|
* less than or equal to 0.
|
|
896
1033
|
* @throws This function can throw errors.
|
|
1034
|
+
* @example applyDamageThenHeal.ts
|
|
1035
|
+
* ```typescript
|
|
1036
|
+
* const skelly = overworld.spawnEntity("minecraft:skeleton", targetLocation);
|
|
1037
|
+
*
|
|
1038
|
+
* skelly.applyDamage(19); // skeletons have max damage of 20 so this is a near-death skeleton
|
|
1039
|
+
*
|
|
1040
|
+
* mc.system.runTimeout(() => {
|
|
1041
|
+
* let health = skelly.getComponent("health") as mc.EntityHealthComponent;
|
|
1042
|
+
* log("Skeleton health before heal: " + health.currentValue);
|
|
1043
|
+
* health.resetToMaxValue();
|
|
1044
|
+
* log("Skeleton health after heal: " + health.currentValue);
|
|
1045
|
+
* }, 20);
|
|
1046
|
+
* ```
|
|
897
1047
|
*/
|
|
898
1048
|
applyDamage(amount: number, options?: EntityApplyDamageByProjectileOptions | EntityApplyDamageOptions): boolean;
|
|
899
1049
|
/**
|
|
900
|
-
* @beta
|
|
901
1050
|
* @remarks
|
|
902
1051
|
* Applies impulse vector to the current velocity of the
|
|
903
1052
|
* entity.
|
|
@@ -907,10 +1056,18 @@ export class Entity {
|
|
|
907
1056
|
* @param vector
|
|
908
1057
|
* Impulse vector.
|
|
909
1058
|
* @throws This function can throw errors.
|
|
1059
|
+
* @example applyImpulse.ts
|
|
1060
|
+
* ```typescript
|
|
1061
|
+
* const zombie = overworld.spawnEntity("minecraft:zombie", targetLocation);
|
|
1062
|
+
*
|
|
1063
|
+
* zombie.clearVelocity();
|
|
1064
|
+
*
|
|
1065
|
+
* // throw the zombie up in the air
|
|
1066
|
+
* zombie.applyImpulse({ x: 0, y: 0.5, z: 0 });
|
|
1067
|
+
* ```
|
|
910
1068
|
*/
|
|
911
1069
|
applyImpulse(vector: Vector3): void;
|
|
912
1070
|
/**
|
|
913
|
-
* @beta
|
|
914
1071
|
* @remarks
|
|
915
1072
|
* Applies impulse vector to the current velocity of the
|
|
916
1073
|
* entity.
|
|
@@ -926,10 +1083,26 @@ export class Entity {
|
|
|
926
1083
|
* @param verticalStrength
|
|
927
1084
|
* Knockback strength for the vertical vector.
|
|
928
1085
|
* @throws This function can throw errors.
|
|
1086
|
+
* @example bounceSkeletons.ts
|
|
1087
|
+
* ```typescript
|
|
1088
|
+
* let mobs = ["creeper", "skeleton", "sheep"];
|
|
1089
|
+
*
|
|
1090
|
+
* // create some sample mob data
|
|
1091
|
+
* for (let i = 0; i < 10; i++) {
|
|
1092
|
+
* overworld.spawnEntity(mobs[i % mobs.length], targetLocation);
|
|
1093
|
+
* }
|
|
1094
|
+
*
|
|
1095
|
+
* let eqo: mc.EntityQueryOptions = {
|
|
1096
|
+
* type: "skeleton",
|
|
1097
|
+
* };
|
|
1098
|
+
*
|
|
1099
|
+
* for (let entity of overworld.getEntities(eqo)) {
|
|
1100
|
+
* entity.applyKnockback(0, 0, 0, 1);
|
|
1101
|
+
* }
|
|
1102
|
+
* ```
|
|
929
1103
|
*/
|
|
930
1104
|
applyKnockback(directionX: number, directionZ: number, horizontalStrength: number, verticalStrength: number): void;
|
|
931
1105
|
/**
|
|
932
|
-
* @beta
|
|
933
1106
|
* @remarks
|
|
934
1107
|
* Sets the current velocity of the Entity to zero. Note that
|
|
935
1108
|
* this method may not have an impact on Players.
|
|
@@ -937,10 +1110,18 @@ export class Entity {
|
|
|
937
1110
|
* This function can't be called in read-only mode.
|
|
938
1111
|
*
|
|
939
1112
|
* @throws This function can throw errors.
|
|
1113
|
+
* @example applyImpulse.ts
|
|
1114
|
+
* ```typescript
|
|
1115
|
+
* const zombie = overworld.spawnEntity("minecraft:zombie", targetLocation);
|
|
1116
|
+
*
|
|
1117
|
+
* zombie.clearVelocity();
|
|
1118
|
+
*
|
|
1119
|
+
* // throw the zombie up in the air
|
|
1120
|
+
* zombie.applyImpulse({ x: 0, y: 0.5, z: 0 });
|
|
1121
|
+
* ```
|
|
940
1122
|
*/
|
|
941
1123
|
clearVelocity(): void;
|
|
942
1124
|
/**
|
|
943
|
-
* @beta
|
|
944
1125
|
* @remarks
|
|
945
1126
|
* Gets a component (that represents additional capabilities)
|
|
946
1127
|
* for an entity.
|
|
@@ -956,7 +1137,6 @@ export class Entity {
|
|
|
956
1137
|
*/
|
|
957
1138
|
getComponent(componentId: string): EntityComponent | undefined;
|
|
958
1139
|
/**
|
|
959
|
-
* @beta
|
|
960
1140
|
* @remarks
|
|
961
1141
|
* Returns all components that are both present on this entity
|
|
962
1142
|
* and supported by the API.
|
|
@@ -967,7 +1147,6 @@ export class Entity {
|
|
|
967
1147
|
*/
|
|
968
1148
|
getComponents(): EntityComponent[];
|
|
969
1149
|
/**
|
|
970
|
-
* @beta
|
|
971
1150
|
* @remarks
|
|
972
1151
|
* Returns the effect for the specified EffectType on the
|
|
973
1152
|
* entity, undefined if the effect is not present, or throws an
|
|
@@ -983,7 +1162,6 @@ export class Entity {
|
|
|
983
1162
|
*/
|
|
984
1163
|
getEffect(effectType: EffectType | string): Effect | undefined;
|
|
985
1164
|
/**
|
|
986
|
-
* @beta
|
|
987
1165
|
* @remarks
|
|
988
1166
|
* Returns a set of effects applied to this entity.
|
|
989
1167
|
*
|
|
@@ -993,7 +1171,6 @@ export class Entity {
|
|
|
993
1171
|
*/
|
|
994
1172
|
getEffects(): Effect[];
|
|
995
1173
|
/**
|
|
996
|
-
* @beta
|
|
997
1174
|
* @remarks
|
|
998
1175
|
* Returns the current location of the head component of this
|
|
999
1176
|
* entity.
|
|
@@ -1005,7 +1182,6 @@ export class Entity {
|
|
|
1005
1182
|
*/
|
|
1006
1183
|
getHeadLocation(): Vector3;
|
|
1007
1184
|
/**
|
|
1008
|
-
* @beta
|
|
1009
1185
|
* @remarks
|
|
1010
1186
|
* Returns all tags associated with an entity.
|
|
1011
1187
|
*
|
|
@@ -1015,17 +1191,25 @@ export class Entity {
|
|
|
1015
1191
|
*/
|
|
1016
1192
|
getTags(): string[];
|
|
1017
1193
|
/**
|
|
1018
|
-
* @beta
|
|
1019
1194
|
* @remarks
|
|
1020
1195
|
* Returns the current velocity vector of the entity.
|
|
1021
1196
|
*
|
|
1022
1197
|
* @returns
|
|
1023
1198
|
* Returns the current velocity vector of the entity.
|
|
1024
1199
|
* @throws This function can throw errors.
|
|
1200
|
+
* @example getFireworkVelocity.ts
|
|
1201
|
+
* ```typescript
|
|
1202
|
+
* const fireworkRocket = overworld.spawnEntity("minecraft:fireworks_rocket", targetLocation);
|
|
1203
|
+
*
|
|
1204
|
+
* mc.system.runTimeout(() => {
|
|
1205
|
+
* let velocity = fireworkRocket.getVelocity();
|
|
1206
|
+
*
|
|
1207
|
+
* log("Velocity of firework is: (x: " + velocity.x + ", y:" + velocity.y + ", z:" + velocity.z + ")");
|
|
1208
|
+
* }, 5);
|
|
1209
|
+
* ```
|
|
1025
1210
|
*/
|
|
1026
1211
|
getVelocity(): Vector3;
|
|
1027
1212
|
/**
|
|
1028
|
-
* @beta
|
|
1029
1213
|
* @remarks
|
|
1030
1214
|
* Returns the current view direction of the entity.
|
|
1031
1215
|
*
|
|
@@ -1035,7 +1219,6 @@ export class Entity {
|
|
|
1035
1219
|
*/
|
|
1036
1220
|
getViewDirection(): Vector3;
|
|
1037
1221
|
/**
|
|
1038
|
-
* @beta
|
|
1039
1222
|
* @remarks
|
|
1040
1223
|
* Returns true if the specified component is present on this
|
|
1041
1224
|
* entity.
|
|
@@ -1050,7 +1233,6 @@ export class Entity {
|
|
|
1050
1233
|
*/
|
|
1051
1234
|
hasComponent(componentId: string): boolean;
|
|
1052
1235
|
/**
|
|
1053
|
-
* @beta
|
|
1054
1236
|
* @remarks
|
|
1055
1237
|
* Returns whether an entity has a particular tag.
|
|
1056
1238
|
*
|
|
@@ -1062,7 +1244,6 @@ export class Entity {
|
|
|
1062
1244
|
*/
|
|
1063
1245
|
hasTag(tag: string): boolean;
|
|
1064
1246
|
/**
|
|
1065
|
-
* @beta
|
|
1066
1247
|
* @remarks
|
|
1067
1248
|
* Kills this entity. The entity will drop loot as normal.
|
|
1068
1249
|
*
|
|
@@ -1072,10 +1253,28 @@ export class Entity {
|
|
|
1072
1253
|
* Returns true if entity can be killed (even if it is already
|
|
1073
1254
|
* dead), otherwise it returns false.
|
|
1074
1255
|
* @throws This function can throw errors.
|
|
1256
|
+
* @example tagsQuery.ts
|
|
1257
|
+
* ```typescript
|
|
1258
|
+
* let mobs = ["creeper", "skeleton", "sheep"];
|
|
1259
|
+
*
|
|
1260
|
+
* // create some sample mob data
|
|
1261
|
+
* for (let i = 0; i < 10; i++) {
|
|
1262
|
+
* let mobTypeId = mobs[i % mobs.length];
|
|
1263
|
+
* let entity = overworld.spawnEntity(mobTypeId, targetLocation);
|
|
1264
|
+
* entity.addTag("mobparty." + mobTypeId);
|
|
1265
|
+
* }
|
|
1266
|
+
*
|
|
1267
|
+
* let eqo: mc.EntityQueryOptions = {
|
|
1268
|
+
* tags: ["mobparty.skeleton"],
|
|
1269
|
+
* };
|
|
1270
|
+
*
|
|
1271
|
+
* for (let entity of overworld.getEntities(eqo)) {
|
|
1272
|
+
* entity.kill();
|
|
1273
|
+
* }
|
|
1274
|
+
* ```
|
|
1075
1275
|
*/
|
|
1076
1276
|
kill(): boolean;
|
|
1077
1277
|
/**
|
|
1078
|
-
* @beta
|
|
1079
1278
|
* @remarks
|
|
1080
1279
|
* Removes the specified EffectType on the entity, or returns
|
|
1081
1280
|
* false if the effect is not present.
|
|
@@ -1085,14 +1284,12 @@ export class Entity {
|
|
|
1085
1284
|
* @param effectType
|
|
1086
1285
|
* The effect identifier.
|
|
1087
1286
|
* @returns
|
|
1088
|
-
* Returns true if the effect has been removed
|
|
1089
|
-
* effect is not
|
|
1090
|
-
* does not exist.
|
|
1287
|
+
* Returns true if the effect has been removed. Returns false
|
|
1288
|
+
* if the effect is not found or does not exist.
|
|
1091
1289
|
* @throws This function can throw errors.
|
|
1092
1290
|
*/
|
|
1093
1291
|
removeEffect(effectType: EffectType | string): boolean;
|
|
1094
1292
|
/**
|
|
1095
|
-
* @beta
|
|
1096
1293
|
* @remarks
|
|
1097
1294
|
* Removes a specified tag from an entity.
|
|
1098
1295
|
*
|
|
@@ -1106,7 +1303,6 @@ export class Entity {
|
|
|
1106
1303
|
*/
|
|
1107
1304
|
removeTag(tag: string): boolean;
|
|
1108
1305
|
/**
|
|
1109
|
-
* @beta
|
|
1110
1306
|
* @remarks
|
|
1111
1307
|
* Runs a synchronous command on the entity.
|
|
1112
1308
|
*
|
|
@@ -1137,7 +1333,6 @@ export class Entity {
|
|
|
1137
1333
|
*/
|
|
1138
1334
|
runCommandAsync(commandString: string): Promise<CommandResult>;
|
|
1139
1335
|
/**
|
|
1140
|
-
* @beta
|
|
1141
1336
|
* @remarks
|
|
1142
1337
|
* Teleports the selected entity to a new location
|
|
1143
1338
|
*
|
|
@@ -1148,10 +1343,28 @@ export class Entity {
|
|
|
1148
1343
|
* @param teleportOptions
|
|
1149
1344
|
* Options regarding the teleport operation.
|
|
1150
1345
|
* @throws This function can throw errors.
|
|
1346
|
+
* @example teleportMovement.ts
|
|
1347
|
+
* ```typescript
|
|
1348
|
+
* const pig = overworld.spawnEntity("minecraft:pig", targetLocation);
|
|
1349
|
+
*
|
|
1350
|
+
* let inc = 1;
|
|
1351
|
+
* let runId = mc.system.runInterval(() => {
|
|
1352
|
+
* pig.teleport(
|
|
1353
|
+
* { x: targetLocation.x + inc / 4, y: targetLocation.y + inc / 4, z: targetLocation.z + inc / 4 },
|
|
1354
|
+
* {
|
|
1355
|
+
* facingLocation: targetLocation,
|
|
1356
|
+
* }
|
|
1357
|
+
* );
|
|
1358
|
+
*
|
|
1359
|
+
* if (inc > 100) {
|
|
1360
|
+
* mc.system.clearRun(runId);
|
|
1361
|
+
* }
|
|
1362
|
+
* inc++;
|
|
1363
|
+
* }, 4);
|
|
1364
|
+
* ```
|
|
1151
1365
|
*/
|
|
1152
1366
|
teleport(location: Vector3, teleportOptions?: TeleportOptions): void;
|
|
1153
1367
|
/**
|
|
1154
|
-
* @beta
|
|
1155
1368
|
* @remarks
|
|
1156
1369
|
* Attempts to try a teleport, but may not complete the
|
|
1157
1370
|
* teleport operation (for example, if there are blocks at the
|
|
@@ -1173,17 +1386,48 @@ export class Entity {
|
|
|
1173
1386
|
}
|
|
1174
1387
|
|
|
1175
1388
|
/**
|
|
1176
|
-
*
|
|
1389
|
+
* This is a base abstract class for any entity component that
|
|
1390
|
+
* centers around a number and can have a minimum, maximum, and
|
|
1391
|
+
* default defined value.
|
|
1177
1392
|
*/
|
|
1178
1393
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1179
1394
|
export class EntityAttributeComponent extends EntityComponent {
|
|
1180
1395
|
private constructor();
|
|
1396
|
+
/**
|
|
1397
|
+
* @remarks
|
|
1398
|
+
* Current value of this attribute for this instance.
|
|
1399
|
+
*
|
|
1400
|
+
* @throws This property can throw when used.
|
|
1401
|
+
*/
|
|
1181
1402
|
readonly currentValue: number;
|
|
1403
|
+
/**
|
|
1404
|
+
* @remarks
|
|
1405
|
+
* Returns the default defined value for this attribute.
|
|
1406
|
+
*
|
|
1407
|
+
* @throws This property can throw when used.
|
|
1408
|
+
*/
|
|
1182
1409
|
readonly defaultValue: number;
|
|
1410
|
+
/**
|
|
1411
|
+
* @remarks
|
|
1412
|
+
* Returns the effective max of this attribute given any other
|
|
1413
|
+
* ambient components or factors.
|
|
1414
|
+
*
|
|
1415
|
+
* @throws This property can throw when used.
|
|
1416
|
+
*/
|
|
1183
1417
|
readonly effectiveMax: number;
|
|
1418
|
+
/**
|
|
1419
|
+
* @remarks
|
|
1420
|
+
* Returns the effective min of this attribute given any other
|
|
1421
|
+
* ambient components or factors.
|
|
1422
|
+
*
|
|
1423
|
+
* @throws This property can throw when used.
|
|
1424
|
+
*/
|
|
1184
1425
|
readonly effectiveMin: number;
|
|
1185
1426
|
/**
|
|
1186
1427
|
* @remarks
|
|
1428
|
+
* Resets the current value of this attribute to the defined
|
|
1429
|
+
* default value.
|
|
1430
|
+
*
|
|
1187
1431
|
* This function can't be called in read-only mode.
|
|
1188
1432
|
*
|
|
1189
1433
|
* @throws This function can throw errors.
|
|
@@ -1191,6 +1435,9 @@ export class EntityAttributeComponent extends EntityComponent {
|
|
|
1191
1435
|
resetToDefaultValue(): void;
|
|
1192
1436
|
/**
|
|
1193
1437
|
* @remarks
|
|
1438
|
+
* Resets the current value of this attribute to the maximum
|
|
1439
|
+
* defined value.
|
|
1440
|
+
*
|
|
1194
1441
|
* This function can't be called in read-only mode.
|
|
1195
1442
|
*
|
|
1196
1443
|
* @throws This function can throw errors.
|
|
@@ -1198,6 +1445,9 @@ export class EntityAttributeComponent extends EntityComponent {
|
|
|
1198
1445
|
resetToMaxValue(): void;
|
|
1199
1446
|
/**
|
|
1200
1447
|
* @remarks
|
|
1448
|
+
* Resets the current value of this attribute to the minimum
|
|
1449
|
+
* defined value.
|
|
1450
|
+
*
|
|
1201
1451
|
* This function can't be called in read-only mode.
|
|
1202
1452
|
*
|
|
1203
1453
|
* @throws This function can throw errors.
|
|
@@ -1205,6 +1455,8 @@ export class EntityAttributeComponent extends EntityComponent {
|
|
|
1205
1455
|
resetToMinValue(): void;
|
|
1206
1456
|
/**
|
|
1207
1457
|
* @remarks
|
|
1458
|
+
* Sets the current value of this attribute.
|
|
1459
|
+
*
|
|
1208
1460
|
* This function can't be called in read-only mode.
|
|
1209
1461
|
*
|
|
1210
1462
|
* @throws This function can throw errors.
|
|
@@ -1213,7 +1465,6 @@ export class EntityAttributeComponent extends EntityComponent {
|
|
|
1213
1465
|
}
|
|
1214
1466
|
|
|
1215
1467
|
/**
|
|
1216
|
-
* @beta
|
|
1217
1468
|
* Base class for a family of entity movement events.
|
|
1218
1469
|
*/
|
|
1219
1470
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1223,24 +1474,16 @@ export class EntityBaseMovementComponent extends EntityComponent {
|
|
|
1223
1474
|
}
|
|
1224
1475
|
|
|
1225
1476
|
/**
|
|
1226
|
-
* @beta
|
|
1227
1477
|
* When added, this component signifies that the entity can
|
|
1228
1478
|
* climb up ladders.
|
|
1229
1479
|
*/
|
|
1230
1480
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1231
1481
|
export class EntityCanClimbComponent extends EntityComponent {
|
|
1232
1482
|
private constructor();
|
|
1233
|
-
/**
|
|
1234
|
-
* @remarks
|
|
1235
|
-
* Identifier of this component. Should always be
|
|
1236
|
-
* minecraft:can_climb.
|
|
1237
|
-
*
|
|
1238
|
-
*/
|
|
1239
1483
|
static readonly componentId = 'minecraft:can_climb';
|
|
1240
1484
|
}
|
|
1241
1485
|
|
|
1242
1486
|
/**
|
|
1243
|
-
* @beta
|
|
1244
1487
|
* When added, this component signifies that the entity can
|
|
1245
1488
|
* fly, and the pathfinder won't be restricted to paths where a
|
|
1246
1489
|
* solid block is required underneath it.
|
|
@@ -1248,57 +1491,39 @@ export class EntityCanClimbComponent extends EntityComponent {
|
|
|
1248
1491
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1249
1492
|
export class EntityCanFlyComponent extends EntityComponent {
|
|
1250
1493
|
private constructor();
|
|
1251
|
-
/**
|
|
1252
|
-
* @remarks
|
|
1253
|
-
* Identifier of this component. Should always be
|
|
1254
|
-
* minecraft:can_fly.
|
|
1255
|
-
*
|
|
1256
|
-
*/
|
|
1257
1494
|
static readonly componentId = 'minecraft:can_fly';
|
|
1258
1495
|
}
|
|
1259
1496
|
|
|
1260
1497
|
/**
|
|
1261
|
-
* @beta
|
|
1262
1498
|
* When added, this component signifies that the entity can
|
|
1263
1499
|
* power jump like the horse does within Minecraft.
|
|
1264
1500
|
*/
|
|
1265
1501
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1266
1502
|
export class EntityCanPowerJumpComponent extends EntityComponent {
|
|
1267
1503
|
private constructor();
|
|
1268
|
-
/**
|
|
1269
|
-
* @remarks
|
|
1270
|
-
* Identifier of this component. Should always be
|
|
1271
|
-
* minecraft:can_power_jump.
|
|
1272
|
-
*
|
|
1273
|
-
*/
|
|
1274
1504
|
static readonly componentId = 'minecraft:can_power_jump';
|
|
1275
1505
|
}
|
|
1276
1506
|
|
|
1277
1507
|
/**
|
|
1278
|
-
* @beta
|
|
1279
1508
|
* Defines the entity's color. Only works on certain entities
|
|
1280
|
-
* that have predefined color values (sheep, llama,
|
|
1509
|
+
* that have predefined color values (e.g., sheep, llama,
|
|
1510
|
+
* shulker).
|
|
1281
1511
|
*/
|
|
1282
1512
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1283
1513
|
export class EntityColorComponent extends EntityComponent {
|
|
1284
1514
|
private constructor();
|
|
1285
1515
|
/**
|
|
1286
1516
|
* @remarks
|
|
1517
|
+
* Value of this particular color.
|
|
1518
|
+
*
|
|
1287
1519
|
* This property can't be edited in read-only mode.
|
|
1288
1520
|
*
|
|
1289
1521
|
*/
|
|
1290
1522
|
value: number;
|
|
1291
|
-
/**
|
|
1292
|
-
* @remarks
|
|
1293
|
-
* Identifier of this component. Should always be
|
|
1294
|
-
* minecraft:color.
|
|
1295
|
-
*
|
|
1296
|
-
*/
|
|
1297
1523
|
static readonly componentId = 'minecraft:color';
|
|
1298
1524
|
}
|
|
1299
1525
|
|
|
1300
1526
|
/**
|
|
1301
|
-
* @beta
|
|
1302
1527
|
* Base class for downstream entity components.
|
|
1303
1528
|
*/
|
|
1304
1529
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1307,41 +1532,26 @@ export class EntityComponent extends Component {
|
|
|
1307
1532
|
}
|
|
1308
1533
|
|
|
1309
1534
|
/**
|
|
1310
|
-
* @beta
|
|
1311
1535
|
* When added, this component signifies that this entity
|
|
1312
1536
|
* doesn't take damage from fire.
|
|
1313
1537
|
*/
|
|
1314
1538
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1315
1539
|
export class EntityFireImmuneComponent extends EntityComponent {
|
|
1316
1540
|
private constructor();
|
|
1317
|
-
/**
|
|
1318
|
-
* @remarks
|
|
1319
|
-
* Identifier of this component. Should always be
|
|
1320
|
-
* minecraft:fire_immune.
|
|
1321
|
-
*
|
|
1322
|
-
*/
|
|
1323
1541
|
static readonly componentId = 'minecraft:fire_immune';
|
|
1324
1542
|
}
|
|
1325
1543
|
|
|
1326
1544
|
/**
|
|
1327
|
-
* @beta
|
|
1328
1545
|
* When added, this component signifies that this entity can
|
|
1329
1546
|
* float in liquid blocks.
|
|
1330
1547
|
*/
|
|
1331
1548
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1332
1549
|
export class EntityFloatsInLiquidComponent extends EntityComponent {
|
|
1333
1550
|
private constructor();
|
|
1334
|
-
/**
|
|
1335
|
-
* @remarks
|
|
1336
|
-
* Identifier of this component. Should always be
|
|
1337
|
-
* minecraft:floats_in_liquid.
|
|
1338
|
-
*
|
|
1339
|
-
*/
|
|
1340
1551
|
static readonly componentId = 'minecraft:floats_in_liquid';
|
|
1341
1552
|
}
|
|
1342
1553
|
|
|
1343
1554
|
/**
|
|
1344
|
-
* @beta
|
|
1345
1555
|
* Represents the flying speed of an entity.
|
|
1346
1556
|
*/
|
|
1347
1557
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1353,17 +1563,10 @@ export class EntityFlyingSpeedComponent extends EntityComponent {
|
|
|
1353
1563
|
*
|
|
1354
1564
|
*/
|
|
1355
1565
|
value: number;
|
|
1356
|
-
/**
|
|
1357
|
-
* @remarks
|
|
1358
|
-
* Identifier of this component. Should always be
|
|
1359
|
-
* minecraft:flying_speed.
|
|
1360
|
-
*
|
|
1361
|
-
*/
|
|
1362
1566
|
static readonly componentId = 'minecraft:flying_speed';
|
|
1363
1567
|
}
|
|
1364
1568
|
|
|
1365
1569
|
/**
|
|
1366
|
-
* @beta
|
|
1367
1570
|
* Defines how much friction affects this entity.
|
|
1368
1571
|
*/
|
|
1369
1572
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1375,17 +1578,10 @@ export class EntityFrictionModifierComponent extends EntityComponent {
|
|
|
1375
1578
|
*
|
|
1376
1579
|
*/
|
|
1377
1580
|
value: number;
|
|
1378
|
-
/**
|
|
1379
|
-
* @remarks
|
|
1380
|
-
* Identifier of this component. Should always be
|
|
1381
|
-
* minecraft:friction_modifier.
|
|
1382
|
-
*
|
|
1383
|
-
*/
|
|
1384
1581
|
static readonly componentId = 'minecraft:friction_modifier';
|
|
1385
1582
|
}
|
|
1386
1583
|
|
|
1387
1584
|
/**
|
|
1388
|
-
* @beta
|
|
1389
1585
|
* Sets the offset from the ground that the entity is actually
|
|
1390
1586
|
* at.
|
|
1391
1587
|
*/
|
|
@@ -1394,21 +1590,16 @@ export class EntityGroundOffsetComponent extends EntityComponent {
|
|
|
1394
1590
|
private constructor();
|
|
1395
1591
|
/**
|
|
1396
1592
|
* @remarks
|
|
1593
|
+
* Value of this particular ground offset.
|
|
1594
|
+
*
|
|
1397
1595
|
* This property can't be edited in read-only mode.
|
|
1398
1596
|
*
|
|
1399
1597
|
*/
|
|
1400
1598
|
value: number;
|
|
1401
|
-
/**
|
|
1402
|
-
* @remarks
|
|
1403
|
-
* Identifier of this component. Should always be
|
|
1404
|
-
* minecraft:ground_offset.
|
|
1405
|
-
*
|
|
1406
|
-
*/
|
|
1407
1599
|
static readonly componentId = 'minecraft:ground_offset';
|
|
1408
1600
|
}
|
|
1409
1601
|
|
|
1410
1602
|
/**
|
|
1411
|
-
* @beta
|
|
1412
1603
|
* Defines the interactions with this entity for healing it.
|
|
1413
1604
|
*/
|
|
1414
1605
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1422,12 +1613,6 @@ export class EntityHealableComponent extends EntityComponent {
|
|
|
1422
1613
|
* @throws This property can throw when used.
|
|
1423
1614
|
*/
|
|
1424
1615
|
readonly forceUse: boolean;
|
|
1425
|
-
/**
|
|
1426
|
-
* @remarks
|
|
1427
|
-
* Identifier of this component. Should always be
|
|
1428
|
-
* minecraft:healable.
|
|
1429
|
-
*
|
|
1430
|
-
*/
|
|
1431
1616
|
static readonly componentId = 'minecraft:healable';
|
|
1432
1617
|
/**
|
|
1433
1618
|
* @remarks
|
|
@@ -1441,23 +1626,15 @@ export class EntityHealableComponent extends EntityComponent {
|
|
|
1441
1626
|
}
|
|
1442
1627
|
|
|
1443
1628
|
/**
|
|
1444
|
-
* @beta
|
|
1445
1629
|
* Defines the health properties of an entity.
|
|
1446
1630
|
*/
|
|
1447
1631
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1448
1632
|
export class EntityHealthComponent extends EntityAttributeComponent {
|
|
1449
1633
|
private constructor();
|
|
1450
|
-
/**
|
|
1451
|
-
* @remarks
|
|
1452
|
-
* Identifier of this component. Should always be
|
|
1453
|
-
* minecraft:health.
|
|
1454
|
-
*
|
|
1455
|
-
*/
|
|
1456
1634
|
static readonly componentId = 'minecraft:health';
|
|
1457
1635
|
}
|
|
1458
1636
|
|
|
1459
1637
|
/**
|
|
1460
|
-
* @beta
|
|
1461
1638
|
* Defines this entity's inventory properties.
|
|
1462
1639
|
*/
|
|
1463
1640
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1515,238 +1692,140 @@ export class EntityInventoryComponent extends EntityComponent {
|
|
|
1515
1692
|
* @throws This property can throw when used.
|
|
1516
1693
|
*/
|
|
1517
1694
|
readonly restrictToOwner: boolean;
|
|
1518
|
-
/**
|
|
1519
|
-
* @remarks
|
|
1520
|
-
* Identifier of this component. Should always be
|
|
1521
|
-
* minecraft:inventory.
|
|
1522
|
-
*
|
|
1523
|
-
*/
|
|
1524
1695
|
static readonly componentId = 'minecraft:inventory';
|
|
1525
1696
|
}
|
|
1526
1697
|
|
|
1527
1698
|
/**
|
|
1528
|
-
* @beta
|
|
1529
1699
|
* When added, this component signifies that this entity is a
|
|
1530
1700
|
* baby.
|
|
1531
1701
|
*/
|
|
1532
1702
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1533
1703
|
export class EntityIsBabyComponent extends EntityComponent {
|
|
1534
1704
|
private constructor();
|
|
1535
|
-
/**
|
|
1536
|
-
* @remarks
|
|
1537
|
-
* Identifier of this component. Should always be
|
|
1538
|
-
* minecraft:is_baby.
|
|
1539
|
-
*
|
|
1540
|
-
*/
|
|
1541
1705
|
static readonly componentId = 'minecraft:is_baby';
|
|
1542
1706
|
}
|
|
1543
1707
|
|
|
1544
1708
|
/**
|
|
1545
|
-
* @beta
|
|
1546
1709
|
* When added, this component signifies that this entity is
|
|
1547
1710
|
* charged.
|
|
1548
1711
|
*/
|
|
1549
1712
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1550
1713
|
export class EntityIsChargedComponent extends EntityComponent {
|
|
1551
1714
|
private constructor();
|
|
1552
|
-
/**
|
|
1553
|
-
* @remarks
|
|
1554
|
-
* Identifier of this component. Should always be
|
|
1555
|
-
* minecraft:is_charged.
|
|
1556
|
-
*
|
|
1557
|
-
*/
|
|
1558
1715
|
static readonly componentId = 'minecraft:is_charged';
|
|
1559
1716
|
}
|
|
1560
1717
|
|
|
1561
1718
|
/**
|
|
1562
|
-
* @beta
|
|
1563
1719
|
* When added, this component signifies that this entity is
|
|
1564
1720
|
* currently carrying a chest.
|
|
1565
1721
|
*/
|
|
1566
1722
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1567
1723
|
export class EntityIsChestedComponent extends EntityComponent {
|
|
1568
1724
|
private constructor();
|
|
1569
|
-
/**
|
|
1570
|
-
* @remarks
|
|
1571
|
-
* Identifier of this component. Should always be
|
|
1572
|
-
* minecraft:is_chested.
|
|
1573
|
-
*
|
|
1574
|
-
*/
|
|
1575
1725
|
static readonly componentId = 'minecraft:is_chested';
|
|
1576
1726
|
}
|
|
1577
1727
|
|
|
1578
1728
|
/**
|
|
1579
|
-
* @beta
|
|
1580
1729
|
* When added, this component signifies that dyes can be used
|
|
1581
1730
|
* on this entity to change its color.
|
|
1582
1731
|
*/
|
|
1583
1732
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1584
1733
|
export class EntityIsDyeableComponent extends EntityComponent {
|
|
1585
1734
|
private constructor();
|
|
1586
|
-
/**
|
|
1587
|
-
* @remarks
|
|
1588
|
-
* Identifier of this component. Should always be
|
|
1589
|
-
* minecraft:is_dyeable.
|
|
1590
|
-
*
|
|
1591
|
-
*/
|
|
1592
1735
|
static readonly componentId = 'minecraft:is_dyeable';
|
|
1593
1736
|
}
|
|
1594
1737
|
|
|
1595
1738
|
/**
|
|
1596
|
-
* @beta
|
|
1597
1739
|
* When added, this component signifies that this entity can
|
|
1598
1740
|
* hide from hostile mobs while invisible.
|
|
1599
1741
|
*/
|
|
1600
1742
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1601
1743
|
export class EntityIsHiddenWhenInvisibleComponent extends EntityComponent {
|
|
1602
1744
|
private constructor();
|
|
1603
|
-
/**
|
|
1604
|
-
* @remarks
|
|
1605
|
-
* Identifier of this component. Should always be
|
|
1606
|
-
* minecraft:is_hidden_when_invisible.
|
|
1607
|
-
*
|
|
1608
|
-
*/
|
|
1609
1745
|
static readonly componentId = 'minecraft:is_hidden_when_invisible';
|
|
1610
1746
|
}
|
|
1611
1747
|
|
|
1612
1748
|
/**
|
|
1613
|
-
* @beta
|
|
1614
1749
|
* When added, this component signifies that this entity this
|
|
1615
1750
|
* currently on fire.
|
|
1616
1751
|
*/
|
|
1617
1752
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1618
1753
|
export class EntityIsIgnitedComponent extends EntityComponent {
|
|
1619
1754
|
private constructor();
|
|
1620
|
-
/**
|
|
1621
|
-
* @remarks
|
|
1622
|
-
* Identifier of this component. Should always be
|
|
1623
|
-
* minecraft:is_ignited.
|
|
1624
|
-
*
|
|
1625
|
-
*/
|
|
1626
1755
|
static readonly componentId = 'minecraft:is_ignited';
|
|
1627
1756
|
}
|
|
1628
1757
|
|
|
1629
1758
|
/**
|
|
1630
|
-
* @beta
|
|
1631
1759
|
* When added, this component signifies that this entity is an
|
|
1632
1760
|
* illager captain.
|
|
1633
1761
|
*/
|
|
1634
1762
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1635
1763
|
export class EntityIsIllagerCaptainComponent extends EntityComponent {
|
|
1636
1764
|
private constructor();
|
|
1637
|
-
/**
|
|
1638
|
-
* @remarks
|
|
1639
|
-
* Identifier of this component. Should always be
|
|
1640
|
-
* minecraft:is_illager_captain.
|
|
1641
|
-
*
|
|
1642
|
-
*/
|
|
1643
1765
|
static readonly componentId = 'minecraft:is_illager_captain';
|
|
1644
1766
|
}
|
|
1645
1767
|
|
|
1646
1768
|
/**
|
|
1647
|
-
* @beta
|
|
1648
1769
|
* When added, this component signifies that this entity is
|
|
1649
1770
|
* currently saddled.
|
|
1650
1771
|
*/
|
|
1651
1772
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1652
1773
|
export class EntityIsSaddledComponent extends EntityComponent {
|
|
1653
1774
|
private constructor();
|
|
1654
|
-
/**
|
|
1655
|
-
* @remarks
|
|
1656
|
-
* Identifier of this component. Should always be
|
|
1657
|
-
* minecraft:is_saddled.
|
|
1658
|
-
*
|
|
1659
|
-
*/
|
|
1660
1775
|
static readonly componentId = 'minecraft:is_saddled';
|
|
1661
1776
|
}
|
|
1662
1777
|
|
|
1663
1778
|
/**
|
|
1664
|
-
* @beta
|
|
1665
1779
|
* When added, this component signifies that this entity is
|
|
1666
1780
|
* currently shaking.
|
|
1667
1781
|
*/
|
|
1668
1782
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1669
1783
|
export class EntityIsShakingComponent extends EntityComponent {
|
|
1670
1784
|
private constructor();
|
|
1671
|
-
/**
|
|
1672
|
-
* @remarks
|
|
1673
|
-
* Identifier of this component. Should always be
|
|
1674
|
-
* minecraft:is_shaking.
|
|
1675
|
-
*
|
|
1676
|
-
*/
|
|
1677
1785
|
static readonly componentId = 'minecraft:is_shaking';
|
|
1678
1786
|
}
|
|
1679
1787
|
|
|
1680
1788
|
/**
|
|
1681
|
-
* @beta
|
|
1682
1789
|
* When added, this component signifies that this entity is
|
|
1683
1790
|
* currently sheared.
|
|
1684
1791
|
*/
|
|
1685
1792
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1686
1793
|
export class EntityIsShearedComponent extends EntityComponent {
|
|
1687
1794
|
private constructor();
|
|
1688
|
-
/**
|
|
1689
|
-
* @remarks
|
|
1690
|
-
* Identifier of this component. Should always be
|
|
1691
|
-
* minecraft:is_sheared.
|
|
1692
|
-
*
|
|
1693
|
-
*/
|
|
1694
1795
|
static readonly componentId = 'minecraft:is_sheared';
|
|
1695
1796
|
}
|
|
1696
1797
|
|
|
1697
1798
|
/**
|
|
1698
|
-
* @beta
|
|
1699
1799
|
* When added, this component signifies that this entity can be
|
|
1700
1800
|
* stacked.
|
|
1701
1801
|
*/
|
|
1702
1802
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1703
1803
|
export class EntityIsStackableComponent extends EntityComponent {
|
|
1704
1804
|
private constructor();
|
|
1705
|
-
/**
|
|
1706
|
-
* @remarks
|
|
1707
|
-
* Identifier of this component. Should always be
|
|
1708
|
-
* minecraft:is_stackable.
|
|
1709
|
-
*
|
|
1710
|
-
*/
|
|
1711
1805
|
static readonly componentId = 'minecraft:is_stackable';
|
|
1712
1806
|
}
|
|
1713
1807
|
|
|
1714
1808
|
/**
|
|
1715
|
-
* @beta
|
|
1716
1809
|
* When added, this component signifies that this entity is
|
|
1717
1810
|
* currently stunned.
|
|
1718
1811
|
*/
|
|
1719
1812
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1720
1813
|
export class EntityIsStunnedComponent extends EntityComponent {
|
|
1721
1814
|
private constructor();
|
|
1722
|
-
/**
|
|
1723
|
-
* @remarks
|
|
1724
|
-
* Identifier of this component. Should always be
|
|
1725
|
-
* minecraft:is_stunned.
|
|
1726
|
-
*
|
|
1727
|
-
*/
|
|
1728
1815
|
static readonly componentId = 'minecraft:is_stunned';
|
|
1729
1816
|
}
|
|
1730
1817
|
|
|
1731
1818
|
/**
|
|
1732
|
-
* @beta
|
|
1733
1819
|
* When added, this component signifies that this entity is
|
|
1734
1820
|
* currently tamed.
|
|
1735
1821
|
*/
|
|
1736
1822
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1737
1823
|
export class EntityIsTamedComponent extends EntityComponent {
|
|
1738
1824
|
private constructor();
|
|
1739
|
-
/**
|
|
1740
|
-
* @remarks
|
|
1741
|
-
* Identifier of this component. Should always be
|
|
1742
|
-
* minecraft:is_tamed.
|
|
1743
|
-
*
|
|
1744
|
-
*/
|
|
1745
1825
|
static readonly componentId = 'minecraft:is_tamed';
|
|
1746
1826
|
}
|
|
1747
1827
|
|
|
1748
1828
|
/**
|
|
1749
|
-
* @beta
|
|
1750
1829
|
* If added onto the entity, this indicates that the entity
|
|
1751
1830
|
* represents a free-floating item in the world. Lets you
|
|
1752
1831
|
* retrieve the actual item stack contents via the itemStack
|
|
@@ -1762,16 +1841,10 @@ export class EntityItemComponent extends EntityComponent {
|
|
|
1762
1841
|
* @throws This property can throw when used.
|
|
1763
1842
|
*/
|
|
1764
1843
|
readonly itemStack: ItemStack;
|
|
1765
|
-
/**
|
|
1766
|
-
* @remarks
|
|
1767
|
-
* Identifier of this component.
|
|
1768
|
-
*
|
|
1769
|
-
*/
|
|
1770
1844
|
static readonly componentId = 'minecraft:item';
|
|
1771
1845
|
}
|
|
1772
1846
|
|
|
1773
1847
|
/**
|
|
1774
|
-
* @beta
|
|
1775
1848
|
* Additional variant value. Can be used to further
|
|
1776
1849
|
* differentiate variants.
|
|
1777
1850
|
*/
|
|
@@ -1780,137 +1853,83 @@ export class EntityMarkVariantComponent extends EntityComponent {
|
|
|
1780
1853
|
private constructor();
|
|
1781
1854
|
/**
|
|
1782
1855
|
* @remarks
|
|
1856
|
+
* Value of the mark variant value for this entity.
|
|
1857
|
+
*
|
|
1783
1858
|
* This property can't be edited in read-only mode.
|
|
1784
1859
|
*
|
|
1785
1860
|
*/
|
|
1786
1861
|
value: number;
|
|
1787
|
-
/**
|
|
1788
|
-
* @remarks
|
|
1789
|
-
* Identifier of this component. Should always be
|
|
1790
|
-
* minecraft:mark_variant.
|
|
1791
|
-
*
|
|
1792
|
-
*/
|
|
1793
1862
|
static readonly componentId = 'minecraft:mark_variant';
|
|
1794
1863
|
}
|
|
1795
1864
|
|
|
1796
1865
|
/**
|
|
1797
|
-
* @beta
|
|
1798
1866
|
* When added, this movement control allows the mob to swim in
|
|
1799
1867
|
* water and walk on land.
|
|
1800
1868
|
*/
|
|
1801
1869
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1802
1870
|
export class EntityMovementAmphibiousComponent extends EntityBaseMovementComponent {
|
|
1803
1871
|
private constructor();
|
|
1804
|
-
/**
|
|
1805
|
-
* @remarks
|
|
1806
|
-
* Identifier of this component. Should always be
|
|
1807
|
-
* minecraft:movement.amphibious.
|
|
1808
|
-
*
|
|
1809
|
-
*/
|
|
1810
1872
|
static readonly componentId = 'minecraft:movement.amphibious';
|
|
1811
1873
|
}
|
|
1812
1874
|
|
|
1813
1875
|
/**
|
|
1814
|
-
* @beta
|
|
1815
1876
|
* This component accents the movement of an entity.
|
|
1816
1877
|
*/
|
|
1817
1878
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1818
1879
|
export class EntityMovementBasicComponent extends EntityBaseMovementComponent {
|
|
1819
1880
|
private constructor();
|
|
1820
|
-
/**
|
|
1821
|
-
* @remarks
|
|
1822
|
-
* Identifier of this component. Should always be
|
|
1823
|
-
* minecraft:movement.basic.
|
|
1824
|
-
*
|
|
1825
|
-
*/
|
|
1826
1881
|
static readonly componentId = 'minecraft:movement.basic';
|
|
1827
1882
|
}
|
|
1828
1883
|
|
|
1829
1884
|
/**
|
|
1830
|
-
* @beta
|
|
1831
1885
|
* When added, this move control causes the mob to fly.
|
|
1832
1886
|
*/
|
|
1833
1887
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1834
1888
|
export class EntityMovementFlyComponent extends EntityBaseMovementComponent {
|
|
1835
1889
|
private constructor();
|
|
1836
|
-
/**
|
|
1837
|
-
* @remarks
|
|
1838
|
-
* Identifier of this component. Should always be
|
|
1839
|
-
* minecraft:movement.fly.
|
|
1840
|
-
*
|
|
1841
|
-
*/
|
|
1842
1890
|
static readonly componentId = 'minecraft:movement.fly';
|
|
1843
1891
|
}
|
|
1844
1892
|
|
|
1845
1893
|
/**
|
|
1846
|
-
* @beta
|
|
1847
1894
|
* When added, this move control allows a mob to fly, swim,
|
|
1848
1895
|
* climb, etc.
|
|
1849
1896
|
*/
|
|
1850
1897
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1851
1898
|
export class EntityMovementGenericComponent extends EntityBaseMovementComponent {
|
|
1852
1899
|
private constructor();
|
|
1853
|
-
/**
|
|
1854
|
-
* @remarks
|
|
1855
|
-
* Identifier of this component. Should always be
|
|
1856
|
-
* minecraft:movement.generic.
|
|
1857
|
-
*
|
|
1858
|
-
*/
|
|
1859
1900
|
static readonly componentId = 'minecraft:movement.generic';
|
|
1860
1901
|
}
|
|
1861
1902
|
|
|
1862
1903
|
/**
|
|
1863
|
-
* @beta
|
|
1864
1904
|
* When added, this move control causes the mob to hover.
|
|
1865
1905
|
*/
|
|
1866
1906
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1867
1907
|
export class EntityMovementHoverComponent extends EntityBaseMovementComponent {
|
|
1868
1908
|
private constructor();
|
|
1869
|
-
/**
|
|
1870
|
-
* @remarks
|
|
1871
|
-
* Identifier of this component. Should always be
|
|
1872
|
-
* minecraft:movement.hover.
|
|
1873
|
-
*
|
|
1874
|
-
*/
|
|
1875
1909
|
static readonly componentId = 'minecraft:movement.hover';
|
|
1876
1910
|
}
|
|
1877
1911
|
|
|
1878
1912
|
/**
|
|
1879
|
-
* @beta
|
|
1880
1913
|
* Move control that causes the mob to jump as it moves with a
|
|
1881
1914
|
* specified delay between jumps.
|
|
1882
1915
|
*/
|
|
1883
1916
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1884
1917
|
export class EntityMovementJumpComponent extends EntityBaseMovementComponent {
|
|
1885
1918
|
private constructor();
|
|
1886
|
-
/**
|
|
1887
|
-
* @remarks
|
|
1888
|
-
* Identifier of this component. Should always be
|
|
1889
|
-
* minecraft:movement.jump.
|
|
1890
|
-
*
|
|
1891
|
-
*/
|
|
1892
1919
|
static readonly componentId = 'minecraft:movement.jump';
|
|
1893
1920
|
}
|
|
1894
1921
|
|
|
1895
1922
|
/**
|
|
1896
|
-
* @beta
|
|
1897
1923
|
* When added, this move control causes the mob to hop as it
|
|
1898
1924
|
* moves.
|
|
1899
1925
|
*/
|
|
1900
1926
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1901
1927
|
export class EntityMovementSkipComponent extends EntityBaseMovementComponent {
|
|
1902
1928
|
private constructor();
|
|
1903
|
-
/**
|
|
1904
|
-
* @remarks
|
|
1905
|
-
* Identifier of this component. Should always be
|
|
1906
|
-
* minecraft:movement.skip.
|
|
1907
|
-
*
|
|
1908
|
-
*/
|
|
1909
1929
|
static readonly componentId = 'minecraft:movement.skip';
|
|
1910
1930
|
}
|
|
1911
1931
|
|
|
1912
1932
|
/**
|
|
1913
|
-
* @beta
|
|
1914
1933
|
* Sets the distance through which the entity can push through.
|
|
1915
1934
|
*/
|
|
1916
1935
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1918,21 +1937,16 @@ export class EntityPushThroughComponent extends EntityComponent {
|
|
|
1918
1937
|
private constructor();
|
|
1919
1938
|
/**
|
|
1920
1939
|
* @remarks
|
|
1940
|
+
* Value of the push through distances of this entity.
|
|
1941
|
+
*
|
|
1921
1942
|
* This property can't be edited in read-only mode.
|
|
1922
1943
|
*
|
|
1923
1944
|
*/
|
|
1924
1945
|
value: number;
|
|
1925
|
-
/**
|
|
1926
|
-
* @remarks
|
|
1927
|
-
* Identifier of this component. Should always be
|
|
1928
|
-
* minecraft:push_through.
|
|
1929
|
-
*
|
|
1930
|
-
*/
|
|
1931
1946
|
static readonly componentId = 'minecraft:push_through';
|
|
1932
1947
|
}
|
|
1933
1948
|
|
|
1934
1949
|
/**
|
|
1935
|
-
* @beta
|
|
1936
1950
|
* Sets the entity's visual size.
|
|
1937
1951
|
*/
|
|
1938
1952
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -1940,21 +1954,16 @@ export class EntityScaleComponent extends EntityComponent {
|
|
|
1940
1954
|
private constructor();
|
|
1941
1955
|
/**
|
|
1942
1956
|
* @remarks
|
|
1957
|
+
* Current value for the scale property set on entities.
|
|
1958
|
+
*
|
|
1943
1959
|
* This property can't be edited in read-only mode.
|
|
1944
1960
|
*
|
|
1945
1961
|
*/
|
|
1946
1962
|
value: number;
|
|
1947
|
-
/**
|
|
1948
|
-
* @remarks
|
|
1949
|
-
* Identifier of this component. Should always be
|
|
1950
|
-
* minecraft:scale.
|
|
1951
|
-
*
|
|
1952
|
-
*/
|
|
1953
1963
|
static readonly componentId = 'minecraft:scale';
|
|
1954
1964
|
}
|
|
1955
1965
|
|
|
1956
1966
|
/**
|
|
1957
|
-
* @beta
|
|
1958
1967
|
* Skin Id value. Can be used to differentiate skins, such as
|
|
1959
1968
|
* base skins for villagers.
|
|
1960
1969
|
*/
|
|
@@ -1967,52 +1976,38 @@ export class EntitySkinIdComponent extends EntityComponent {
|
|
|
1967
1976
|
*
|
|
1968
1977
|
*/
|
|
1969
1978
|
value: number;
|
|
1970
|
-
/**
|
|
1971
|
-
* @remarks
|
|
1972
|
-
* Identifier of this component. Should always be
|
|
1973
|
-
* minecraft:skin_id.
|
|
1974
|
-
*
|
|
1975
|
-
*/
|
|
1976
1979
|
static readonly componentId = 'minecraft:skin_id';
|
|
1977
1980
|
}
|
|
1978
1981
|
|
|
1979
1982
|
/**
|
|
1980
|
-
* @beta
|
|
1981
1983
|
* Used to differentiate the component group of a variant of an
|
|
1982
1984
|
* entity from others. (e.g. ocelot, villager).
|
|
1983
1985
|
*/
|
|
1984
1986
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
1985
1987
|
export class EntityVariantComponent extends EntityComponent {
|
|
1986
1988
|
private constructor();
|
|
1987
|
-
readonly value: number;
|
|
1988
1989
|
/**
|
|
1989
1990
|
* @remarks
|
|
1990
|
-
*
|
|
1991
|
-
*
|
|
1991
|
+
* Current value for variant for this entity, as specified via
|
|
1992
|
+
* components.
|
|
1992
1993
|
*
|
|
1994
|
+
* @throws This property can throw when used.
|
|
1993
1995
|
*/
|
|
1996
|
+
readonly value: number;
|
|
1994
1997
|
static readonly componentId = 'minecraft:variant';
|
|
1995
1998
|
}
|
|
1996
1999
|
|
|
1997
2000
|
/**
|
|
1998
|
-
* @beta
|
|
1999
2001
|
* When added, this component signifies that this entity wants
|
|
2000
2002
|
* to become a jockey.
|
|
2001
2003
|
*/
|
|
2002
2004
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
2003
2005
|
export class EntityWantsJockeyComponent extends EntityComponent {
|
|
2004
2006
|
private constructor();
|
|
2005
|
-
/**
|
|
2006
|
-
* @remarks
|
|
2007
|
-
* Identifier of this component. Should always be
|
|
2008
|
-
* minecraft:wants_jockey.
|
|
2009
|
-
*
|
|
2010
|
-
*/
|
|
2011
2007
|
static readonly componentId = 'minecraft:wants_jockey';
|
|
2012
2008
|
}
|
|
2013
2009
|
|
|
2014
2010
|
/**
|
|
2015
|
-
* @beta
|
|
2016
2011
|
* As part of the Healable component, represents a specific
|
|
2017
2012
|
* item that can be fed to an entity to cause health effects.
|
|
2018
2013
|
*/
|
|
@@ -2044,7 +2039,6 @@ export class FeedItem {
|
|
|
2044
2039
|
}
|
|
2045
2040
|
|
|
2046
2041
|
/**
|
|
2047
|
-
* @beta
|
|
2048
2042
|
* Represents an effect that is applied as a result of a food
|
|
2049
2043
|
* item being fed to an entity.
|
|
2050
2044
|
*/
|
|
@@ -2081,7 +2075,6 @@ export class FeedItemEffect {
|
|
|
2081
2075
|
}
|
|
2082
2076
|
|
|
2083
2077
|
/**
|
|
2084
|
-
* @beta
|
|
2085
2078
|
* Provides an adaptable interface for callers to subscribe to
|
|
2086
2079
|
* an event that fires when a button is pushed.
|
|
2087
2080
|
*/
|
|
@@ -2103,7 +2096,6 @@ export class IButtonPushAfterEventSignal {
|
|
|
2103
2096
|
}
|
|
2104
2097
|
|
|
2105
2098
|
/**
|
|
2106
|
-
* @beta
|
|
2107
2099
|
* Provides an adaptable interface for callers to subscribe to
|
|
2108
2100
|
* an event that fires after a lever is used.
|
|
2109
2101
|
*/
|
|
@@ -2125,7 +2117,6 @@ export class ILeverActionAfterEventSignal {
|
|
|
2125
2117
|
}
|
|
2126
2118
|
|
|
2127
2119
|
/**
|
|
2128
|
-
* @beta
|
|
2129
2120
|
* Provides an adaptable interface for callers to subscribe to
|
|
2130
2121
|
* an event that fires after a player joins a world.
|
|
2131
2122
|
*/
|
|
@@ -2147,7 +2138,6 @@ export class IPlayerJoinAfterEventSignal {
|
|
|
2147
2138
|
}
|
|
2148
2139
|
|
|
2149
2140
|
/**
|
|
2150
|
-
* @beta
|
|
2151
2141
|
* Provides an adaptable interface for callers to subscribe to
|
|
2152
2142
|
* an event that fires after a player leaves a world.
|
|
2153
2143
|
*/
|
|
@@ -2169,7 +2159,6 @@ export class IPlayerLeaveAfterEventSignal {
|
|
|
2169
2159
|
}
|
|
2170
2160
|
|
|
2171
2161
|
/**
|
|
2172
|
-
* @beta
|
|
2173
2162
|
* Provides an adaptable interface for callers to subscribe to
|
|
2174
2163
|
* an event that fires after a player spawns.
|
|
2175
2164
|
*/
|
|
@@ -2191,7 +2180,6 @@ export class IPlayerSpawnAfterEventSignal {
|
|
|
2191
2180
|
}
|
|
2192
2181
|
|
|
2193
2182
|
/**
|
|
2194
|
-
* @beta
|
|
2195
2183
|
* Base class for item components.
|
|
2196
2184
|
*/
|
|
2197
2185
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -2200,7 +2188,6 @@ export class ItemComponent extends Component {
|
|
|
2200
2188
|
}
|
|
2201
2189
|
|
|
2202
2190
|
/**
|
|
2203
|
-
* @beta
|
|
2204
2191
|
* Defines a collection of items.
|
|
2205
2192
|
*/
|
|
2206
2193
|
export class ItemStack {
|
|
@@ -2273,9 +2260,9 @@ export class ItemStack {
|
|
|
2273
2260
|
* world.
|
|
2274
2261
|
*
|
|
2275
2262
|
* @param itemType
|
|
2276
|
-
* Type of item to create. See the {@link
|
|
2277
|
-
* enumeration for
|
|
2278
|
-
* experiences.
|
|
2263
|
+
* Type of item to create. See the {@link
|
|
2264
|
+
* @minecraft/vanilla-data.MinecraftItemTypes} enumeration for
|
|
2265
|
+
* a list of standard item types in Minecraft experiences.
|
|
2279
2266
|
* @param amount
|
|
2280
2267
|
* Number of items to place in the stack, between 1-255. The
|
|
2281
2268
|
* provided value will be clamped to the item's maximum stack
|
|
@@ -2336,7 +2323,6 @@ export class ItemStack {
|
|
|
2336
2323
|
}
|
|
2337
2324
|
|
|
2338
2325
|
/**
|
|
2339
|
-
* @beta
|
|
2340
2326
|
* Represents the type of an item - for example, Wool.
|
|
2341
2327
|
*/
|
|
2342
2328
|
export class ItemType {
|
|
@@ -2351,7 +2337,6 @@ export class ItemType {
|
|
|
2351
2337
|
}
|
|
2352
2338
|
|
|
2353
2339
|
/**
|
|
2354
|
-
* @beta
|
|
2355
2340
|
* Contains information related to changes to a lever
|
|
2356
2341
|
* activating or deactivating.
|
|
2357
2342
|
*/
|
|
@@ -2374,7 +2359,6 @@ export class LeverActionAfterEvent extends BlockEvent {
|
|
|
2374
2359
|
}
|
|
2375
2360
|
|
|
2376
2361
|
/**
|
|
2377
|
-
* @beta
|
|
2378
2362
|
* Manages callbacks that are connected to lever moves
|
|
2379
2363
|
* (activates or deactivates).
|
|
2380
2364
|
*/
|
|
@@ -2384,6 +2368,8 @@ export class LeverActionAfterEventSignal extends ILeverActionAfterEventSignal {
|
|
|
2384
2368
|
}
|
|
2385
2369
|
|
|
2386
2370
|
/**
|
|
2371
|
+
* DEPRECATED
|
|
2372
|
+
* Use @minecraft/vanilla-data.MinecraftDimensionTypes
|
|
2387
2373
|
* A collection of default Minecraft dimension types.
|
|
2388
2374
|
*/
|
|
2389
2375
|
export class MinecraftDimensionTypes {
|
|
@@ -2437,7 +2423,6 @@ export class Player extends Entity {
|
|
|
2437
2423
|
*/
|
|
2438
2424
|
readonly name: string;
|
|
2439
2425
|
/**
|
|
2440
|
-
* @beta
|
|
2441
2426
|
* @remarks
|
|
2442
2427
|
* Plays a sound that only this particular player can hear.
|
|
2443
2428
|
*
|
|
@@ -2448,10 +2433,33 @@ export class Player extends Entity {
|
|
|
2448
2433
|
* @param soundOptions
|
|
2449
2434
|
* Additional optional options for the sound.
|
|
2450
2435
|
* @throws This function can throw errors.
|
|
2436
|
+
* @example playMusicAndSound.ts
|
|
2437
|
+
* ```typescript
|
|
2438
|
+
* let players = mc.world.getPlayers();
|
|
2439
|
+
*
|
|
2440
|
+
* const musicOptions: mc.MusicOptions = {
|
|
2441
|
+
* fade: 0.5,
|
|
2442
|
+
* loop: true,
|
|
2443
|
+
* volume: 1.0,
|
|
2444
|
+
* };
|
|
2445
|
+
* mc.world.playMusic("music.menu", musicOptions);
|
|
2446
|
+
*
|
|
2447
|
+
* const worldSoundOptions: mc.WorldSoundOptions = {
|
|
2448
|
+
* pitch: 0.5,
|
|
2449
|
+
* volume: 4.0,
|
|
2450
|
+
* };
|
|
2451
|
+
* mc.world.playSound("ambient.weather.thunder", targetLocation, worldSoundOptions);
|
|
2452
|
+
*
|
|
2453
|
+
* const playerSoundOptions: mc.PlayerSoundOptions = {
|
|
2454
|
+
* pitch: 1.0,
|
|
2455
|
+
* volume: 1.0,
|
|
2456
|
+
* };
|
|
2457
|
+
*
|
|
2458
|
+
* players[0].playSound("bucket.fill_water", playerSoundOptions);
|
|
2459
|
+
* ```
|
|
2451
2460
|
*/
|
|
2452
2461
|
playSound(soundID: string, soundOptions?: PlayerSoundOptions): void;
|
|
2453
2462
|
/**
|
|
2454
|
-
* @beta
|
|
2455
2463
|
* @remarks
|
|
2456
2464
|
* Sends a message to the player.
|
|
2457
2465
|
*
|
|
@@ -2476,6 +2484,18 @@ export class Player extends Entity {
|
|
|
2476
2484
|
* const rawMessage = { score: { name: "*", objective: "obj" } };
|
|
2477
2485
|
* world.sendMessage(rawMessage);
|
|
2478
2486
|
* ```
|
|
2487
|
+
* @example sendBasicMessage.ts
|
|
2488
|
+
* ```typescript
|
|
2489
|
+
* let players = mc.world.getPlayers();
|
|
2490
|
+
*
|
|
2491
|
+
* players[0].sendMessage("Hello World!");
|
|
2492
|
+
* ```
|
|
2493
|
+
* @example sendTranslatedMessage.ts
|
|
2494
|
+
* ```typescript
|
|
2495
|
+
* let players = mc.world.getPlayers();
|
|
2496
|
+
*
|
|
2497
|
+
* players[0].sendMessage({ translate: "authentication.welcome", with: ["Amazing Player 1"] });
|
|
2498
|
+
* ```
|
|
2479
2499
|
* @example simpleString.ts
|
|
2480
2500
|
* ```typescript
|
|
2481
2501
|
* // Displays "Hello, world!"
|
|
@@ -2492,7 +2512,6 @@ export class Player extends Entity {
|
|
|
2492
2512
|
}
|
|
2493
2513
|
|
|
2494
2514
|
/**
|
|
2495
|
-
* @beta
|
|
2496
2515
|
* Contains information regarding a player that has joined.
|
|
2497
2516
|
* See the playerSpawn event for more detailed information that
|
|
2498
2517
|
* could be returned after the first time a player has spawned
|
|
@@ -2515,7 +2534,6 @@ export class PlayerJoinAfterEvent {
|
|
|
2515
2534
|
}
|
|
2516
2535
|
|
|
2517
2536
|
/**
|
|
2518
|
-
* @beta
|
|
2519
2537
|
* Manages callbacks that are connected to a player joining the
|
|
2520
2538
|
* world.
|
|
2521
2539
|
*/
|
|
@@ -2525,7 +2543,6 @@ export class PlayerJoinAfterEventSignal extends IPlayerJoinAfterEventSignal {
|
|
|
2525
2543
|
}
|
|
2526
2544
|
|
|
2527
2545
|
/**
|
|
2528
|
-
* @beta
|
|
2529
2546
|
* Contains information regarding a player that has left the
|
|
2530
2547
|
* world.
|
|
2531
2548
|
*/
|
|
@@ -2547,7 +2564,6 @@ export class PlayerLeaveAfterEvent {
|
|
|
2547
2564
|
}
|
|
2548
2565
|
|
|
2549
2566
|
/**
|
|
2550
|
-
* @beta
|
|
2551
2567
|
* Manages callbacks that are connected to a player leaving the
|
|
2552
2568
|
* world.
|
|
2553
2569
|
*/
|
|
@@ -2557,7 +2573,6 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
|
|
|
2557
2573
|
}
|
|
2558
2574
|
|
|
2559
2575
|
/**
|
|
2560
|
-
* @beta
|
|
2561
2576
|
* An event that contains more information about a player
|
|
2562
2577
|
* spawning.
|
|
2563
2578
|
*/
|
|
@@ -2583,7 +2598,6 @@ export class PlayerSpawnAfterEvent {
|
|
|
2583
2598
|
}
|
|
2584
2599
|
|
|
2585
2600
|
/**
|
|
2586
|
-
* @beta
|
|
2587
2601
|
* Registers an event when a player is spawned (or re-spawned
|
|
2588
2602
|
* after death) and fully ready within the world.
|
|
2589
2603
|
*/
|
|
@@ -2598,14 +2612,12 @@ export class PlayerSpawnAfterEventSignal extends IPlayerSpawnAfterEventSignal {
|
|
|
2598
2612
|
export class System {
|
|
2599
2613
|
private constructor();
|
|
2600
2614
|
/**
|
|
2601
|
-
* @beta
|
|
2602
2615
|
* @remarks
|
|
2603
2616
|
* Represents the current world tick of the server.
|
|
2604
2617
|
*
|
|
2605
2618
|
*/
|
|
2606
2619
|
readonly currentTick: number;
|
|
2607
2620
|
/**
|
|
2608
|
-
* @beta
|
|
2609
2621
|
* @remarks
|
|
2610
2622
|
* Cancels the execution of a function run that was previously
|
|
2611
2623
|
* scheduled via the `run` function.
|
|
@@ -2624,10 +2636,24 @@ export class System {
|
|
|
2624
2636
|
* @returns
|
|
2625
2637
|
* An opaque identifier that can be used with the `clearRun`
|
|
2626
2638
|
* function to cancel the execution of this run.
|
|
2639
|
+
* @example trapTick.ts
|
|
2640
|
+
* ```typescript
|
|
2641
|
+
* const overworld = mc.world.getDimension("overworld");
|
|
2642
|
+
*
|
|
2643
|
+
* try {
|
|
2644
|
+
* // Minecraft runs at 20 ticks per second.
|
|
2645
|
+
* if (mc.system.currentTick % 1200 === 0) {
|
|
2646
|
+
* mc.world.sendMessage("Another minute passes...");
|
|
2647
|
+
* }
|
|
2648
|
+
* } catch (e) {
|
|
2649
|
+
* console.warn("Error: " + e);
|
|
2650
|
+
* }
|
|
2651
|
+
*
|
|
2652
|
+
* mc.system.run(trapTick);
|
|
2653
|
+
* ```
|
|
2627
2654
|
*/
|
|
2628
2655
|
run(callback: () => void): number;
|
|
2629
2656
|
/**
|
|
2630
|
-
* @beta
|
|
2631
2657
|
* @remarks
|
|
2632
2658
|
* Runs a set of code on an interval.
|
|
2633
2659
|
*
|
|
@@ -2639,10 +2665,17 @@ export class System {
|
|
|
2639
2665
|
* @returns
|
|
2640
2666
|
* An opaque handle that can be used with the clearRun method
|
|
2641
2667
|
* to stop the run of this function on an interval.
|
|
2668
|
+
* @example every30Seconds.ts
|
|
2669
|
+
* ```typescript
|
|
2670
|
+
* let intervalRunIdentifier = Math.floor(Math.random() * 10000);
|
|
2671
|
+
*
|
|
2672
|
+
* mc.system.runInterval(() => {
|
|
2673
|
+
* mc.world.sendMessage("This is an interval run " + intervalRunIdentifier + " sending a message every 30 seconds.");
|
|
2674
|
+
* }, 600);
|
|
2675
|
+
* ```
|
|
2642
2676
|
*/
|
|
2643
2677
|
runInterval(callback: () => void, tickInterval?: number): number;
|
|
2644
2678
|
/**
|
|
2645
|
-
* @beta
|
|
2646
2679
|
* @remarks
|
|
2647
2680
|
* Runs a set of code at a future time specified by tickDelay.
|
|
2648
2681
|
*
|
|
@@ -2675,6 +2708,9 @@ export class World {
|
|
|
2675
2708
|
* @remarks
|
|
2676
2709
|
* Returns a dimension object.
|
|
2677
2710
|
*
|
|
2711
|
+
* @param dimensionId
|
|
2712
|
+
* The name of the dimension. For example, "overworld",
|
|
2713
|
+
* "nether" or "the_end".
|
|
2678
2714
|
* @returns
|
|
2679
2715
|
* The requested dimension
|
|
2680
2716
|
* @throws
|
|
@@ -2682,7 +2718,6 @@ export class World {
|
|
|
2682
2718
|
*/
|
|
2683
2719
|
getDimension(dimensionId: string): Dimension;
|
|
2684
2720
|
/**
|
|
2685
|
-
* @beta
|
|
2686
2721
|
* @remarks
|
|
2687
2722
|
* Returns a set of players based on a set of conditions
|
|
2688
2723
|
* defined via the EntityQueryOptions set of filter criteria.
|
|
@@ -2692,42 +2727,94 @@ export class World {
|
|
|
2692
2727
|
* players returned.
|
|
2693
2728
|
* @returns
|
|
2694
2729
|
* A player array.
|
|
2695
|
-
* @throws
|
|
2730
|
+
* @throws
|
|
2731
|
+
* Throws if the provided EntityQueryOptions are invalid.
|
|
2696
2732
|
*/
|
|
2697
2733
|
getPlayers(options?: EntityQueryOptions): Player[];
|
|
2698
2734
|
/**
|
|
2699
|
-
* @beta
|
|
2700
2735
|
* @remarks
|
|
2701
2736
|
* Plays a particular music track for all players.
|
|
2702
2737
|
*
|
|
2703
2738
|
* This function can't be called in read-only mode.
|
|
2704
2739
|
*
|
|
2705
2740
|
* @throws This function can throw errors.
|
|
2741
|
+
* @example playMusicAndSound.ts
|
|
2742
|
+
* ```typescript
|
|
2743
|
+
* let players = mc.world.getPlayers();
|
|
2744
|
+
*
|
|
2745
|
+
* const musicOptions: mc.MusicOptions = {
|
|
2746
|
+
* fade: 0.5,
|
|
2747
|
+
* loop: true,
|
|
2748
|
+
* volume: 1.0,
|
|
2749
|
+
* };
|
|
2750
|
+
* mc.world.playMusic("music.menu", musicOptions);
|
|
2751
|
+
*
|
|
2752
|
+
* const worldSoundOptions: mc.WorldSoundOptions = {
|
|
2753
|
+
* pitch: 0.5,
|
|
2754
|
+
* volume: 4.0,
|
|
2755
|
+
* };
|
|
2756
|
+
* mc.world.playSound("ambient.weather.thunder", targetLocation, worldSoundOptions);
|
|
2757
|
+
*
|
|
2758
|
+
* const playerSoundOptions: mc.PlayerSoundOptions = {
|
|
2759
|
+
* pitch: 1.0,
|
|
2760
|
+
* volume: 1.0,
|
|
2761
|
+
* };
|
|
2762
|
+
*
|
|
2763
|
+
* players[0].playSound("bucket.fill_water", playerSoundOptions);
|
|
2764
|
+
* ```
|
|
2706
2765
|
*/
|
|
2707
2766
|
playMusic(trackID: string, musicOptions?: MusicOptions): void;
|
|
2708
2767
|
/**
|
|
2709
|
-
* @beta
|
|
2710
2768
|
* @remarks
|
|
2711
2769
|
* Plays a sound for all players.
|
|
2712
2770
|
*
|
|
2713
2771
|
* This function can't be called in read-only mode.
|
|
2714
2772
|
*
|
|
2715
|
-
* @throws
|
|
2773
|
+
* @throws
|
|
2774
|
+
* An error will be thrown if volume is less than 0.0.
|
|
2775
|
+
* An error will be thrown if fade is less than 0.0.
|
|
2776
|
+
* An error will be thrown if pitch is less than 0.01.
|
|
2777
|
+
* An error will be thrown if volume is less than 0.0.
|
|
2778
|
+
* @example playMusicAndSound.ts
|
|
2779
|
+
* ```typescript
|
|
2780
|
+
* let players = mc.world.getPlayers();
|
|
2781
|
+
*
|
|
2782
|
+
* const musicOptions: mc.MusicOptions = {
|
|
2783
|
+
* fade: 0.5,
|
|
2784
|
+
* loop: true,
|
|
2785
|
+
* volume: 1.0,
|
|
2786
|
+
* };
|
|
2787
|
+
* mc.world.playMusic("music.menu", musicOptions);
|
|
2788
|
+
*
|
|
2789
|
+
* const worldSoundOptions: mc.WorldSoundOptions = {
|
|
2790
|
+
* pitch: 0.5,
|
|
2791
|
+
* volume: 4.0,
|
|
2792
|
+
* };
|
|
2793
|
+
* mc.world.playSound("ambient.weather.thunder", targetLocation, worldSoundOptions);
|
|
2794
|
+
*
|
|
2795
|
+
* const playerSoundOptions: mc.PlayerSoundOptions = {
|
|
2796
|
+
* pitch: 1.0,
|
|
2797
|
+
* volume: 1.0,
|
|
2798
|
+
* };
|
|
2799
|
+
*
|
|
2800
|
+
* players[0].playSound("bucket.fill_water", playerSoundOptions);
|
|
2801
|
+
* ```
|
|
2716
2802
|
*/
|
|
2717
2803
|
playSound(soundID: string, location: Vector3, soundOptions?: WorldSoundOptions): void;
|
|
2718
2804
|
/**
|
|
2719
|
-
* @beta
|
|
2720
2805
|
* @remarks
|
|
2721
2806
|
* Queues an additional music track for players. If a track is
|
|
2722
2807
|
* not playing, a music track will play.
|
|
2723
2808
|
*
|
|
2724
2809
|
* This function can't be called in read-only mode.
|
|
2725
2810
|
*
|
|
2726
|
-
* @throws
|
|
2811
|
+
* @throws
|
|
2812
|
+
* An error will be thrown if volume is less than 0.0.
|
|
2813
|
+
* An error will be thrown if fade is less than 0.0.
|
|
2814
|
+
*
|
|
2727
2815
|
*/
|
|
2728
2816
|
queueMusic(trackID: string, musicOptions?: MusicOptions): void;
|
|
2729
2817
|
/**
|
|
2730
|
-
* @beta
|
|
2731
2818
|
* @remarks
|
|
2732
2819
|
* Sends a message to all players.
|
|
2733
2820
|
*
|
|
@@ -2766,7 +2853,6 @@ export class World {
|
|
|
2766
2853
|
*/
|
|
2767
2854
|
sendMessage(message: (RawMessage | string)[] | RawMessage | string): void;
|
|
2768
2855
|
/**
|
|
2769
|
-
* @beta
|
|
2770
2856
|
* @remarks
|
|
2771
2857
|
* Stops any music tracks from playing.
|
|
2772
2858
|
*
|
|
@@ -2777,19 +2863,43 @@ export class World {
|
|
|
2777
2863
|
}
|
|
2778
2864
|
|
|
2779
2865
|
/**
|
|
2780
|
-
*
|
|
2866
|
+
* Contains a set of events that are available across the scope
|
|
2867
|
+
* of the World.
|
|
2781
2868
|
*/
|
|
2782
2869
|
export class WorldAfterEvents {
|
|
2783
2870
|
private constructor();
|
|
2871
|
+
/**
|
|
2872
|
+
* @remarks
|
|
2873
|
+
* This event fires when a button is pushed.
|
|
2874
|
+
*
|
|
2875
|
+
*/
|
|
2784
2876
|
readonly buttonPush: ButtonPushAfterEventSignal;
|
|
2785
2877
|
readonly leverAction: LeverActionAfterEventSignal;
|
|
2878
|
+
/**
|
|
2879
|
+
* @remarks
|
|
2880
|
+
* This event fires when a player joins a world. See also
|
|
2881
|
+
* playerSpawn for another related event you can trap for when
|
|
2882
|
+
* a player is spawned the first time within a world.
|
|
2883
|
+
*
|
|
2884
|
+
*/
|
|
2786
2885
|
readonly playerJoin: PlayerJoinAfterEventSignal;
|
|
2886
|
+
/**
|
|
2887
|
+
* @remarks
|
|
2888
|
+
* This event fires when a player leaves a world.
|
|
2889
|
+
*
|
|
2890
|
+
*/
|
|
2787
2891
|
readonly playerLeave: PlayerLeaveAfterEventSignal;
|
|
2892
|
+
/**
|
|
2893
|
+
* @remarks
|
|
2894
|
+
* This event fires when a player spawns or respawns. Note that
|
|
2895
|
+
* an additional flag within this event will tell you whether
|
|
2896
|
+
* the player is spawning right after join vs. a respawn.
|
|
2897
|
+
*
|
|
2898
|
+
*/
|
|
2788
2899
|
readonly playerSpawn: PlayerSpawnAfterEventSignal;
|
|
2789
2900
|
}
|
|
2790
2901
|
|
|
2791
2902
|
/**
|
|
2792
|
-
* @beta
|
|
2793
2903
|
* Additional options for when damage has been applied via a
|
|
2794
2904
|
* projectile.
|
|
2795
2905
|
*/
|
|
@@ -2809,7 +2919,6 @@ export interface EntityApplyDamageByProjectileOptions {
|
|
|
2809
2919
|
}
|
|
2810
2920
|
|
|
2811
2921
|
/**
|
|
2812
|
-
* @beta
|
|
2813
2922
|
* Additional descriptions and metadata for a damage event.
|
|
2814
2923
|
*/
|
|
2815
2924
|
export interface EntityApplyDamageOptions {
|
|
@@ -2828,7 +2937,6 @@ export interface EntityApplyDamageOptions {
|
|
|
2828
2937
|
}
|
|
2829
2938
|
|
|
2830
2939
|
/**
|
|
2831
|
-
* @beta
|
|
2832
2940
|
* Contains additional options for entity effects.
|
|
2833
2941
|
*/
|
|
2834
2942
|
export interface EntityEffectOptions {
|
|
@@ -2847,7 +2955,6 @@ export interface EntityEffectOptions {
|
|
|
2847
2955
|
}
|
|
2848
2956
|
|
|
2849
2957
|
/**
|
|
2850
|
-
* @beta
|
|
2851
2958
|
* Contains options for selecting entities within an area.
|
|
2852
2959
|
*/
|
|
2853
2960
|
export interface EntityQueryOptions {
|
|
@@ -3010,7 +3117,6 @@ export interface EntityQueryOptions {
|
|
|
3010
3117
|
}
|
|
3011
3118
|
|
|
3012
3119
|
/**
|
|
3013
|
-
* @beta
|
|
3014
3120
|
* Contains additional options for filtering players based on
|
|
3015
3121
|
* their score for an objective.
|
|
3016
3122
|
*/
|
|
@@ -3045,7 +3151,6 @@ export interface EntityQueryScoreOptions {
|
|
|
3045
3151
|
}
|
|
3046
3152
|
|
|
3047
3153
|
/**
|
|
3048
|
-
* @beta
|
|
3049
3154
|
* Additional configuration options for {@link
|
|
3050
3155
|
* World.playMusic}/{@link World.queueMusic} methods.
|
|
3051
3156
|
*/
|
|
@@ -3071,7 +3176,6 @@ export interface MusicOptions {
|
|
|
3071
3176
|
}
|
|
3072
3177
|
|
|
3073
3178
|
/**
|
|
3074
|
-
* @beta
|
|
3075
3179
|
* Additional options for how a sound plays for a player.
|
|
3076
3180
|
*/
|
|
3077
3181
|
export interface PlayerSoundOptions {
|
|
@@ -3097,18 +3201,35 @@ export interface PlayerSoundOptions {
|
|
|
3097
3201
|
}
|
|
3098
3202
|
|
|
3099
3203
|
/**
|
|
3100
|
-
*
|
|
3204
|
+
* Defines a JSON structure that is used for more flexible
|
|
3101
3205
|
*/
|
|
3102
3206
|
export interface RawMessage {
|
|
3103
3207
|
rawtext?: RawMessage[];
|
|
3208
|
+
/**
|
|
3209
|
+
* @remarks
|
|
3210
|
+
* Provides a token that will get replaced with the value of a
|
|
3211
|
+
* score.
|
|
3212
|
+
*
|
|
3213
|
+
*/
|
|
3104
3214
|
score?: RawMessageScore;
|
|
3215
|
+
/**
|
|
3216
|
+
* @remarks
|
|
3217
|
+
* Provides a string literal value to use.
|
|
3218
|
+
*
|
|
3219
|
+
*/
|
|
3105
3220
|
text?: string;
|
|
3221
|
+
/**
|
|
3222
|
+
* @remarks
|
|
3223
|
+
* Provides a translation token where, if the client has an
|
|
3224
|
+
* available resource in the players' language which matches
|
|
3225
|
+
* the token, will get translated on the client.
|
|
3226
|
+
*
|
|
3227
|
+
*/
|
|
3106
3228
|
translate?: string;
|
|
3107
3229
|
with?: string[] | RawMessage;
|
|
3108
3230
|
}
|
|
3109
3231
|
|
|
3110
3232
|
/**
|
|
3111
|
-
* @beta
|
|
3112
3233
|
* Provides a description of a score token to use within a raw
|
|
3113
3234
|
* message.
|
|
3114
3235
|
*/
|
|
@@ -3128,7 +3249,6 @@ export interface RawMessageScore {
|
|
|
3128
3249
|
}
|
|
3129
3250
|
|
|
3130
3251
|
/**
|
|
3131
|
-
* @beta
|
|
3132
3252
|
* Contains additional options for teleporting an entity.
|
|
3133
3253
|
*/
|
|
3134
3254
|
export interface TeleportOptions {
|
|
@@ -3168,7 +3288,6 @@ export interface TeleportOptions {
|
|
|
3168
3288
|
}
|
|
3169
3289
|
|
|
3170
3290
|
/**
|
|
3171
|
-
* @beta
|
|
3172
3291
|
* Represents a two-directional vector.
|
|
3173
3292
|
*/
|
|
3174
3293
|
export interface Vector2 {
|
|
@@ -3187,7 +3306,6 @@ export interface Vector2 {
|
|
|
3187
3306
|
}
|
|
3188
3307
|
|
|
3189
3308
|
/**
|
|
3190
|
-
* @beta
|
|
3191
3309
|
* Contains a description of a vector.
|
|
3192
3310
|
*/
|
|
3193
3311
|
export interface Vector3 {
|
|
@@ -3212,7 +3330,6 @@ export interface Vector3 {
|
|
|
3212
3330
|
}
|
|
3213
3331
|
|
|
3214
3332
|
/**
|
|
3215
|
-
* @beta
|
|
3216
3333
|
* Contains additional options for a world-level playSound
|
|
3217
3334
|
* occurrence.
|
|
3218
3335
|
*/
|