@minecraft/server 2.7.0-rc.1.26.20-preview.20 → 2.7.0-rc.1.26.20-preview.23
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 +588 -604
- package/package.json +2 -2
package/index.d.ts
CHANGED
|
@@ -25,7 +25,6 @@ import * as minecraftcommon from '@minecraft/common';
|
|
|
25
25
|
// @ts-ignore Optional types-only package, will decay to any if @minecraft/vanilla-data isn't installed
|
|
26
26
|
import type * as minecraftvanilladata from '@minecraft/vanilla-data';
|
|
27
27
|
/**
|
|
28
|
-
* @rc
|
|
29
28
|
* Specifies different targeting modes for use in aim-assist.
|
|
30
29
|
*/
|
|
31
30
|
export enum AimAssistTargetMode {
|
|
@@ -700,7 +699,6 @@ export enum EnchantmentSlot {
|
|
|
700
699
|
}
|
|
701
700
|
|
|
702
701
|
/**
|
|
703
|
-
* @rc
|
|
704
702
|
* The entity's attach location point. Contains points such as
|
|
705
703
|
* head, body, leg, etc to attach the camera to.
|
|
706
704
|
*/
|
|
@@ -1412,7 +1410,6 @@ export enum EntityDamageCause {
|
|
|
1412
1410
|
}
|
|
1413
1411
|
|
|
1414
1412
|
/**
|
|
1415
|
-
* @rc
|
|
1416
1413
|
* Describes the source of healing of an Entity.
|
|
1417
1414
|
*/
|
|
1418
1415
|
export enum EntityHealCause {
|
|
@@ -2766,7 +2763,6 @@ export enum StructureSaveMode {
|
|
|
2766
2763
|
}
|
|
2767
2764
|
|
|
2768
2765
|
/**
|
|
2769
|
-
* @rc
|
|
2770
2766
|
* The reason that the {@link
|
|
2771
2767
|
* @minecraft/server.TickingAreaError} was thrown.
|
|
2772
2768
|
*/
|
|
@@ -3128,7 +3124,6 @@ export type ItemComponentTypeMap = {
|
|
|
3128
3124
|
};
|
|
3129
3125
|
|
|
3130
3126
|
/**
|
|
3131
|
-
* @rc
|
|
3132
3127
|
* Handle to an aim-assist category that exists in the
|
|
3133
3128
|
* world.aimAssist registry.
|
|
3134
3129
|
*/
|
|
@@ -3203,7 +3198,6 @@ export class AimAssistCategory {
|
|
|
3203
3198
|
}
|
|
3204
3199
|
|
|
3205
3200
|
/**
|
|
3206
|
-
* @rc
|
|
3207
3201
|
* Settings used with AimAssistRegistry.addCategory for
|
|
3208
3202
|
* creation of the AimAssistCategory.
|
|
3209
3203
|
*/
|
|
@@ -3317,7 +3311,6 @@ export class AimAssistCategorySettings {
|
|
|
3317
3311
|
}
|
|
3318
3312
|
|
|
3319
3313
|
/**
|
|
3320
|
-
* @rc
|
|
3321
3314
|
* Handle to an aim-assist preset that exists in the
|
|
3322
3315
|
* world.aimAssist registry.
|
|
3323
3316
|
*/
|
|
@@ -3410,7 +3403,6 @@ export class AimAssistPreset {
|
|
|
3410
3403
|
}
|
|
3411
3404
|
|
|
3412
3405
|
/**
|
|
3413
|
-
* @rc
|
|
3414
3406
|
* Settings used with AimAssistRegistry.addPreset for creation
|
|
3415
3407
|
* of the AimAssistPreset.
|
|
3416
3408
|
*/
|
|
@@ -3560,7 +3552,6 @@ export class AimAssistPresetSettings {
|
|
|
3560
3552
|
}
|
|
3561
3553
|
|
|
3562
3554
|
/**
|
|
3563
|
-
* @rc
|
|
3564
3555
|
* A container for APIs related to the world's aim-assist
|
|
3565
3556
|
* settings.
|
|
3566
3557
|
*/
|
|
@@ -3674,6 +3665,49 @@ export class BiomeType {
|
|
|
3674
3665
|
*
|
|
3675
3666
|
*/
|
|
3676
3667
|
readonly id: string;
|
|
3668
|
+
/**
|
|
3669
|
+
* @rc
|
|
3670
|
+
* @remarks
|
|
3671
|
+
* Returns a list of the biome's tags.
|
|
3672
|
+
*
|
|
3673
|
+
*/
|
|
3674
|
+
getTags(): string[];
|
|
3675
|
+
/**
|
|
3676
|
+
* @rc
|
|
3677
|
+
* @remarks
|
|
3678
|
+
* Checks if the biome has all of the provided tags.
|
|
3679
|
+
*
|
|
3680
|
+
* @param tags
|
|
3681
|
+
* The list of tags to check against the biome.
|
|
3682
|
+
*/
|
|
3683
|
+
hasTags(tags: string[]): boolean;
|
|
3684
|
+
}
|
|
3685
|
+
|
|
3686
|
+
/**
|
|
3687
|
+
* @rc
|
|
3688
|
+
* Supports a catalog of available biome types registered
|
|
3689
|
+
* within Minecraft.
|
|
3690
|
+
*/
|
|
3691
|
+
export class BiomeTypes {
|
|
3692
|
+
private constructor();
|
|
3693
|
+
/**
|
|
3694
|
+
* @remarks
|
|
3695
|
+
* Returns a specific biome type.
|
|
3696
|
+
*
|
|
3697
|
+
* @param typeName
|
|
3698
|
+
* Identifier of the biome. Generally, namespaced identifiers
|
|
3699
|
+
* (e.g., minecraft:frozen_peaks) should be used.
|
|
3700
|
+
* @returns
|
|
3701
|
+
* If the biome exists, a BiomeType object is returned. If not,
|
|
3702
|
+
* undefined is returned.
|
|
3703
|
+
*/
|
|
3704
|
+
static get(typeName: string): BiomeType | undefined;
|
|
3705
|
+
/**
|
|
3706
|
+
* @remarks
|
|
3707
|
+
* Returns all registered biome types within Minecraft
|
|
3708
|
+
*
|
|
3709
|
+
*/
|
|
3710
|
+
static getAll(): BiomeType[];
|
|
3677
3711
|
}
|
|
3678
3712
|
|
|
3679
3713
|
/**
|
|
@@ -3926,7 +3960,6 @@ export class Block {
|
|
|
3926
3960
|
*/
|
|
3927
3961
|
getComponent<T extends string>(componentId: T): BlockComponentReturnType<T> | undefined;
|
|
3928
3962
|
/**
|
|
3929
|
-
* @rc
|
|
3930
3963
|
* @remarks
|
|
3931
3964
|
* Returns all scripting components that are present on this
|
|
3932
3965
|
* block.
|
|
@@ -4022,7 +4055,6 @@ export class Block {
|
|
|
4022
4055
|
*/
|
|
4023
4056
|
getTags(): string[];
|
|
4024
4057
|
/**
|
|
4025
|
-
* @rc
|
|
4026
4058
|
* @remarks
|
|
4027
4059
|
* Returns true if the specified component is present on this
|
|
4028
4060
|
* block.
|
|
@@ -4055,7 +4087,7 @@ export class Block {
|
|
|
4055
4087
|
* {@link LocationOutOfWorldBoundariesError}
|
|
4056
4088
|
* @example checkBlockTags.ts
|
|
4057
4089
|
* ```typescript
|
|
4058
|
-
* import { DimensionLocation } from
|
|
4090
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
4059
4091
|
*
|
|
4060
4092
|
* function checkBlockTags(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
4061
4093
|
* // Fetch the block
|
|
@@ -4063,9 +4095,9 @@ export class Block {
|
|
|
4063
4095
|
*
|
|
4064
4096
|
* // check that the block is loaded
|
|
4065
4097
|
* if (block) {
|
|
4066
|
-
* log(`Block is dirt: ${block.hasTag(
|
|
4067
|
-
* log(`Block is wood: ${block.hasTag(
|
|
4068
|
-
* log(`Block is stone: ${block.hasTag(
|
|
4098
|
+
* log(`Block is dirt: ${block.hasTag('dirt')}`);
|
|
4099
|
+
* log(`Block is wood: ${block.hasTag('wood')}`);
|
|
4100
|
+
* log(`Block is stone: ${block.hasTag('stone')}`);
|
|
4069
4101
|
* }
|
|
4070
4102
|
* }
|
|
4071
4103
|
* ```
|
|
@@ -4306,7 +4338,6 @@ export class BlockComponentBlockBreakEvent extends BlockEvent {
|
|
|
4306
4338
|
}
|
|
4307
4339
|
|
|
4308
4340
|
/**
|
|
4309
|
-
* @rc
|
|
4310
4341
|
* Contains information regarding an event sent by an entity to
|
|
4311
4342
|
* this block in the world.
|
|
4312
4343
|
*/
|
|
@@ -4480,7 +4511,6 @@ export class BlockComponentRedstoneUpdateEvent extends BlockEvent {
|
|
|
4480
4511
|
*/
|
|
4481
4512
|
readonly powerLevel: number;
|
|
4482
4513
|
/**
|
|
4483
|
-
* @rc
|
|
4484
4514
|
* @remarks
|
|
4485
4515
|
* The redstone signal strength from the last tick that was
|
|
4486
4516
|
* passing through this block. It is guaranteed to be >= the
|
|
@@ -4704,15 +4734,15 @@ export class BlockFluidContainerComponent extends BlockComponent {
|
|
|
4704
4734
|
* blocks like chests.
|
|
4705
4735
|
* @example placeItemsInChest.ts
|
|
4706
4736
|
* ```typescript
|
|
4707
|
-
* import { ItemStack, BlockInventoryComponent, DimensionLocation } from
|
|
4708
|
-
* import { MinecraftBlockTypes, MinecraftItemTypes } from
|
|
4737
|
+
* import { ItemStack, BlockInventoryComponent, DimensionLocation } from '@minecraft/server';
|
|
4738
|
+
* import { MinecraftBlockTypes, MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
4709
4739
|
*
|
|
4710
4740
|
* function placeItemsInChest(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
4711
4741
|
* // Fetch block
|
|
4712
4742
|
* const block = targetLocation.dimension.getBlock(targetLocation);
|
|
4713
4743
|
*
|
|
4714
4744
|
* if (!block) {
|
|
4715
|
-
* log(
|
|
4745
|
+
* log('Could not find block. Maybe it is not loaded?', -1);
|
|
4716
4746
|
* return;
|
|
4717
4747
|
* }
|
|
4718
4748
|
*
|
|
@@ -4720,10 +4750,10 @@ export class BlockFluidContainerComponent extends BlockComponent {
|
|
|
4720
4750
|
* block.setType(MinecraftBlockTypes.Chest);
|
|
4721
4751
|
*
|
|
4722
4752
|
* // Get the inventory
|
|
4723
|
-
* const inventoryComponent = block.getComponent(
|
|
4753
|
+
* const inventoryComponent = block.getComponent('inventory') as BlockInventoryComponent;
|
|
4724
4754
|
*
|
|
4725
4755
|
* if (!inventoryComponent || !inventoryComponent.container) {
|
|
4726
|
-
* log(
|
|
4756
|
+
* log('Could not find inventory component.', -1);
|
|
4727
4757
|
* return;
|
|
4728
4758
|
* }
|
|
4729
4759
|
*
|
|
@@ -4842,8 +4872,8 @@ export class BlockMovableComponent extends BlockComponent {
|
|
|
4842
4872
|
* Block}).
|
|
4843
4873
|
* @example addTranslatedSign.ts
|
|
4844
4874
|
* ```typescript
|
|
4845
|
-
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from
|
|
4846
|
-
* import { MinecraftBlockTypes } from
|
|
4875
|
+
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
4876
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
4847
4877
|
*
|
|
4848
4878
|
* function addTranslatedSign(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
4849
4879
|
* const players = world.getPlayers();
|
|
@@ -4853,7 +4883,7 @@ export class BlockMovableComponent extends BlockComponent {
|
|
|
4853
4883
|
* const signBlock = dim.getBlock(targetLocation);
|
|
4854
4884
|
*
|
|
4855
4885
|
* if (!signBlock) {
|
|
4856
|
-
* log(
|
|
4886
|
+
* log('Could not find a block at specified location.');
|
|
4857
4887
|
* return -1;
|
|
4858
4888
|
* }
|
|
4859
4889
|
* const signPerm = BlockPermutation.resolve(MinecraftBlockTypes.StandingSign, { ground_sign_direction: 8 });
|
|
@@ -4862,14 +4892,13 @@ export class BlockMovableComponent extends BlockComponent {
|
|
|
4862
4892
|
*
|
|
4863
4893
|
* const signComponent = signBlock.getComponent(BlockComponentTypes.Sign) as BlockSignComponent;
|
|
4864
4894
|
*
|
|
4865
|
-
* signComponent?.setText({ translate:
|
|
4895
|
+
* signComponent?.setText({ translate: 'item.skull.player.name', with: [players[0].name] });
|
|
4866
4896
|
* }
|
|
4867
4897
|
* ```
|
|
4868
4898
|
*/
|
|
4869
4899
|
export class BlockPermutation {
|
|
4870
4900
|
private constructor();
|
|
4871
4901
|
/**
|
|
4872
|
-
* @rc
|
|
4873
4902
|
* @remarks
|
|
4874
4903
|
* Key for the localization of this BlockPermutation's name
|
|
4875
4904
|
* used in .lang files.
|
|
@@ -4956,7 +4985,7 @@ export class BlockPermutation {
|
|
|
4956
4985
|
* Returns `true` if the permutation has the tag, else `false`.
|
|
4957
4986
|
* @example checkBlockTags.ts
|
|
4958
4987
|
* ```typescript
|
|
4959
|
-
* import { DimensionLocation } from
|
|
4988
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
4960
4989
|
*
|
|
4961
4990
|
* function checkBlockTags(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
4962
4991
|
* // Fetch the block
|
|
@@ -4964,9 +4993,9 @@ export class BlockPermutation {
|
|
|
4964
4993
|
*
|
|
4965
4994
|
* // check that the block is loaded
|
|
4966
4995
|
* if (block) {
|
|
4967
|
-
* log(`Block is dirt: ${block.hasTag(
|
|
4968
|
-
* log(`Block is wood: ${block.hasTag(
|
|
4969
|
-
* log(`Block is stone: ${block.hasTag(
|
|
4996
|
+
* log(`Block is dirt: ${block.hasTag('dirt')}`);
|
|
4997
|
+
* log(`Block is wood: ${block.hasTag('wood')}`);
|
|
4998
|
+
* log(`Block is stone: ${block.hasTag('stone')}`);
|
|
4970
4999
|
* }
|
|
4971
5000
|
* }
|
|
4972
5001
|
* ```
|
|
@@ -5035,9 +5064,9 @@ export class BlockPermutation {
|
|
|
5035
5064
|
* @throws This function can throw errors.
|
|
5036
5065
|
* @example addBlockColorCube.ts
|
|
5037
5066
|
* ```typescript
|
|
5038
|
-
* import { BlockPermutation, DimensionLocation } from
|
|
5039
|
-
* import { Vector3Utils } from
|
|
5040
|
-
* import { MinecraftBlockTypes } from
|
|
5067
|
+
* import { BlockPermutation, DimensionLocation } from '@minecraft/server';
|
|
5068
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
5069
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5041
5070
|
*
|
|
5042
5071
|
* function addBlockColorCube(targetLocation: DimensionLocation) {
|
|
5043
5072
|
* const allWoolBlocks: string[] = [
|
|
@@ -5272,8 +5301,8 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5272
5301
|
* Represents a block that can display text on it.
|
|
5273
5302
|
* @example addSign.ts
|
|
5274
5303
|
* ```typescript
|
|
5275
|
-
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from
|
|
5276
|
-
* import { MinecraftBlockTypes } from
|
|
5304
|
+
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
5305
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5277
5306
|
*
|
|
5278
5307
|
* function addSign(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
5279
5308
|
* const players = world.getPlayers();
|
|
@@ -5283,7 +5312,7 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5283
5312
|
* const signBlock = dim.getBlock(targetLocation);
|
|
5284
5313
|
*
|
|
5285
5314
|
* if (!signBlock) {
|
|
5286
|
-
* log(
|
|
5315
|
+
* log('Could not find a block at specified location.');
|
|
5287
5316
|
* return -1;
|
|
5288
5317
|
* }
|
|
5289
5318
|
* const signPerm = BlockPermutation.resolve(MinecraftBlockTypes.StandingSign, { ground_sign_direction: 8 });
|
|
@@ -5297,14 +5326,21 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5297
5326
|
* ```
|
|
5298
5327
|
* @example addTwoSidedSign.ts
|
|
5299
5328
|
* ```typescript
|
|
5300
|
-
* import {
|
|
5301
|
-
*
|
|
5329
|
+
* import {
|
|
5330
|
+
* BlockPermutation,
|
|
5331
|
+
* BlockSignComponent,
|
|
5332
|
+
* SignSide,
|
|
5333
|
+
* DyeColor,
|
|
5334
|
+
* BlockComponentTypes,
|
|
5335
|
+
* DimensionLocation,
|
|
5336
|
+
* } from '@minecraft/server';
|
|
5337
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5302
5338
|
*
|
|
5303
5339
|
* function addTwoSidedSign(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
5304
5340
|
* const signBlock = targetLocation.dimension.getBlock(targetLocation);
|
|
5305
5341
|
*
|
|
5306
5342
|
* if (!signBlock) {
|
|
5307
|
-
* log(
|
|
5343
|
+
* log('Could not find a block at specified location.');
|
|
5308
5344
|
* return -1;
|
|
5309
5345
|
* }
|
|
5310
5346
|
* const signPerm = BlockPermutation.resolve(MinecraftBlockTypes.StandingSign, { ground_sign_direction: 8 });
|
|
@@ -5322,42 +5358,42 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5322
5358
|
* // players cannot edit sign!
|
|
5323
5359
|
* signComponent.setWaxed(true);
|
|
5324
5360
|
* } else {
|
|
5325
|
-
* log(
|
|
5361
|
+
* log('Could not find sign component.');
|
|
5326
5362
|
* }
|
|
5327
5363
|
* }
|
|
5328
5364
|
* ```
|
|
5329
5365
|
* @example updateSignText.ts
|
|
5330
5366
|
* ```typescript
|
|
5331
|
-
* import { BlockSignComponent, BlockComponentTypes, DimensionLocation, RawMessage, RawText } from
|
|
5367
|
+
* import { BlockSignComponent, BlockComponentTypes, DimensionLocation, RawMessage, RawText } from '@minecraft/server';
|
|
5332
5368
|
*
|
|
5333
5369
|
* function updateSignText(targetLocation: DimensionLocation) {
|
|
5334
5370
|
* const block = targetLocation.dimension.getBlock(targetLocation);
|
|
5335
5371
|
* if (!block) {
|
|
5336
|
-
* console.warn(
|
|
5372
|
+
* console.warn('Could not find a block at specified location.');
|
|
5337
5373
|
* return;
|
|
5338
5374
|
* }
|
|
5339
5375
|
*
|
|
5340
5376
|
* const sign = block.getComponent(BlockComponentTypes.Sign) as BlockSignComponent;
|
|
5341
5377
|
* if (sign) {
|
|
5342
5378
|
* // RawMessage
|
|
5343
|
-
* const helloWorldMessage: RawMessage = { text:
|
|
5379
|
+
* const helloWorldMessage: RawMessage = { text: 'Hello World' };
|
|
5344
5380
|
* sign.setText(helloWorldMessage);
|
|
5345
5381
|
*
|
|
5346
5382
|
* // RawText
|
|
5347
|
-
* const helloWorldText: RawText = { rawtext: [{ text:
|
|
5383
|
+
* const helloWorldText: RawText = { rawtext: [{ text: 'Hello World' }] };
|
|
5348
5384
|
* sign.setText(helloWorldText);
|
|
5349
5385
|
*
|
|
5350
5386
|
* // Regular string
|
|
5351
|
-
* sign.setText(
|
|
5387
|
+
* sign.setText('Hello World');
|
|
5352
5388
|
* } else {
|
|
5353
|
-
* console.warn(
|
|
5389
|
+
* console.warn('Could not find a sign component on the block.');
|
|
5354
5390
|
* }
|
|
5355
5391
|
* }
|
|
5356
5392
|
* ```
|
|
5357
5393
|
* @example addTranslatedSign.ts
|
|
5358
5394
|
* ```typescript
|
|
5359
|
-
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from
|
|
5360
|
-
* import { MinecraftBlockTypes } from
|
|
5395
|
+
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
5396
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5361
5397
|
*
|
|
5362
5398
|
* function addTranslatedSign(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
5363
5399
|
* const players = world.getPlayers();
|
|
@@ -5367,7 +5403,7 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5367
5403
|
* const signBlock = dim.getBlock(targetLocation);
|
|
5368
5404
|
*
|
|
5369
5405
|
* if (!signBlock) {
|
|
5370
|
-
* log(
|
|
5406
|
+
* log('Could not find a block at specified location.');
|
|
5371
5407
|
* return -1;
|
|
5372
5408
|
* }
|
|
5373
5409
|
* const signPerm = BlockPermutation.resolve(MinecraftBlockTypes.StandingSign, { ground_sign_direction: 8 });
|
|
@@ -5376,7 +5412,7 @@ export class BlockRedstoneProducerComponent extends BlockComponent {
|
|
|
5376
5412
|
*
|
|
5377
5413
|
* const signComponent = signBlock.getComponent(BlockComponentTypes.Sign) as BlockSignComponent;
|
|
5378
5414
|
*
|
|
5379
|
-
* signComponent?.setText({ translate:
|
|
5415
|
+
* signComponent?.setText({ translate: 'item.skull.player.name', with: [players[0].name] });
|
|
5380
5416
|
* }
|
|
5381
5417
|
* ```
|
|
5382
5418
|
*/
|
|
@@ -5539,7 +5575,6 @@ export class BlockType {
|
|
|
5539
5575
|
*/
|
|
5540
5576
|
readonly id: string;
|
|
5541
5577
|
/**
|
|
5542
|
-
* @rc
|
|
5543
5578
|
* @remarks
|
|
5544
5579
|
* Key for the localization of this BlockType's name used in
|
|
5545
5580
|
* .lang files.
|
|
@@ -5719,8 +5754,8 @@ export class BlockVolumeBase {
|
|
|
5719
5754
|
* Contains information related to changes to a button push.
|
|
5720
5755
|
* @example buttonPushEvent.ts
|
|
5721
5756
|
* ```typescript
|
|
5722
|
-
* import { world, system, BlockPermutation, ButtonPushAfterEvent, DimensionLocation } from
|
|
5723
|
-
* import { MinecraftBlockTypes } from
|
|
5757
|
+
* import { world, system, BlockPermutation, ButtonPushAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
5758
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5724
5759
|
*
|
|
5725
5760
|
* function buttonPushEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
5726
5761
|
* // set up a button on cobblestone
|
|
@@ -5732,18 +5767,18 @@ export class BlockVolumeBase {
|
|
|
5732
5767
|
* });
|
|
5733
5768
|
*
|
|
5734
5769
|
* if (cobblestone === undefined || button === undefined) {
|
|
5735
|
-
* log(
|
|
5770
|
+
* log('Could not find block at location.');
|
|
5736
5771
|
* return -1;
|
|
5737
5772
|
* }
|
|
5738
5773
|
*
|
|
5739
5774
|
* cobblestone.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Cobblestone));
|
|
5740
|
-
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState(
|
|
5775
|
+
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState('facing_direction', 1));
|
|
5741
5776
|
*
|
|
5742
5777
|
* world.afterEvents.buttonPush.subscribe((buttonPushEvent: ButtonPushAfterEvent) => {
|
|
5743
5778
|
* const eventLoc = buttonPushEvent.block.location;
|
|
5744
5779
|
*
|
|
5745
5780
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y + 1 && eventLoc.z === targetLocation.z) {
|
|
5746
|
-
* log(
|
|
5781
|
+
* log('Button push event at tick ' + system.currentTick);
|
|
5747
5782
|
* }
|
|
5748
5783
|
* });
|
|
5749
5784
|
* }
|
|
@@ -5765,8 +5800,8 @@ export class ButtonPushAfterEvent extends BlockEvent {
|
|
|
5765
5800
|
* pushed.
|
|
5766
5801
|
* @example buttonPushEvent.ts
|
|
5767
5802
|
* ```typescript
|
|
5768
|
-
* import { world, system, BlockPermutation, ButtonPushAfterEvent, DimensionLocation } from
|
|
5769
|
-
* import { MinecraftBlockTypes } from
|
|
5803
|
+
* import { world, system, BlockPermutation, ButtonPushAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
5804
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
5770
5805
|
*
|
|
5771
5806
|
* function buttonPushEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
5772
5807
|
* // set up a button on cobblestone
|
|
@@ -5778,18 +5813,18 @@ export class ButtonPushAfterEvent extends BlockEvent {
|
|
|
5778
5813
|
* });
|
|
5779
5814
|
*
|
|
5780
5815
|
* if (cobblestone === undefined || button === undefined) {
|
|
5781
|
-
* log(
|
|
5816
|
+
* log('Could not find block at location.');
|
|
5782
5817
|
* return -1;
|
|
5783
5818
|
* }
|
|
5784
5819
|
*
|
|
5785
5820
|
* cobblestone.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Cobblestone));
|
|
5786
|
-
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState(
|
|
5821
|
+
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState('facing_direction', 1));
|
|
5787
5822
|
*
|
|
5788
5823
|
* world.afterEvents.buttonPush.subscribe((buttonPushEvent: ButtonPushAfterEvent) => {
|
|
5789
5824
|
* const eventLoc = buttonPushEvent.block.location;
|
|
5790
5825
|
*
|
|
5791
5826
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y + 1 && eventLoc.z === targetLocation.z) {
|
|
5792
|
-
* log(
|
|
5827
|
+
* log('Button push event at tick ' + system.currentTick);
|
|
5793
5828
|
* }
|
|
5794
5829
|
* });
|
|
5795
5830
|
* }
|
|
@@ -5835,7 +5870,6 @@ export class Camera {
|
|
|
5835
5870
|
*/
|
|
5836
5871
|
readonly isValid: boolean;
|
|
5837
5872
|
/**
|
|
5838
|
-
* @rc
|
|
5839
5873
|
* @remarks
|
|
5840
5874
|
* Attaches the camera to a non-player entity.
|
|
5841
5875
|
*
|
|
@@ -5872,7 +5906,6 @@ export class Camera {
|
|
|
5872
5906
|
*/
|
|
5873
5907
|
fade(fadeCameraOptions?: CameraFadeOptions): void;
|
|
5874
5908
|
/**
|
|
5875
|
-
* @rc
|
|
5876
5909
|
* @remarks
|
|
5877
5910
|
* This function can't be called in restricted-execution mode.
|
|
5878
5911
|
*
|
|
@@ -5927,7 +5960,6 @@ export class Camera {
|
|
|
5927
5960
|
}
|
|
5928
5961
|
|
|
5929
5962
|
/**
|
|
5930
|
-
* @rc
|
|
5931
5963
|
* CatmullRom spline creation.
|
|
5932
5964
|
*/
|
|
5933
5965
|
export class CatmullRomSpline {
|
|
@@ -6004,8 +6036,8 @@ export class Component {
|
|
|
6004
6036
|
* more.
|
|
6005
6037
|
* @example containers.ts
|
|
6006
6038
|
* ```typescript
|
|
6007
|
-
* import { ItemStack, EntityInventoryComponent, BlockInventoryComponent, DimensionLocation } from
|
|
6008
|
-
* import { MinecraftBlockTypes, MinecraftItemTypes, MinecraftEntityTypes } from
|
|
6039
|
+
* import { ItemStack, EntityInventoryComponent, BlockInventoryComponent, DimensionLocation } from '@minecraft/server';
|
|
6040
|
+
* import { MinecraftBlockTypes, MinecraftItemTypes, MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
6009
6041
|
*
|
|
6010
6042
|
* function containers(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
6011
6043
|
* const xLocation = targetLocation; // left chest location
|
|
@@ -6021,42 +6053,42 @@ export class Component {
|
|
|
6021
6053
|
* const xPlusTwoChestBlock = targetLocation.dimension.getBlock(xPlusTwoLocation);
|
|
6022
6054
|
*
|
|
6023
6055
|
* if (!xChestBlock || !xPlusTwoChestBlock) {
|
|
6024
|
-
* log(
|
|
6056
|
+
* log('Could not retrieve chest blocks.');
|
|
6025
6057
|
* return;
|
|
6026
6058
|
* }
|
|
6027
6059
|
*
|
|
6028
6060
|
* xChestBlock.setType(MinecraftBlockTypes.Chest);
|
|
6029
6061
|
* xPlusTwoChestBlock.setType(MinecraftBlockTypes.Chest);
|
|
6030
6062
|
*
|
|
6031
|
-
* const xPlusTwoChestInventoryComp = xPlusTwoChestBlock.getComponent(
|
|
6032
|
-
* const xChestInventoryComponent = xChestBlock.getComponent(
|
|
6033
|
-
* const chestCartInventoryComp = chestCart.getComponent(
|
|
6063
|
+
* const xPlusTwoChestInventoryComp = xPlusTwoChestBlock.getComponent('inventory') as BlockInventoryComponent;
|
|
6064
|
+
* const xChestInventoryComponent = xChestBlock.getComponent('inventory') as BlockInventoryComponent;
|
|
6065
|
+
* const chestCartInventoryComp = chestCart.getComponent('inventory') as EntityInventoryComponent;
|
|
6034
6066
|
*
|
|
6035
6067
|
* const xPlusTwoChestContainer = xPlusTwoChestInventoryComp.container;
|
|
6036
6068
|
* const xChestContainer = xChestInventoryComponent.container;
|
|
6037
6069
|
* const chestCartContainer = chestCartInventoryComp.container;
|
|
6038
6070
|
*
|
|
6039
6071
|
* if (!xPlusTwoChestContainer || !xChestContainer || !chestCartContainer) {
|
|
6040
|
-
* log(
|
|
6072
|
+
* log('Could not retrieve chest containers.');
|
|
6041
6073
|
* return;
|
|
6042
6074
|
* }
|
|
6043
6075
|
*
|
|
6044
6076
|
* xPlusTwoChestContainer.setItem(0, new ItemStack(MinecraftItemTypes.Apple, 10));
|
|
6045
6077
|
* if (xPlusTwoChestContainer.getItem(0)?.typeId !== MinecraftItemTypes.Apple) {
|
|
6046
|
-
* log(
|
|
6078
|
+
* log('Expected apple in x+2 container slot index 0', -1);
|
|
6047
6079
|
* }
|
|
6048
6080
|
*
|
|
6049
6081
|
* xPlusTwoChestContainer.setItem(1, new ItemStack(MinecraftItemTypes.Emerald, 10));
|
|
6050
6082
|
* if (xPlusTwoChestContainer.getItem(1)?.typeId !== MinecraftItemTypes.Emerald) {
|
|
6051
|
-
* log(
|
|
6083
|
+
* log('Expected emerald in x+2 container slot index 1', -1);
|
|
6052
6084
|
* }
|
|
6053
6085
|
*
|
|
6054
6086
|
* if (xPlusTwoChestContainer.size !== 27) {
|
|
6055
|
-
* log(
|
|
6087
|
+
* log('Unexpected size: ' + xPlusTwoChestContainer.size, -1);
|
|
6056
6088
|
* }
|
|
6057
6089
|
*
|
|
6058
6090
|
* if (xPlusTwoChestContainer.emptySlotsCount !== 25) {
|
|
6059
|
-
* log(
|
|
6091
|
+
* log('Unexpected emptySlotsCount: ' + xPlusTwoChestContainer.emptySlotsCount, -1);
|
|
6060
6092
|
* }
|
|
6061
6093
|
*
|
|
6062
6094
|
* xChestContainer.setItem(0, new ItemStack(MinecraftItemTypes.Cake, 10));
|
|
@@ -6065,15 +6097,15 @@ export class Component {
|
|
|
6065
6097
|
* xPlusTwoChestContainer.swapItems(1, 0, xChestContainer); // swap the cake from x and the emerald from xPlusTwo
|
|
6066
6098
|
*
|
|
6067
6099
|
* if (chestCartContainer.getItem(0)?.typeId !== MinecraftItemTypes.Apple) {
|
|
6068
|
-
* log(
|
|
6100
|
+
* log('Expected apple in minecraft chest container slot index 0', -1);
|
|
6069
6101
|
* }
|
|
6070
6102
|
*
|
|
6071
6103
|
* if (xChestContainer.getItem(0)?.typeId === MinecraftItemTypes.Emerald) {
|
|
6072
|
-
* log(
|
|
6104
|
+
* log('Expected emerald in x container slot index 0', -1);
|
|
6073
6105
|
* }
|
|
6074
6106
|
*
|
|
6075
6107
|
* if (xPlusTwoChestContainer.getItem(1)?.typeId === MinecraftItemTypes.Cake) {
|
|
6076
|
-
* log(
|
|
6108
|
+
* log('Expected cake in x+2 container slot index 1', -1);
|
|
6077
6109
|
* }
|
|
6078
6110
|
* }
|
|
6079
6111
|
* ```
|
|
@@ -6221,7 +6253,7 @@ export class Container {
|
|
|
6221
6253
|
* out of bounds.
|
|
6222
6254
|
* @example getFirstHotbarItem.ts
|
|
6223
6255
|
* ```typescript
|
|
6224
|
-
* import { world, EntityInventoryComponent, DimensionLocation } from
|
|
6256
|
+
* import { world, EntityInventoryComponent, DimensionLocation } from '@minecraft/server';
|
|
6225
6257
|
*
|
|
6226
6258
|
* function getFirstHotbarItem(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
6227
6259
|
* for (const player of world.getAllPlayers()) {
|
|
@@ -6230,7 +6262,7 @@ export class Container {
|
|
|
6230
6262
|
* const firstItem = inventory.container.getItem(0);
|
|
6231
6263
|
*
|
|
6232
6264
|
* if (firstItem) {
|
|
6233
|
-
* log(
|
|
6265
|
+
* log('First item in hotbar is: ' + firstItem.typeId);
|
|
6234
6266
|
* }
|
|
6235
6267
|
*
|
|
6236
6268
|
* return inventory.container.getItem(0);
|
|
@@ -6282,12 +6314,10 @@ export class Container {
|
|
|
6282
6314
|
* {@link Error}
|
|
6283
6315
|
* @example moveBetweenContainers.ts
|
|
6284
6316
|
* ```typescript
|
|
6285
|
-
* import { world, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from
|
|
6286
|
-
* import { MinecraftEntityTypes } from
|
|
6317
|
+
* import { world, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
6318
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
6287
6319
|
*
|
|
6288
|
-
* function moveBetweenContainers(
|
|
6289
|
-
* targetLocation: DimensionLocation
|
|
6290
|
-
* ) {
|
|
6320
|
+
* function moveBetweenContainers(targetLocation: DimensionLocation) {
|
|
6291
6321
|
* const players = world.getAllPlayers();
|
|
6292
6322
|
*
|
|
6293
6323
|
* const chestCart = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.ChestMinecart, {
|
|
@@ -6381,12 +6411,10 @@ export class Container {
|
|
|
6381
6411
|
* {@link Error}
|
|
6382
6412
|
* @example transferBetweenContainers.ts
|
|
6383
6413
|
* ```typescript
|
|
6384
|
-
* import { world, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from
|
|
6385
|
-
* import { MinecraftEntityTypes } from
|
|
6414
|
+
* import { world, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
6415
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
6386
6416
|
*
|
|
6387
|
-
* function transferBetweenContainers(
|
|
6388
|
-
* targetLocation: DimensionLocation
|
|
6389
|
-
* ) {
|
|
6417
|
+
* function transferBetweenContainers(targetLocation: DimensionLocation) {
|
|
6390
6418
|
* const players = world.getAllPlayers();
|
|
6391
6419
|
*
|
|
6392
6420
|
* const chestCart = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.ChestMinecart, {
|
|
@@ -7004,7 +7032,6 @@ export class Dimension {
|
|
|
7004
7032
|
*/
|
|
7005
7033
|
readonly localizationKey: string;
|
|
7006
7034
|
/**
|
|
7007
|
-
* @rc
|
|
7008
7035
|
* @remarks
|
|
7009
7036
|
* Checks if an area contains the specified biomes. If the area
|
|
7010
7037
|
* is partially inside world boundaries, only the area that is
|
|
@@ -7092,42 +7119,39 @@ export class Dimension {
|
|
|
7092
7119
|
* {@link LocationOutOfWorldBoundariesError}
|
|
7093
7120
|
* @example createExplosion.ts
|
|
7094
7121
|
* ```typescript
|
|
7095
|
-
* import { DimensionLocation } from
|
|
7122
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
7096
7123
|
*
|
|
7097
7124
|
* function createExplosion(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7098
|
-
* log(
|
|
7125
|
+
* log('Creating an explosion of radius 10.');
|
|
7099
7126
|
* targetLocation.dimension.createExplosion(targetLocation, 10);
|
|
7100
7127
|
* }
|
|
7101
7128
|
* ```
|
|
7102
7129
|
* @example createNoBlockExplosion.ts
|
|
7103
7130
|
* ```typescript
|
|
7104
|
-
* import { DimensionLocation } from
|
|
7105
|
-
* import { Vector3Utils } from
|
|
7131
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
7132
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
7106
7133
|
*
|
|
7107
|
-
* function createNoBlockExplosion(
|
|
7108
|
-
* log: (message: string, status?: number) => void,
|
|
7109
|
-
* targetLocation: DimensionLocation
|
|
7110
|
-
* ) {
|
|
7134
|
+
* function createNoBlockExplosion(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7111
7135
|
* const explodeNoBlocksLoc = Vector3Utils.floor(Vector3Utils.add(targetLocation, { x: 1, y: 2, z: 1 }));
|
|
7112
7136
|
*
|
|
7113
|
-
* log(
|
|
7137
|
+
* log('Creating an explosion of radius 15 that does not break blocks.');
|
|
7114
7138
|
* targetLocation.dimension.createExplosion(explodeNoBlocksLoc, 15, { breaksBlocks: false });
|
|
7115
7139
|
* }
|
|
7116
7140
|
* ```
|
|
7117
7141
|
* @example createExplosions.ts
|
|
7118
7142
|
* ```typescript
|
|
7119
|
-
* import { DimensionLocation } from
|
|
7120
|
-
* import { Vector3Utils } from
|
|
7143
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
7144
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
7121
7145
|
*
|
|
7122
7146
|
* function createExplosions(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7123
7147
|
* const explosionLoc = Vector3Utils.add(targetLocation, { x: 0.5, y: 0.5, z: 0.5 });
|
|
7124
7148
|
*
|
|
7125
|
-
* log(
|
|
7149
|
+
* log('Creating an explosion of radius 15 that causes fire.');
|
|
7126
7150
|
* targetLocation.dimension.createExplosion(explosionLoc, 15, { causesFire: true });
|
|
7127
7151
|
*
|
|
7128
7152
|
* const belowWaterLoc = Vector3Utils.add(targetLocation, { x: 3, y: 1, z: 3 });
|
|
7129
7153
|
*
|
|
7130
|
-
* log(
|
|
7154
|
+
* log('Creating an explosion of radius 10 that can go underwater.');
|
|
7131
7155
|
* targetLocation.dimension.createExplosion(belowWaterLoc, 10, { allowUnderwater: true });
|
|
7132
7156
|
* }
|
|
7133
7157
|
* ```
|
|
@@ -7286,10 +7310,10 @@ export class Dimension {
|
|
|
7286
7310
|
* {@link minecraftcommon.InvalidArgumentError}
|
|
7287
7311
|
* @example bounceSkeletons.ts
|
|
7288
7312
|
* ```typescript
|
|
7289
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
7313
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
7290
7314
|
*
|
|
7291
7315
|
* function bounceSkeletons(targetLocation: DimensionLocation) {
|
|
7292
|
-
* const mobs = [
|
|
7316
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
7293
7317
|
*
|
|
7294
7318
|
* // create some sample mob data
|
|
7295
7319
|
* for (let i = 0; i < 10; i++) {
|
|
@@ -7297,7 +7321,7 @@ export class Dimension {
|
|
|
7297
7321
|
* }
|
|
7298
7322
|
*
|
|
7299
7323
|
* const eqo: EntityQueryOptions = {
|
|
7300
|
-
* type:
|
|
7324
|
+
* type: 'skeleton',
|
|
7301
7325
|
* };
|
|
7302
7326
|
*
|
|
7303
7327
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -7307,20 +7331,20 @@ export class Dimension {
|
|
|
7307
7331
|
* ```
|
|
7308
7332
|
* @example tagsQuery.ts
|
|
7309
7333
|
* ```typescript
|
|
7310
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
7334
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
7311
7335
|
*
|
|
7312
7336
|
* function tagsQuery(targetLocation: DimensionLocation) {
|
|
7313
|
-
* const mobs = [
|
|
7337
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
7314
7338
|
*
|
|
7315
7339
|
* // create some sample mob data
|
|
7316
7340
|
* for (let i = 0; i < 10; i++) {
|
|
7317
7341
|
* const mobTypeId = mobs[i % mobs.length];
|
|
7318
7342
|
* const entity = targetLocation.dimension.spawnEntity(mobTypeId, targetLocation);
|
|
7319
|
-
* entity.addTag(
|
|
7343
|
+
* entity.addTag('mobparty.' + mobTypeId);
|
|
7320
7344
|
* }
|
|
7321
7345
|
*
|
|
7322
7346
|
* const eqo: EntityQueryOptions = {
|
|
7323
|
-
* tags: [
|
|
7347
|
+
* tags: ['mobparty.skeleton'],
|
|
7324
7348
|
* };
|
|
7325
7349
|
*
|
|
7326
7350
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -7330,7 +7354,7 @@ export class Dimension {
|
|
|
7330
7354
|
* ```
|
|
7331
7355
|
* @example testThatEntityIsFeatherItem.ts
|
|
7332
7356
|
* ```typescript
|
|
7333
|
-
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from
|
|
7357
|
+
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
7334
7358
|
*
|
|
7335
7359
|
* function testThatEntityIsFeatherItem(
|
|
7336
7360
|
* log: (message: string, status?: number) => void,
|
|
@@ -7345,8 +7369,8 @@ export class Dimension {
|
|
|
7345
7369
|
* const itemComp = item.getComponent(EntityComponentTypes.Item) as EntityItemComponent;
|
|
7346
7370
|
*
|
|
7347
7371
|
* if (itemComp) {
|
|
7348
|
-
* if (itemComp.itemStack.typeId.endsWith(
|
|
7349
|
-
* log(
|
|
7372
|
+
* if (itemComp.itemStack.typeId.endsWith('feather')) {
|
|
7373
|
+
* log('Success! Found a feather', 1);
|
|
7350
7374
|
* }
|
|
7351
7375
|
* }
|
|
7352
7376
|
* }
|
|
@@ -7638,17 +7662,17 @@ export class Dimension {
|
|
|
7638
7662
|
* import { Vector3Utils } from '@minecraft/math';
|
|
7639
7663
|
*
|
|
7640
7664
|
* function spawnAdultHorse(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7641
|
-
*
|
|
7642
|
-
*
|
|
7643
|
-
*
|
|
7644
|
-
*
|
|
7645
|
-
*
|
|
7665
|
+
* log('Create a horse and triggering the ageable_grow_up event, ensuring the horse is created as an adult');
|
|
7666
|
+
* targetLocation.dimension.spawnEntity(
|
|
7667
|
+
* 'minecraft:horse<minecraft:ageable_grow_up>',
|
|
7668
|
+
* Vector3Utils.add(targetLocation, { x: 0, y: 1, z: 0 })
|
|
7669
|
+
* );
|
|
7646
7670
|
* }
|
|
7647
7671
|
* ```
|
|
7648
7672
|
* @example quickFoxLazyDog.ts
|
|
7649
7673
|
* ```typescript
|
|
7650
|
-
* import { DimensionLocation } from
|
|
7651
|
-
* import { MinecraftEntityTypes, MinecraftEffectTypes } from
|
|
7674
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
7675
|
+
* import { MinecraftEntityTypes, MinecraftEffectTypes } from '@minecraft/vanilla-data';
|
|
7652
7676
|
*
|
|
7653
7677
|
* function quickFoxLazyDog(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7654
7678
|
* const fox = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Fox, {
|
|
@@ -7660,7 +7684,7 @@ export class Dimension {
|
|
|
7660
7684
|
* fox.addEffect(MinecraftEffectTypes.Speed, 10, {
|
|
7661
7685
|
* amplifier: 2,
|
|
7662
7686
|
* });
|
|
7663
|
-
* log(
|
|
7687
|
+
* log('Created a fox.');
|
|
7664
7688
|
*
|
|
7665
7689
|
* const wolf = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Wolf, {
|
|
7666
7690
|
* x: targetLocation.x + 4,
|
|
@@ -7671,18 +7695,18 @@ export class Dimension {
|
|
|
7671
7695
|
* amplifier: 2,
|
|
7672
7696
|
* });
|
|
7673
7697
|
* wolf.isSneaking = true;
|
|
7674
|
-
* log(
|
|
7698
|
+
* log('Created a sneaking wolf.', 1);
|
|
7675
7699
|
* }
|
|
7676
7700
|
* ```
|
|
7677
7701
|
* @example triggerEvent.ts
|
|
7678
7702
|
* ```typescript
|
|
7679
|
-
* import { DimensionLocation } from
|
|
7680
|
-
* import { MinecraftEntityTypes } from
|
|
7703
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
7704
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
7681
7705
|
*
|
|
7682
7706
|
* function triggerEvent(targetLocation: DimensionLocation) {
|
|
7683
7707
|
* const creeper = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Creeper, targetLocation);
|
|
7684
7708
|
*
|
|
7685
|
-
* creeper.triggerEvent(
|
|
7709
|
+
* creeper.triggerEvent('minecraft:start_exploding_forced');
|
|
7686
7710
|
* }
|
|
7687
7711
|
* ```
|
|
7688
7712
|
*/
|
|
@@ -7705,8 +7729,8 @@ export class Dimension {
|
|
|
7705
7729
|
* {@link LocationOutOfWorldBoundariesError}
|
|
7706
7730
|
* @example itemStacks.ts
|
|
7707
7731
|
* ```typescript
|
|
7708
|
-
* import { ItemStack, DimensionLocation } from
|
|
7709
|
-
* import { MinecraftItemTypes } from
|
|
7732
|
+
* import { ItemStack, DimensionLocation } from '@minecraft/server';
|
|
7733
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
7710
7734
|
*
|
|
7711
7735
|
* function itemStacks(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7712
7736
|
* const oneItemLoc = { x: targetLocation.x + targetLocation.y + 3, y: 2, z: targetLocation.z + 1 };
|
|
@@ -7729,8 +7753,8 @@ export class Dimension {
|
|
|
7729
7753
|
* ```
|
|
7730
7754
|
* @example spawnFeatherItem.ts
|
|
7731
7755
|
* ```typescript
|
|
7732
|
-
* import { ItemStack, DimensionLocation } from
|
|
7733
|
-
* import { MinecraftItemTypes } from
|
|
7756
|
+
* import { ItemStack, DimensionLocation } from '@minecraft/server';
|
|
7757
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
7734
7758
|
*
|
|
7735
7759
|
* function spawnFeatherItem(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
7736
7760
|
* const featherItem = new ItemStack(MinecraftItemTypes.Feather, 1);
|
|
@@ -7762,20 +7786,20 @@ export class Dimension {
|
|
|
7762
7786
|
* {@link LocationOutOfWorldBoundariesError}
|
|
7763
7787
|
* @example spawnParticle.ts
|
|
7764
7788
|
* ```typescript
|
|
7765
|
-
* import { MolangVariableMap, DimensionLocation } from
|
|
7789
|
+
* import { MolangVariableMap, DimensionLocation } from '@minecraft/server';
|
|
7766
7790
|
*
|
|
7767
7791
|
* function spawnParticle(targetLocation: DimensionLocation) {
|
|
7768
7792
|
* for (let i = 0; i < 100; i++) {
|
|
7769
7793
|
* const molang = new MolangVariableMap();
|
|
7770
7794
|
*
|
|
7771
|
-
* molang.setColorRGB(
|
|
7795
|
+
* molang.setColorRGB('variable.color', { red: Math.random(), green: Math.random(), blue: Math.random() });
|
|
7772
7796
|
*
|
|
7773
7797
|
* const newLocation = {
|
|
7774
7798
|
* x: targetLocation.x + Math.floor(Math.random() * 8) - 4,
|
|
7775
7799
|
* y: targetLocation.y + Math.floor(Math.random() * 8) - 4,
|
|
7776
7800
|
* z: targetLocation.z + Math.floor(Math.random() * 8) - 4,
|
|
7777
7801
|
* };
|
|
7778
|
-
* targetLocation.dimension.spawnParticle(
|
|
7802
|
+
* targetLocation.dimension.spawnParticle('minecraft:colored_flame_particle', newLocation, molang);
|
|
7779
7803
|
* }
|
|
7780
7804
|
* }
|
|
7781
7805
|
* ```
|
|
@@ -8343,13 +8367,11 @@ export class Entity {
|
|
|
8343
8367
|
* {@link InvalidEntityError}
|
|
8344
8368
|
* @example spawnPoisonedVillager.ts
|
|
8345
8369
|
* ```typescript
|
|
8346
|
-
* import { DimensionLocation } from
|
|
8347
|
-
* import { MinecraftEffectTypes } from
|
|
8370
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
8371
|
+
* import { MinecraftEffectTypes } from '@minecraft/vanilla-data';
|
|
8348
8372
|
*
|
|
8349
|
-
* function spawnPoisonedVillager(
|
|
8350
|
-
*
|
|
8351
|
-
* ) {
|
|
8352
|
-
* const villagerType = "minecraft:villager_v2<minecraft:ageable_grow_up>";
|
|
8373
|
+
* function spawnPoisonedVillager(targetLocation: DimensionLocation) {
|
|
8374
|
+
* const villagerType = 'minecraft:villager_v2<minecraft:ageable_grow_up>';
|
|
8353
8375
|
* const villager = targetLocation.dimension.spawnEntity(villagerType, targetLocation);
|
|
8354
8376
|
* const duration = 20;
|
|
8355
8377
|
*
|
|
@@ -8358,8 +8380,8 @@ export class Entity {
|
|
|
8358
8380
|
* ```
|
|
8359
8381
|
* @example quickFoxLazyDog.ts
|
|
8360
8382
|
* ```typescript
|
|
8361
|
-
* import { DimensionLocation } from
|
|
8362
|
-
* import { MinecraftEntityTypes, MinecraftEffectTypes } from
|
|
8383
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
8384
|
+
* import { MinecraftEntityTypes, MinecraftEffectTypes } from '@minecraft/vanilla-data';
|
|
8363
8385
|
*
|
|
8364
8386
|
* function quickFoxLazyDog(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
8365
8387
|
* const fox = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Fox, {
|
|
@@ -8371,7 +8393,7 @@ export class Entity {
|
|
|
8371
8393
|
* fox.addEffect(MinecraftEffectTypes.Speed, 10, {
|
|
8372
8394
|
* amplifier: 2,
|
|
8373
8395
|
* });
|
|
8374
|
-
* log(
|
|
8396
|
+
* log('Created a fox.');
|
|
8375
8397
|
*
|
|
8376
8398
|
* const wolf = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Wolf, {
|
|
8377
8399
|
* x: targetLocation.x + 4,
|
|
@@ -8382,11 +8404,32 @@ export class Entity {
|
|
|
8382
8404
|
* amplifier: 2,
|
|
8383
8405
|
* });
|
|
8384
8406
|
* wolf.isSneaking = true;
|
|
8385
|
-
* log(
|
|
8407
|
+
* log('Created a sneaking wolf.', 1);
|
|
8386
8408
|
* }
|
|
8387
8409
|
* ```
|
|
8388
8410
|
*/
|
|
8389
8411
|
addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions): Effect | undefined;
|
|
8412
|
+
/**
|
|
8413
|
+
* @rc
|
|
8414
|
+
* @remarks
|
|
8415
|
+
* Adds an item to the entity's inventory.
|
|
8416
|
+
*
|
|
8417
|
+
* This function can't be called in restricted-execution mode.
|
|
8418
|
+
*
|
|
8419
|
+
* @returns
|
|
8420
|
+
* Returns undefined if the item was fully added or returns an
|
|
8421
|
+
* ItemStack with the remaining count.
|
|
8422
|
+
* @throws This function can throw errors.
|
|
8423
|
+
*
|
|
8424
|
+
* {@link ContainerRulesError}
|
|
8425
|
+
*
|
|
8426
|
+
* {@link Error}
|
|
8427
|
+
*
|
|
8428
|
+
* {@link InvalidEntityComponentError}
|
|
8429
|
+
*
|
|
8430
|
+
* {@link InvalidEntityError}
|
|
8431
|
+
*/
|
|
8432
|
+
addItem(itemStack: ItemStack): ItemStack | undefined;
|
|
8390
8433
|
/**
|
|
8391
8434
|
* @remarks
|
|
8392
8435
|
* Adds a specified tag to an entity.
|
|
@@ -8406,20 +8449,20 @@ export class Entity {
|
|
|
8406
8449
|
* {@link InvalidEntityError}
|
|
8407
8450
|
* @example tagsQuery.ts
|
|
8408
8451
|
* ```typescript
|
|
8409
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
8452
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
8410
8453
|
*
|
|
8411
8454
|
* function tagsQuery(targetLocation: DimensionLocation) {
|
|
8412
|
-
* const mobs = [
|
|
8455
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
8413
8456
|
*
|
|
8414
8457
|
* // create some sample mob data
|
|
8415
8458
|
* for (let i = 0; i < 10; i++) {
|
|
8416
8459
|
* const mobTypeId = mobs[i % mobs.length];
|
|
8417
8460
|
* const entity = targetLocation.dimension.spawnEntity(mobTypeId, targetLocation);
|
|
8418
|
-
* entity.addTag(
|
|
8461
|
+
* entity.addTag('mobparty.' + mobTypeId);
|
|
8419
8462
|
* }
|
|
8420
8463
|
*
|
|
8421
8464
|
* const eqo: EntityQueryOptions = {
|
|
8422
|
-
* tags: [
|
|
8465
|
+
* tags: ['mobparty.skeleton'],
|
|
8423
8466
|
* };
|
|
8424
8467
|
*
|
|
8425
8468
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -8454,22 +8497,19 @@ export class Entity {
|
|
|
8454
8497
|
* {@link minecraftcommon.UnsupportedFunctionalityError}
|
|
8455
8498
|
* @example applyDamageThenHeal.ts
|
|
8456
8499
|
* ```typescript
|
|
8457
|
-
* import { system, EntityHealthComponent, EntityComponentTypes, DimensionLocation } from
|
|
8458
|
-
* import { MinecraftEntityTypes } from
|
|
8500
|
+
* import { system, EntityHealthComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
8501
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
8459
8502
|
*
|
|
8460
|
-
* function applyDamageThenHeal(
|
|
8461
|
-
* log: (message: string, status?: number) => void,
|
|
8462
|
-
* targetLocation: DimensionLocation
|
|
8463
|
-
* ) {
|
|
8503
|
+
* function applyDamageThenHeal(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
8464
8504
|
* const skelly = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Skeleton, targetLocation);
|
|
8465
8505
|
*
|
|
8466
8506
|
* skelly.applyDamage(19); // skeletons have max damage of 20 so this is a near-death skeleton
|
|
8467
8507
|
*
|
|
8468
8508
|
* system.runTimeout(() => {
|
|
8469
8509
|
* const health = skelly.getComponent(EntityComponentTypes.Health) as EntityHealthComponent;
|
|
8470
|
-
* log(
|
|
8510
|
+
* log('Skeleton health before heal: ' + health?.currentValue);
|
|
8471
8511
|
* health?.resetToMaxValue();
|
|
8472
|
-
* log(
|
|
8512
|
+
* log('Skeleton health after heal: ' + health?.currentValue);
|
|
8473
8513
|
* }, 20);
|
|
8474
8514
|
* }
|
|
8475
8515
|
* ```
|
|
@@ -8491,8 +8531,8 @@ export class Entity {
|
|
|
8491
8531
|
* {@link InvalidEntityError}
|
|
8492
8532
|
* @example applyImpulse.ts
|
|
8493
8533
|
* ```typescript
|
|
8494
|
-
* import { DimensionLocation } from
|
|
8495
|
-
* import { MinecraftEntityTypes } from
|
|
8534
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
8535
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
8496
8536
|
*
|
|
8497
8537
|
* function applyImpulse(targetLocation: DimensionLocation) {
|
|
8498
8538
|
* const zombie = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Zombie, targetLocation);
|
|
@@ -8521,10 +8561,10 @@ export class Entity {
|
|
|
8521
8561
|
* {@link minecraftcommon.UnsupportedFunctionalityError}
|
|
8522
8562
|
* @example bounceSkeletons.ts
|
|
8523
8563
|
* ```typescript
|
|
8524
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
8564
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
8525
8565
|
*
|
|
8526
8566
|
* function bounceSkeletons(targetLocation: DimensionLocation) {
|
|
8527
|
-
* const mobs = [
|
|
8567
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
8528
8568
|
*
|
|
8529
8569
|
* // create some sample mob data
|
|
8530
8570
|
* for (let i = 0; i < 10; i++) {
|
|
@@ -8532,7 +8572,7 @@ export class Entity {
|
|
|
8532
8572
|
* }
|
|
8533
8573
|
*
|
|
8534
8574
|
* const eqo: EntityQueryOptions = {
|
|
8535
|
-
* type:
|
|
8575
|
+
* type: 'skeleton',
|
|
8536
8576
|
* };
|
|
8537
8577
|
*
|
|
8538
8578
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -8563,8 +8603,8 @@ export class Entity {
|
|
|
8563
8603
|
* {@link InvalidEntityError}
|
|
8564
8604
|
* @example applyImpulse.ts
|
|
8565
8605
|
* ```typescript
|
|
8566
|
-
* import { DimensionLocation } from
|
|
8567
|
-
* import { MinecraftEntityTypes } from
|
|
8606
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
8607
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
8568
8608
|
*
|
|
8569
8609
|
* function applyImpulse(targetLocation: DimensionLocation) {
|
|
8570
8610
|
* const zombie = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Zombie, targetLocation);
|
|
@@ -8596,8 +8636,8 @@ export class Entity {
|
|
|
8596
8636
|
* {@link InvalidEntityError}
|
|
8597
8637
|
* @example setOnFire.ts
|
|
8598
8638
|
* ```typescript
|
|
8599
|
-
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from
|
|
8600
|
-
* import { MinecraftEntityTypes } from
|
|
8639
|
+
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
8640
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
8601
8641
|
*
|
|
8602
8642
|
* function setOnFire(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
8603
8643
|
* const skelly = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Skeleton, targetLocation);
|
|
@@ -8606,10 +8646,10 @@ export class Entity {
|
|
|
8606
8646
|
*
|
|
8607
8647
|
* system.runTimeout(() => {
|
|
8608
8648
|
* const onfire = skelly.getComponent(EntityComponentTypes.OnFire) as EntityOnFireComponent;
|
|
8609
|
-
* log(onfire?.onFireTicksRemaining +
|
|
8649
|
+
* log(onfire?.onFireTicksRemaining + ' fire ticks remaining.');
|
|
8610
8650
|
*
|
|
8611
8651
|
* skelly.extinguishFire(true);
|
|
8612
|
-
* log(
|
|
8652
|
+
* log('Never mind. Fire extinguished.');
|
|
8613
8653
|
* }, 20);
|
|
8614
8654
|
* }
|
|
8615
8655
|
* ```
|
|
@@ -8859,19 +8899,16 @@ export class Entity {
|
|
|
8859
8899
|
* {@link InvalidEntityError}
|
|
8860
8900
|
* @example getFireworkVelocity.ts
|
|
8861
8901
|
* ```typescript
|
|
8862
|
-
* import { system, DimensionLocation } from
|
|
8863
|
-
* import { MinecraftEntityTypes } from
|
|
8902
|
+
* import { system, DimensionLocation } from '@minecraft/server';
|
|
8903
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
8864
8904
|
*
|
|
8865
|
-
* function getFireworkVelocity(
|
|
8866
|
-
* log: (message: string, status?: number) => void,
|
|
8867
|
-
* targetLocation: DimensionLocation
|
|
8868
|
-
* ) {
|
|
8905
|
+
* function getFireworkVelocity(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
8869
8906
|
* const fireworkRocket = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.FireworksRocket, targetLocation);
|
|
8870
8907
|
*
|
|
8871
8908
|
* system.runTimeout(() => {
|
|
8872
8909
|
* const velocity = fireworkRocket.getVelocity();
|
|
8873
8910
|
*
|
|
8874
|
-
* log(
|
|
8911
|
+
* log('Velocity of firework is: (x: ' + velocity.x + ', y:' + velocity.y + ', z:' + velocity.z + ')');
|
|
8875
8912
|
* }, 5);
|
|
8876
8913
|
* }
|
|
8877
8914
|
* ```
|
|
@@ -8932,20 +8969,20 @@ export class Entity {
|
|
|
8932
8969
|
* {@link InvalidEntityError}
|
|
8933
8970
|
* @example tagsQuery.ts
|
|
8934
8971
|
* ```typescript
|
|
8935
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
8972
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
8936
8973
|
*
|
|
8937
8974
|
* function tagsQuery(targetLocation: DimensionLocation) {
|
|
8938
|
-
* const mobs = [
|
|
8975
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
8939
8976
|
*
|
|
8940
8977
|
* // create some sample mob data
|
|
8941
8978
|
* for (let i = 0; i < 10; i++) {
|
|
8942
8979
|
* const mobTypeId = mobs[i % mobs.length];
|
|
8943
8980
|
* const entity = targetLocation.dimension.spawnEntity(mobTypeId, targetLocation);
|
|
8944
|
-
* entity.addTag(
|
|
8981
|
+
* entity.addTag('mobparty.' + mobTypeId);
|
|
8945
8982
|
* }
|
|
8946
8983
|
*
|
|
8947
8984
|
* const eqo: EntityQueryOptions = {
|
|
8948
|
-
* tags: [
|
|
8985
|
+
* tags: ['mobparty.skeleton'],
|
|
8949
8986
|
* };
|
|
8950
8987
|
*
|
|
8951
8988
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -9159,8 +9196,8 @@ export class Entity {
|
|
|
9159
9196
|
* {@link InvalidEntityError}
|
|
9160
9197
|
* @example setOnFire.ts
|
|
9161
9198
|
* ```typescript
|
|
9162
|
-
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from
|
|
9163
|
-
* import { MinecraftEntityTypes } from
|
|
9199
|
+
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
9200
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
9164
9201
|
*
|
|
9165
9202
|
* function setOnFire(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
9166
9203
|
* const skelly = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Skeleton, targetLocation);
|
|
@@ -9169,10 +9206,10 @@ export class Entity {
|
|
|
9169
9206
|
*
|
|
9170
9207
|
* system.runTimeout(() => {
|
|
9171
9208
|
* const onfire = skelly.getComponent(EntityComponentTypes.OnFire) as EntityOnFireComponent;
|
|
9172
|
-
* log(onfire?.onFireTicksRemaining +
|
|
9209
|
+
* log(onfire?.onFireTicksRemaining + ' fire ticks remaining.');
|
|
9173
9210
|
*
|
|
9174
9211
|
* skelly.extinguishFire(true);
|
|
9175
|
-
* log(
|
|
9212
|
+
* log('Never mind. Fire extinguished.');
|
|
9176
9213
|
* }, 20);
|
|
9177
9214
|
* }
|
|
9178
9215
|
* ```
|
|
@@ -9239,8 +9276,8 @@ export class Entity {
|
|
|
9239
9276
|
* {@link minecraftcommon.UnsupportedFunctionalityError}
|
|
9240
9277
|
* @example teleport.ts
|
|
9241
9278
|
* ```typescript
|
|
9242
|
-
* import { system, DimensionLocation } from
|
|
9243
|
-
* import { MinecraftEntityTypes } from
|
|
9279
|
+
* import { system, DimensionLocation } from '@minecraft/server';
|
|
9280
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
9244
9281
|
*
|
|
9245
9282
|
* function teleport(targetLocation: DimensionLocation) {
|
|
9246
9283
|
* const cow = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Cow, targetLocation);
|
|
@@ -9257,8 +9294,8 @@ export class Entity {
|
|
|
9257
9294
|
* ```
|
|
9258
9295
|
* @example teleportMovement.ts
|
|
9259
9296
|
* ```typescript
|
|
9260
|
-
* import { system, DimensionLocation } from
|
|
9261
|
-
* import { MinecraftEntityTypes } from
|
|
9297
|
+
* import { system, DimensionLocation } from '@minecraft/server';
|
|
9298
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
9262
9299
|
*
|
|
9263
9300
|
* function teleportMovement(targetLocation: DimensionLocation) {
|
|
9264
9301
|
* const pig = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Pig, targetLocation);
|
|
@@ -9307,20 +9344,20 @@ export class Entity {
|
|
|
9307
9344
|
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
9308
9345
|
*
|
|
9309
9346
|
* function spawnExplodingCreeper(location: DimensionLocation) {
|
|
9310
|
-
*
|
|
9347
|
+
* const creeper = location.dimension.spawnEntity(MinecraftEntityTypes.Creeper, location);
|
|
9311
9348
|
*
|
|
9312
|
-
*
|
|
9349
|
+
* creeper.triggerEvent('minecraft:start_exploding_forced');
|
|
9313
9350
|
* }
|
|
9314
9351
|
* ```
|
|
9315
9352
|
* @example triggerEvent.ts
|
|
9316
9353
|
* ```typescript
|
|
9317
|
-
* import { DimensionLocation } from
|
|
9318
|
-
* import { MinecraftEntityTypes } from
|
|
9354
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
9355
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
9319
9356
|
*
|
|
9320
9357
|
* function triggerEvent(targetLocation: DimensionLocation) {
|
|
9321
9358
|
* const creeper = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Creeper, targetLocation);
|
|
9322
9359
|
*
|
|
9323
|
-
* creeper.triggerEvent(
|
|
9360
|
+
* creeper.triggerEvent('minecraft:start_exploding_forced');
|
|
9324
9361
|
* }
|
|
9325
9362
|
* ```
|
|
9326
9363
|
*/
|
|
@@ -9717,7 +9754,6 @@ export class EntityDefinitionFeedItem {
|
|
|
9717
9754
|
*/
|
|
9718
9755
|
readonly item: string;
|
|
9719
9756
|
/**
|
|
9720
|
-
* @rc
|
|
9721
9757
|
* @remarks
|
|
9722
9758
|
* Type ID of the resulting item after feeding has occurred.
|
|
9723
9759
|
* This will usually be empty but is used for scenarios such as
|
|
@@ -9798,10 +9834,10 @@ export class EntityDieAfterEventSignal {
|
|
|
9798
9834
|
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
9799
9835
|
*
|
|
9800
9836
|
* function giveEquipment(player: Player) {
|
|
9801
|
-
*
|
|
9802
|
-
*
|
|
9803
|
-
*
|
|
9804
|
-
*
|
|
9837
|
+
* const equipmentCompPlayer = player.getComponent(EntityComponentTypes.Equippable);
|
|
9838
|
+
* if (equipmentCompPlayer) {
|
|
9839
|
+
* equipmentCompPlayer.setEquipment(EquipmentSlot.Chest, new ItemStack(MinecraftItemTypes.Elytra));
|
|
9840
|
+
* }
|
|
9805
9841
|
* }
|
|
9806
9842
|
* ```
|
|
9807
9843
|
*/
|
|
@@ -9990,7 +10026,6 @@ export class EntityHealableComponent extends EntityComponent {
|
|
|
9990
10026
|
}
|
|
9991
10027
|
|
|
9992
10028
|
/**
|
|
9993
|
-
* @rc
|
|
9994
10029
|
* Contains information related to an entity having been
|
|
9995
10030
|
* healed.
|
|
9996
10031
|
*/
|
|
@@ -10017,7 +10052,6 @@ export class EntityHealAfterEvent {
|
|
|
10017
10052
|
}
|
|
10018
10053
|
|
|
10019
10054
|
/**
|
|
10020
|
-
* @rc
|
|
10021
10055
|
* Manages callbacks that are connected to when an entity is
|
|
10022
10056
|
* healed.
|
|
10023
10057
|
*/
|
|
@@ -10051,7 +10085,6 @@ export class EntityHealAfterEventSignal {
|
|
|
10051
10085
|
}
|
|
10052
10086
|
|
|
10053
10087
|
/**
|
|
10054
|
-
* @rc
|
|
10055
10088
|
* Contains information related to an entity that will be
|
|
10056
10089
|
* healed.
|
|
10057
10090
|
*/
|
|
@@ -10079,7 +10112,6 @@ export class EntityHealBeforeEvent {
|
|
|
10079
10112
|
}
|
|
10080
10113
|
|
|
10081
10114
|
/**
|
|
10082
|
-
* @rc
|
|
10083
10115
|
* Manages callbacks that are connected to when an entity will
|
|
10084
10116
|
* be healed.
|
|
10085
10117
|
*/
|
|
@@ -10119,7 +10151,6 @@ export class EntityHealBeforeEventSignal {
|
|
|
10119
10151
|
}
|
|
10120
10152
|
|
|
10121
10153
|
/**
|
|
10122
|
-
* @rc
|
|
10123
10154
|
* Provides information about how healing has been applied to
|
|
10124
10155
|
* an entity.
|
|
10125
10156
|
*/
|
|
@@ -10197,22 +10228,19 @@ export class EntityHealthChangedAfterEventSignal {
|
|
|
10197
10228
|
* Defines the health properties of an entity.
|
|
10198
10229
|
* @example applyDamageThenHeal.ts
|
|
10199
10230
|
* ```typescript
|
|
10200
|
-
* import { system, EntityHealthComponent, EntityComponentTypes, DimensionLocation } from
|
|
10201
|
-
* import { MinecraftEntityTypes } from
|
|
10231
|
+
* import { system, EntityHealthComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
10232
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
10202
10233
|
*
|
|
10203
|
-
* function applyDamageThenHeal(
|
|
10204
|
-
* log: (message: string, status?: number) => void,
|
|
10205
|
-
* targetLocation: DimensionLocation
|
|
10206
|
-
* ) {
|
|
10234
|
+
* function applyDamageThenHeal(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
10207
10235
|
* const skelly = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Skeleton, targetLocation);
|
|
10208
10236
|
*
|
|
10209
10237
|
* skelly.applyDamage(19); // skeletons have max damage of 20 so this is a near-death skeleton
|
|
10210
10238
|
*
|
|
10211
10239
|
* system.runTimeout(() => {
|
|
10212
10240
|
* const health = skelly.getComponent(EntityComponentTypes.Health) as EntityHealthComponent;
|
|
10213
|
-
* log(
|
|
10241
|
+
* log('Skeleton health before heal: ' + health?.currentValue);
|
|
10214
10242
|
* health?.resetToMaxValue();
|
|
10215
|
-
* log(
|
|
10243
|
+
* log('Skeleton health after heal: ' + health?.currentValue);
|
|
10216
10244
|
* }, 20);
|
|
10217
10245
|
* }
|
|
10218
10246
|
* ```
|
|
@@ -10377,7 +10405,6 @@ export class EntityHurtAfterEvent {
|
|
|
10377
10405
|
}
|
|
10378
10406
|
|
|
10379
10407
|
/**
|
|
10380
|
-
* @rc
|
|
10381
10408
|
* Manages callbacks that are connected to when an entity is
|
|
10382
10409
|
* hurt.
|
|
10383
10410
|
*/
|
|
@@ -10409,7 +10436,6 @@ export class EntityHurtAfterEventSignal {
|
|
|
10409
10436
|
}
|
|
10410
10437
|
|
|
10411
10438
|
/**
|
|
10412
|
-
* @rc
|
|
10413
10439
|
* Contains information related to an entity that will be hurt.
|
|
10414
10440
|
*/
|
|
10415
10441
|
export class EntityHurtBeforeEvent {
|
|
@@ -10437,7 +10463,6 @@ export class EntityHurtBeforeEvent {
|
|
|
10437
10463
|
}
|
|
10438
10464
|
|
|
10439
10465
|
/**
|
|
10440
|
-
* @rc
|
|
10441
10466
|
* Manages callbacks that are connected to when an entity will
|
|
10442
10467
|
* be hurt.
|
|
10443
10468
|
*/
|
|
@@ -10677,7 +10702,7 @@ export class EntityIsTamedComponent extends EntityComponent {
|
|
|
10677
10702
|
* property.
|
|
10678
10703
|
* @example testThatEntityIsFeatherItem.ts
|
|
10679
10704
|
* ```typescript
|
|
10680
|
-
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from
|
|
10705
|
+
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
10681
10706
|
*
|
|
10682
10707
|
* function testThatEntityIsFeatherItem(
|
|
10683
10708
|
* log: (message: string, status?: number) => void,
|
|
@@ -10692,8 +10717,8 @@ export class EntityIsTamedComponent extends EntityComponent {
|
|
|
10692
10717
|
* const itemComp = item.getComponent(EntityComponentTypes.Item) as EntityItemComponent;
|
|
10693
10718
|
*
|
|
10694
10719
|
* if (itemComp) {
|
|
10695
|
-
* if (itemComp.itemStack.typeId.endsWith(
|
|
10696
|
-
* log(
|
|
10720
|
+
* if (itemComp.itemStack.typeId.endsWith('feather')) {
|
|
10721
|
+
* log('Success! Found a feather', 1);
|
|
10697
10722
|
* }
|
|
10698
10723
|
* }
|
|
10699
10724
|
* }
|
|
@@ -10714,7 +10739,6 @@ export class EntityItemComponent extends EntityComponent {
|
|
|
10714
10739
|
}
|
|
10715
10740
|
|
|
10716
10741
|
/**
|
|
10717
|
-
* @rc
|
|
10718
10742
|
* Contains information related to an entity having dropped
|
|
10719
10743
|
* items.
|
|
10720
10744
|
*/
|
|
@@ -10735,7 +10759,6 @@ export class EntityItemDropAfterEvent {
|
|
|
10735
10759
|
}
|
|
10736
10760
|
|
|
10737
10761
|
/**
|
|
10738
|
-
* @rc
|
|
10739
10762
|
* Manages callbacks that are connected to when an entity has
|
|
10740
10763
|
* dropped items.
|
|
10741
10764
|
*/
|
|
@@ -10769,7 +10792,6 @@ export class EntityItemDropAfterEventSignal {
|
|
|
10769
10792
|
}
|
|
10770
10793
|
|
|
10771
10794
|
/**
|
|
10772
|
-
* @rc
|
|
10773
10795
|
* Contains information related to an entity having picked up
|
|
10774
10796
|
* items.
|
|
10775
10797
|
*/
|
|
@@ -10790,7 +10812,6 @@ export class EntityItemPickupAfterEvent {
|
|
|
10790
10812
|
}
|
|
10791
10813
|
|
|
10792
10814
|
/**
|
|
10793
|
-
* @rc
|
|
10794
10815
|
* Manages callbacks that are connected to when an entity has
|
|
10795
10816
|
* picked up items.
|
|
10796
10817
|
*/
|
|
@@ -10824,7 +10845,6 @@ export class EntityItemPickupAfterEventSignal {
|
|
|
10824
10845
|
}
|
|
10825
10846
|
|
|
10826
10847
|
/**
|
|
10827
|
-
* @rc
|
|
10828
10848
|
* Contains information related to an entity picking up an
|
|
10829
10849
|
* item.
|
|
10830
10850
|
*/
|
|
@@ -10851,7 +10871,6 @@ export class EntityItemPickupBeforeEvent {
|
|
|
10851
10871
|
}
|
|
10852
10872
|
|
|
10853
10873
|
/**
|
|
10854
|
-
* @rc
|
|
10855
10874
|
* Manages callbacks that are connected to when an entity will
|
|
10856
10875
|
* pick up an item.
|
|
10857
10876
|
*/
|
|
@@ -11415,8 +11434,8 @@ export class EntityNavigationWalkComponent extends EntityNavigationComponent {
|
|
|
11415
11434
|
* When present on an entity, this entity is on fire.
|
|
11416
11435
|
* @example setOnFire.ts
|
|
11417
11436
|
* ```typescript
|
|
11418
|
-
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from
|
|
11419
|
-
* import { MinecraftEntityTypes } from
|
|
11437
|
+
* import { system, EntityOnFireComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
11438
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
11420
11439
|
*
|
|
11421
11440
|
* function setOnFire(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
11422
11441
|
* const skelly = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Skeleton, targetLocation);
|
|
@@ -11425,10 +11444,10 @@ export class EntityNavigationWalkComponent extends EntityNavigationComponent {
|
|
|
11425
11444
|
*
|
|
11426
11445
|
* system.runTimeout(() => {
|
|
11427
11446
|
* const onfire = skelly.getComponent(EntityComponentTypes.OnFire) as EntityOnFireComponent;
|
|
11428
|
-
* log(onfire?.onFireTicksRemaining +
|
|
11447
|
+
* log(onfire?.onFireTicksRemaining + ' fire ticks remaining.');
|
|
11429
11448
|
*
|
|
11430
11449
|
* skelly.extinguishFire(true);
|
|
11431
|
-
* log(
|
|
11450
|
+
* log('Never mind. Fire extinguished.');
|
|
11432
11451
|
* }, 20);
|
|
11433
11452
|
* }
|
|
11434
11453
|
* ```
|
|
@@ -11453,18 +11472,18 @@ export class EntityOnFireComponent extends EntityComponent {
|
|
|
11453
11472
|
* minecraft:projectile component.
|
|
11454
11473
|
* @example shootArrow.ts
|
|
11455
11474
|
* ```typescript
|
|
11456
|
-
* import { DimensionLocation, EntityProjectileComponent } from
|
|
11475
|
+
* import { DimensionLocation, EntityProjectileComponent } from '@minecraft/server';
|
|
11457
11476
|
*
|
|
11458
11477
|
* function shootArrow(targetLocation: DimensionLocation) {
|
|
11459
11478
|
* const velocity = { x: 0, y: 1, z: 5 };
|
|
11460
11479
|
*
|
|
11461
|
-
* const arrow = targetLocation.dimension.spawnEntity(
|
|
11480
|
+
* const arrow = targetLocation.dimension.spawnEntity('minecraft:arrow', {
|
|
11462
11481
|
* x: targetLocation.x,
|
|
11463
11482
|
* y: targetLocation.y + 2,
|
|
11464
11483
|
* z: targetLocation.z,
|
|
11465
11484
|
* });
|
|
11466
11485
|
*
|
|
11467
|
-
* const projectileComp = arrow.getComponent(
|
|
11486
|
+
* const projectileComp = arrow.getComponent('minecraft:projectile') as EntityProjectileComponent;
|
|
11468
11487
|
*
|
|
11469
11488
|
* projectileComp?.shoot(velocity);
|
|
11470
11489
|
* }
|
|
@@ -11763,9 +11782,9 @@ export class EntityRemoveBeforeEventSignal {
|
|
|
11763
11782
|
* entity can be ridden by another entity.
|
|
11764
11783
|
* @example minibiomes.ts
|
|
11765
11784
|
* ```typescript
|
|
11766
|
-
* import { EntityComponentTypes } from
|
|
11767
|
-
* import { Test, register } from
|
|
11768
|
-
* import { MinecraftBlockTypes, MinecraftEntityTypes } from
|
|
11785
|
+
* import { EntityComponentTypes } from '@minecraft/server';
|
|
11786
|
+
* import { Test, register } from '@minecraft/server-gametest';
|
|
11787
|
+
* import { MinecraftBlockTypes, MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
11769
11788
|
*
|
|
11770
11789
|
* function minibiomes(test: Test) {
|
|
11771
11790
|
* const minecart = test.spawn(MinecraftEntityTypes.Minecart, { x: 9, y: 7, z: 7 });
|
|
@@ -11779,7 +11798,7 @@ export class EntityRemoveBeforeEventSignal {
|
|
|
11779
11798
|
*
|
|
11780
11799
|
* test.succeedWhenEntityPresent(MinecraftEntityTypes.Pig, { x: 8, y: 3, z: 1 }, true);
|
|
11781
11800
|
* }
|
|
11782
|
-
* register(
|
|
11801
|
+
* register('ChallengeTests', 'minibiomes', minibiomes).structureName('gametests:minibiomes').maxTicks(160);
|
|
11783
11802
|
* ```
|
|
11784
11803
|
*/
|
|
11785
11804
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
@@ -11854,9 +11873,9 @@ export class EntityRideableComponent extends EntityComponent {
|
|
|
11854
11873
|
* @throws This function can throw errors.
|
|
11855
11874
|
* @example minibiomes.ts
|
|
11856
11875
|
* ```typescript
|
|
11857
|
-
* import { EntityComponentTypes } from
|
|
11858
|
-
* import { Test, register } from
|
|
11859
|
-
* import { MinecraftBlockTypes, MinecraftEntityTypes } from
|
|
11876
|
+
* import { EntityComponentTypes } from '@minecraft/server';
|
|
11877
|
+
* import { Test, register } from '@minecraft/server-gametest';
|
|
11878
|
+
* import { MinecraftBlockTypes, MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
11860
11879
|
*
|
|
11861
11880
|
* function minibiomes(test: Test) {
|
|
11862
11881
|
* const minecart = test.spawn(MinecraftEntityTypes.Minecart, { x: 9, y: 7, z: 7 });
|
|
@@ -11870,7 +11889,7 @@ export class EntityRideableComponent extends EntityComponent {
|
|
|
11870
11889
|
*
|
|
11871
11890
|
* test.succeedWhenEntityPresent(MinecraftEntityTypes.Pig, { x: 8, y: 3, z: 1 }, true);
|
|
11872
11891
|
* }
|
|
11873
|
-
* register(
|
|
11892
|
+
* register('ChallengeTests', 'minibiomes', minibiomes).structureName('gametests:minibiomes').maxTicks(160);
|
|
11874
11893
|
* ```
|
|
11875
11894
|
*/
|
|
11876
11895
|
addRider(rider: Entity): boolean;
|
|
@@ -11985,13 +12004,10 @@ export class EntitySkinIdComponent extends EntityComponent {
|
|
|
11985
12004
|
* world.
|
|
11986
12005
|
* @example logEntitySpawnEvent.ts
|
|
11987
12006
|
* ```typescript
|
|
11988
|
-
* import { world, system, EntitySpawnAfterEvent, DimensionLocation } from
|
|
11989
|
-
* import { Vector3Utils } from
|
|
12007
|
+
* import { world, system, EntitySpawnAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
12008
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
11990
12009
|
*
|
|
11991
|
-
* function logEntitySpawnEvent(
|
|
11992
|
-
* log: (message: string, status?: number) => void,
|
|
11993
|
-
* targetLocation: DimensionLocation
|
|
11994
|
-
* ) {
|
|
12010
|
+
* function logEntitySpawnEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
11995
12011
|
* // register a new function that is called when a new entity is created.
|
|
11996
12012
|
* world.afterEvents.entitySpawn.subscribe((entityEvent: EntitySpawnAfterEvent) => {
|
|
11997
12013
|
* if (entityEvent && entityEvent.entity) {
|
|
@@ -12003,7 +12019,7 @@ export class EntitySkinIdComponent extends EntityComponent {
|
|
|
12003
12019
|
*
|
|
12004
12020
|
* system.runTimeout(() => {
|
|
12005
12021
|
* targetLocation.dimension.spawnEntity(
|
|
12006
|
-
*
|
|
12022
|
+
* 'minecraft:horse<minecraft:ageable_grow_up>',
|
|
12007
12023
|
* Vector3Utils.add(targetLocation, { x: 0, y: 1, z: 0 })
|
|
12008
12024
|
* );
|
|
12009
12025
|
* }, 20);
|
|
@@ -12047,13 +12063,10 @@ export class EntitySpawnAfterEventSignal {
|
|
|
12047
12063
|
* Function that handles the spawn event.
|
|
12048
12064
|
* @example logEntitySpawnEvent.ts
|
|
12049
12065
|
* ```typescript
|
|
12050
|
-
* import { world, system, EntitySpawnAfterEvent, DimensionLocation } from
|
|
12051
|
-
* import { Vector3Utils } from
|
|
12066
|
+
* import { world, system, EntitySpawnAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
12067
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
12052
12068
|
*
|
|
12053
|
-
* function logEntitySpawnEvent(
|
|
12054
|
-
* log: (message: string, status?: number) => void,
|
|
12055
|
-
* targetLocation: DimensionLocation
|
|
12056
|
-
* ) {
|
|
12069
|
+
* function logEntitySpawnEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
12057
12070
|
* // register a new function that is called when a new entity is created.
|
|
12058
12071
|
* world.afterEvents.entitySpawn.subscribe((entityEvent: EntitySpawnAfterEvent) => {
|
|
12059
12072
|
* if (entityEvent && entityEvent.entity) {
|
|
@@ -12065,7 +12078,7 @@ export class EntitySpawnAfterEventSignal {
|
|
|
12065
12078
|
*
|
|
12066
12079
|
* system.runTimeout(() => {
|
|
12067
12080
|
* targetLocation.dimension.spawnEntity(
|
|
12068
|
-
*
|
|
12081
|
+
* 'minecraft:horse<minecraft:ageable_grow_up>',
|
|
12069
12082
|
* Vector3Utils.add(targetLocation, { x: 0, y: 1, z: 0 })
|
|
12070
12083
|
* );
|
|
12071
12084
|
* }, 20);
|
|
@@ -12255,7 +12268,6 @@ export class EntityType {
|
|
|
12255
12268
|
*/
|
|
12256
12269
|
readonly id: string;
|
|
12257
12270
|
/**
|
|
12258
|
-
* @rc
|
|
12259
12271
|
* @remarks
|
|
12260
12272
|
* Key for the localization of this EntityType's name used in
|
|
12261
12273
|
* .lang files.
|
|
@@ -12500,7 +12512,6 @@ export class FeedItem {
|
|
|
12500
12512
|
*/
|
|
12501
12513
|
readonly item: string;
|
|
12502
12514
|
/**
|
|
12503
|
-
* @rc
|
|
12504
12515
|
* @remarks
|
|
12505
12516
|
* Type ID of the resulting item after feeding has occurred.
|
|
12506
12517
|
* This will usually be empty but is used for scenarios such as
|
|
@@ -13514,12 +13525,18 @@ export class ItemCustomComponentInstance extends ItemComponent {
|
|
|
13514
13525
|
* to data-driven items.
|
|
13515
13526
|
* @example giveHurtDiamondSword.ts
|
|
13516
13527
|
* ```typescript
|
|
13517
|
-
* import {
|
|
13518
|
-
*
|
|
13528
|
+
* import {
|
|
13529
|
+
* world,
|
|
13530
|
+
* ItemStack,
|
|
13531
|
+
* EntityInventoryComponent,
|
|
13532
|
+
* EntityComponentTypes,
|
|
13533
|
+
* ItemComponentTypes,
|
|
13534
|
+
* ItemDurabilityComponent,
|
|
13535
|
+
* DimensionLocation,
|
|
13536
|
+
* } from '@minecraft/server';
|
|
13537
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
13519
13538
|
*
|
|
13520
|
-
* function giveHurtDiamondSword(
|
|
13521
|
-
* targetLocation: DimensionLocation
|
|
13522
|
-
* ) {
|
|
13539
|
+
* function giveHurtDiamondSword(targetLocation: DimensionLocation) {
|
|
13523
13540
|
* const hurtDiamondSword = new ItemStack(MinecraftItemTypes.DiamondSword);
|
|
13524
13541
|
*
|
|
13525
13542
|
* const durabilityComponent = hurtDiamondSword.getComponent(ItemComponentTypes.Durability) as ItemDurabilityComponent;
|
|
@@ -13557,7 +13574,6 @@ export class ItemDurabilityComponent extends ItemComponent {
|
|
|
13557
13574
|
*/
|
|
13558
13575
|
readonly maxDurability: number;
|
|
13559
13576
|
/**
|
|
13560
|
-
* @rc
|
|
13561
13577
|
* @remarks
|
|
13562
13578
|
* Whether an item breaks or loses durability. Setting to true
|
|
13563
13579
|
* temporarily removes item's durability HUD, and freezes
|
|
@@ -13942,8 +13958,8 @@ export class ItemReleaseUseAfterEventSignal {
|
|
|
13942
13958
|
* Defines a collection of items.
|
|
13943
13959
|
* @example itemStacks.ts
|
|
13944
13960
|
* ```typescript
|
|
13945
|
-
* import { ItemStack, DimensionLocation } from
|
|
13946
|
-
* import { MinecraftItemTypes } from
|
|
13961
|
+
* import { ItemStack, DimensionLocation } from '@minecraft/server';
|
|
13962
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
13947
13963
|
*
|
|
13948
13964
|
* function itemStacks(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
13949
13965
|
* const oneItemLoc = { x: targetLocation.x + targetLocation.y + 3, y: 2, z: targetLocation.z + 1 };
|
|
@@ -13966,12 +13982,17 @@ export class ItemReleaseUseAfterEventSignal {
|
|
|
13966
13982
|
* ```
|
|
13967
13983
|
* @example givePlayerEquipment.ts
|
|
13968
13984
|
* ```typescript
|
|
13969
|
-
* import {
|
|
13970
|
-
*
|
|
13985
|
+
* import {
|
|
13986
|
+
* world,
|
|
13987
|
+
* ItemStack,
|
|
13988
|
+
* EntityEquippableComponent,
|
|
13989
|
+
* EquipmentSlot,
|
|
13990
|
+
* EntityComponentTypes,
|
|
13991
|
+
* DimensionLocation,
|
|
13992
|
+
* } from '@minecraft/server';
|
|
13993
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
13971
13994
|
*
|
|
13972
|
-
* function givePlayerEquipment(
|
|
13973
|
-
* targetLocation: DimensionLocation
|
|
13974
|
-
* ) {
|
|
13995
|
+
* function givePlayerEquipment(targetLocation: DimensionLocation) {
|
|
13975
13996
|
* const players = world.getAllPlayers();
|
|
13976
13997
|
*
|
|
13977
13998
|
* const armorStandLoc = { x: targetLocation.x, y: targetLocation.y, z: targetLocation.z + 4 };
|
|
@@ -14000,8 +14021,8 @@ export class ItemReleaseUseAfterEventSignal {
|
|
|
14000
14021
|
* ```
|
|
14001
14022
|
* @example spawnFeatherItem.ts
|
|
14002
14023
|
* ```typescript
|
|
14003
|
-
* import { ItemStack, DimensionLocation } from
|
|
14004
|
-
* import { MinecraftItemTypes } from
|
|
14024
|
+
* import { ItemStack, DimensionLocation } from '@minecraft/server';
|
|
14025
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
14005
14026
|
*
|
|
14006
14027
|
* function spawnFeatherItem(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
14007
14028
|
* const featherItem = new ItemStack(MinecraftItemTypes.Feather, 1);
|
|
@@ -14174,12 +14195,18 @@ export class ItemStack {
|
|
|
14174
14195
|
* otherwise undefined.
|
|
14175
14196
|
* @example giveHurtDiamondSword.ts
|
|
14176
14197
|
* ```typescript
|
|
14177
|
-
* import {
|
|
14178
|
-
*
|
|
14198
|
+
* import {
|
|
14199
|
+
* world,
|
|
14200
|
+
* ItemStack,
|
|
14201
|
+
* EntityInventoryComponent,
|
|
14202
|
+
* EntityComponentTypes,
|
|
14203
|
+
* ItemComponentTypes,
|
|
14204
|
+
* ItemDurabilityComponent,
|
|
14205
|
+
* DimensionLocation,
|
|
14206
|
+
* } from '@minecraft/server';
|
|
14207
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
14179
14208
|
*
|
|
14180
|
-
* function giveHurtDiamondSword(
|
|
14181
|
-
* targetLocation: DimensionLocation
|
|
14182
|
-
* ) {
|
|
14209
|
+
* function giveHurtDiamondSword(targetLocation: DimensionLocation) {
|
|
14183
14210
|
* const hurtDiamondSword = new ItemStack(MinecraftItemTypes.DiamondSword);
|
|
14184
14211
|
*
|
|
14185
14212
|
* const durabilityComponent = hurtDiamondSword.getComponent(ItemComponentTypes.Durability) as ItemDurabilityComponent;
|
|
@@ -14330,17 +14357,15 @@ export class ItemStack {
|
|
|
14330
14357
|
* Throws if any of the provided block identifiers are invalid.
|
|
14331
14358
|
* @example giveDestroyRestrictedPickaxe.ts
|
|
14332
14359
|
* ```typescript
|
|
14333
|
-
* import { world, ItemStack, EntityInventoryComponent, DimensionLocation } from
|
|
14334
|
-
* import { MinecraftItemTypes } from
|
|
14360
|
+
* import { world, ItemStack, EntityInventoryComponent, DimensionLocation } from '@minecraft/server';
|
|
14361
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
14335
14362
|
*
|
|
14336
|
-
* function giveDestroyRestrictedPickaxe(
|
|
14337
|
-
* targetLocation: DimensionLocation
|
|
14338
|
-
* ) {
|
|
14363
|
+
* function giveDestroyRestrictedPickaxe(targetLocation: DimensionLocation) {
|
|
14339
14364
|
* for (const player of world.getAllPlayers()) {
|
|
14340
14365
|
* const specialPickaxe = new ItemStack(MinecraftItemTypes.DiamondPickaxe);
|
|
14341
14366
|
* specialPickaxe.setCanDestroy([MinecraftItemTypes.Cobblestone, MinecraftItemTypes.Obsidian]);
|
|
14342
14367
|
*
|
|
14343
|
-
* const inventory = player.getComponent(
|
|
14368
|
+
* const inventory = player.getComponent('inventory') as EntityInventoryComponent;
|
|
14344
14369
|
* if (inventory === undefined || inventory.container === undefined) {
|
|
14345
14370
|
* return;
|
|
14346
14371
|
* }
|
|
@@ -14366,12 +14391,10 @@ export class ItemStack {
|
|
|
14366
14391
|
* Throws if any of the provided block identifiers are invalid.
|
|
14367
14392
|
* @example givePlaceRestrictedGoldBlock.ts
|
|
14368
14393
|
* ```typescript
|
|
14369
|
-
* import { world, ItemStack, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from
|
|
14370
|
-
* import { MinecraftItemTypes } from
|
|
14394
|
+
* import { world, ItemStack, EntityInventoryComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
14395
|
+
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
14371
14396
|
*
|
|
14372
|
-
* function givePlaceRestrictedGoldBlock(
|
|
14373
|
-
* targetLocation: DimensionLocation
|
|
14374
|
-
* ) {
|
|
14397
|
+
* function givePlaceRestrictedGoldBlock(targetLocation: DimensionLocation) {
|
|
14375
14398
|
* for (const player of world.getAllPlayers()) {
|
|
14376
14399
|
* const specialGoldBlock = new ItemStack(MinecraftItemTypes.GoldBlock);
|
|
14377
14400
|
* specialGoldBlock.setCanPlaceOn([MinecraftItemTypes.GrassBlock, MinecraftItemTypes.Dirt]);
|
|
@@ -14443,19 +14466,16 @@ export class ItemStack {
|
|
|
14443
14466
|
* import { MinecraftItemTypes } from '@minecraft/vanilla-data';
|
|
14444
14467
|
*
|
|
14445
14468
|
* function giveAwesomeSword(player: Player) {
|
|
14446
|
-
*
|
|
14447
|
-
*
|
|
14448
|
-
*
|
|
14449
|
-
*
|
|
14450
|
-
*
|
|
14451
|
-
*
|
|
14452
|
-
*
|
|
14453
|
-
*
|
|
14454
|
-
* if (inventory === undefined || inventory.container === undefined) {
|
|
14455
|
-
* return;
|
|
14456
|
-
* }
|
|
14469
|
+
* const diamondAwesomeSword = new ItemStack(MinecraftItemTypes.DiamondSword, 1);
|
|
14470
|
+
* diamondAwesomeSword.setLore(['§c§lDiamond Sword of Awesome§r', '+10 coolness', '§p+4 shiny§r']);
|
|
14471
|
+
*
|
|
14472
|
+
* // hover over/select the item in your inventory to see the lore.
|
|
14473
|
+
* const inventory = player.getComponent(EntityComponentTypes.Inventory);
|
|
14474
|
+
* if (inventory === undefined || inventory.container === undefined) {
|
|
14475
|
+
* return;
|
|
14476
|
+
* }
|
|
14457
14477
|
*
|
|
14458
|
-
*
|
|
14478
|
+
* inventory.container.setItem(0, diamondAwesomeSword);
|
|
14459
14479
|
* }
|
|
14460
14480
|
* ```
|
|
14461
14481
|
*/
|
|
@@ -14722,7 +14742,6 @@ export class ItemType {
|
|
|
14722
14742
|
*/
|
|
14723
14743
|
readonly id: string;
|
|
14724
14744
|
/**
|
|
14725
|
-
* @rc
|
|
14726
14745
|
* @remarks
|
|
14727
14746
|
* Key for the localization of this ItemType's name used in
|
|
14728
14747
|
* .lang files.
|
|
@@ -14919,8 +14938,8 @@ export class KilledByPlayerOrPetsCondition extends LootItemCondition {
|
|
|
14919
14938
|
* activating or deactivating.
|
|
14920
14939
|
* @example leverActionEvent.ts
|
|
14921
14940
|
* ```typescript
|
|
14922
|
-
* import { world, system, BlockPermutation, LeverActionAfterEvent, DimensionLocation } from
|
|
14923
|
-
* import { MinecraftBlockTypes } from
|
|
14941
|
+
* import { world, system, BlockPermutation, LeverActionAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
14942
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
14924
14943
|
*
|
|
14925
14944
|
* function leverActionEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
14926
14945
|
* // set up a lever
|
|
@@ -14932,20 +14951,20 @@ export class KilledByPlayerOrPetsCondition extends LootItemCondition {
|
|
|
14932
14951
|
* });
|
|
14933
14952
|
*
|
|
14934
14953
|
* if (cobblestone === undefined || lever === undefined) {
|
|
14935
|
-
* log(
|
|
14954
|
+
* log('Could not find block at location.');
|
|
14936
14955
|
* return -1;
|
|
14937
14956
|
* }
|
|
14938
14957
|
*
|
|
14939
14958
|
* cobblestone.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Cobblestone));
|
|
14940
14959
|
* lever.setPermutation(
|
|
14941
|
-
* BlockPermutation.resolve(MinecraftBlockTypes.Lever).withState(
|
|
14960
|
+
* BlockPermutation.resolve(MinecraftBlockTypes.Lever).withState('lever_direction', 'up_north_south')
|
|
14942
14961
|
* );
|
|
14943
14962
|
*
|
|
14944
14963
|
* world.afterEvents.leverAction.subscribe((leverActionEvent: LeverActionAfterEvent) => {
|
|
14945
14964
|
* const eventLoc = leverActionEvent.block.location;
|
|
14946
14965
|
*
|
|
14947
14966
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y + 1 && eventLoc.z === targetLocation.z) {
|
|
14948
|
-
* log(
|
|
14967
|
+
* log('Lever activate event at tick ' + system.currentTick);
|
|
14949
14968
|
* }
|
|
14950
14969
|
* });
|
|
14951
14970
|
* }
|
|
@@ -14974,8 +14993,8 @@ export class LeverActionAfterEvent extends BlockEvent {
|
|
|
14974
14993
|
* (activates or deactivates).
|
|
14975
14994
|
* @example leverActionEvent.ts
|
|
14976
14995
|
* ```typescript
|
|
14977
|
-
* import { world, system, BlockPermutation, LeverActionAfterEvent, DimensionLocation } from
|
|
14978
|
-
* import { MinecraftBlockTypes } from
|
|
14996
|
+
* import { world, system, BlockPermutation, LeverActionAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
14997
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
14979
14998
|
*
|
|
14980
14999
|
* function leverActionEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
14981
15000
|
* // set up a lever
|
|
@@ -14987,20 +15006,20 @@ export class LeverActionAfterEvent extends BlockEvent {
|
|
|
14987
15006
|
* });
|
|
14988
15007
|
*
|
|
14989
15008
|
* if (cobblestone === undefined || lever === undefined) {
|
|
14990
|
-
* log(
|
|
15009
|
+
* log('Could not find block at location.');
|
|
14991
15010
|
* return -1;
|
|
14992
15011
|
* }
|
|
14993
15012
|
*
|
|
14994
15013
|
* cobblestone.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Cobblestone));
|
|
14995
15014
|
* lever.setPermutation(
|
|
14996
|
-
* BlockPermutation.resolve(MinecraftBlockTypes.Lever).withState(
|
|
15015
|
+
* BlockPermutation.resolve(MinecraftBlockTypes.Lever).withState('lever_direction', 'up_north_south')
|
|
14997
15016
|
* );
|
|
14998
15017
|
*
|
|
14999
15018
|
* world.afterEvents.leverAction.subscribe((leverActionEvent: LeverActionAfterEvent) => {
|
|
15000
15019
|
* const eventLoc = leverActionEvent.block.location;
|
|
15001
15020
|
*
|
|
15002
15021
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y + 1 && eventLoc.z === targetLocation.z) {
|
|
15003
|
-
* log(
|
|
15022
|
+
* log('Lever activate event at tick ' + system.currentTick);
|
|
15004
15023
|
* }
|
|
15005
15024
|
* });
|
|
15006
15025
|
* }
|
|
@@ -15033,7 +15052,6 @@ export class LeverActionAfterEventSignal {
|
|
|
15033
15052
|
}
|
|
15034
15053
|
|
|
15035
15054
|
/**
|
|
15036
|
-
* @rc
|
|
15037
15055
|
* A spline that linearly interpolates between points.
|
|
15038
15056
|
*/
|
|
15039
15057
|
export class LinearSpline {
|
|
@@ -15546,8 +15564,15 @@ export class PassengerOfEntityCondition extends LootItemCondition {
|
|
|
15546
15564
|
* expanding or retracting.
|
|
15547
15565
|
* @example pistonAfterEvent.ts
|
|
15548
15566
|
* ```typescript
|
|
15549
|
-
* import {
|
|
15550
|
-
*
|
|
15567
|
+
* import {
|
|
15568
|
+
* world,
|
|
15569
|
+
* system,
|
|
15570
|
+
* BlockPermutation,
|
|
15571
|
+
* BlockPistonState,
|
|
15572
|
+
* PistonActivateAfterEvent,
|
|
15573
|
+
* DimensionLocation,
|
|
15574
|
+
* } from '@minecraft/server';
|
|
15575
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
15551
15576
|
*
|
|
15552
15577
|
* function pistonAfterEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
15553
15578
|
* // set up a couple of piston blocks
|
|
@@ -15559,25 +15584,25 @@ export class PassengerOfEntityCondition extends LootItemCondition {
|
|
|
15559
15584
|
* });
|
|
15560
15585
|
*
|
|
15561
15586
|
* if (piston === undefined || button === undefined) {
|
|
15562
|
-
* log(
|
|
15587
|
+
* log('Could not find block at location.');
|
|
15563
15588
|
* return -1;
|
|
15564
15589
|
* }
|
|
15565
15590
|
*
|
|
15566
|
-
* piston.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Piston).withState(
|
|
15567
|
-
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState(
|
|
15591
|
+
* piston.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Piston).withState('facing_direction', 3));
|
|
15592
|
+
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState('facing_direction', 1));
|
|
15568
15593
|
*
|
|
15569
15594
|
* world.afterEvents.pistonActivate.subscribe((pistonEvent: PistonActivateAfterEvent) => {
|
|
15570
15595
|
* const eventLoc = pistonEvent.piston.block.location;
|
|
15571
15596
|
*
|
|
15572
15597
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
|
|
15573
15598
|
* log(
|
|
15574
|
-
*
|
|
15599
|
+
* 'Piston event at ' +
|
|
15575
15600
|
* system.currentTick +
|
|
15576
|
-
* (pistonEvent.piston.isMoving ?
|
|
15577
|
-
* (pistonEvent.piston.state === BlockPistonState.Expanding ?
|
|
15578
|
-
* (pistonEvent.piston.state === BlockPistonState.Expanded ?
|
|
15579
|
-
* (pistonEvent.piston.state === BlockPistonState.Retracting ?
|
|
15580
|
-
* (pistonEvent.piston.state === BlockPistonState.Retracted ?
|
|
15601
|
+
* (pistonEvent.piston.isMoving ? ' Moving' : '') +
|
|
15602
|
+
* (pistonEvent.piston.state === BlockPistonState.Expanding ? ' Expanding' : '') +
|
|
15603
|
+
* (pistonEvent.piston.state === BlockPistonState.Expanded ? ' Expanded' : '') +
|
|
15604
|
+
* (pistonEvent.piston.state === BlockPistonState.Retracting ? ' Retracting' : '') +
|
|
15605
|
+
* (pistonEvent.piston.state === BlockPistonState.Retracted ? ' Retracted' : '')
|
|
15581
15606
|
* );
|
|
15582
15607
|
* }
|
|
15583
15608
|
* });
|
|
@@ -15614,8 +15639,15 @@ export class PistonActivateAfterEventSignal {
|
|
|
15614
15639
|
*
|
|
15615
15640
|
* @example pistonAfterEvent.ts
|
|
15616
15641
|
* ```typescript
|
|
15617
|
-
* import {
|
|
15618
|
-
*
|
|
15642
|
+
* import {
|
|
15643
|
+
* world,
|
|
15644
|
+
* system,
|
|
15645
|
+
* BlockPermutation,
|
|
15646
|
+
* BlockPistonState,
|
|
15647
|
+
* PistonActivateAfterEvent,
|
|
15648
|
+
* DimensionLocation,
|
|
15649
|
+
* } from '@minecraft/server';
|
|
15650
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
15619
15651
|
*
|
|
15620
15652
|
* function pistonAfterEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
15621
15653
|
* // set up a couple of piston blocks
|
|
@@ -15627,25 +15659,25 @@ export class PistonActivateAfterEventSignal {
|
|
|
15627
15659
|
* });
|
|
15628
15660
|
*
|
|
15629
15661
|
* if (piston === undefined || button === undefined) {
|
|
15630
|
-
* log(
|
|
15662
|
+
* log('Could not find block at location.');
|
|
15631
15663
|
* return -1;
|
|
15632
15664
|
* }
|
|
15633
15665
|
*
|
|
15634
|
-
* piston.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Piston).withState(
|
|
15635
|
-
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState(
|
|
15666
|
+
* piston.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.Piston).withState('facing_direction', 3));
|
|
15667
|
+
* button.setPermutation(BlockPermutation.resolve(MinecraftBlockTypes.AcaciaButton).withState('facing_direction', 1));
|
|
15636
15668
|
*
|
|
15637
15669
|
* world.afterEvents.pistonActivate.subscribe((pistonEvent: PistonActivateAfterEvent) => {
|
|
15638
15670
|
* const eventLoc = pistonEvent.piston.block.location;
|
|
15639
15671
|
*
|
|
15640
15672
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
|
|
15641
15673
|
* log(
|
|
15642
|
-
*
|
|
15674
|
+
* 'Piston event at ' +
|
|
15643
15675
|
* system.currentTick +
|
|
15644
|
-
* (pistonEvent.piston.isMoving ?
|
|
15645
|
-
* (pistonEvent.piston.state === BlockPistonState.Expanding ?
|
|
15646
|
-
* (pistonEvent.piston.state === BlockPistonState.Expanded ?
|
|
15647
|
-
* (pistonEvent.piston.state === BlockPistonState.Retracting ?
|
|
15648
|
-
* (pistonEvent.piston.state === BlockPistonState.Retracted ?
|
|
15676
|
+
* (pistonEvent.piston.isMoving ? ' Moving' : '') +
|
|
15677
|
+
* (pistonEvent.piston.state === BlockPistonState.Expanding ? ' Expanding' : '') +
|
|
15678
|
+
* (pistonEvent.piston.state === BlockPistonState.Expanded ? ' Expanded' : '') +
|
|
15679
|
+
* (pistonEvent.piston.state === BlockPistonState.Retracting ? ' Retracting' : '') +
|
|
15680
|
+
* (pistonEvent.piston.state === BlockPistonState.Retracted ? ' Retracted' : '')
|
|
15649
15681
|
* );
|
|
15650
15682
|
* }
|
|
15651
15683
|
* });
|
|
@@ -15842,7 +15874,6 @@ export class Player extends Entity {
|
|
|
15842
15874
|
*/
|
|
15843
15875
|
clearPropertyOverridesForEntity(targetEntity: Entity | string): void;
|
|
15844
15876
|
/**
|
|
15845
|
-
* @rc
|
|
15846
15877
|
* @remarks
|
|
15847
15878
|
* The player's aim-assist settings.
|
|
15848
15879
|
*
|
|
@@ -15914,7 +15945,7 @@ export class Player extends Entity {
|
|
|
15914
15945
|
* @throws This function can throw errors.
|
|
15915
15946
|
* @example playMusicAndSound.ts
|
|
15916
15947
|
* ```typescript
|
|
15917
|
-
* import { world, MusicOptions, WorldSoundOptions, PlayerSoundOptions, DimensionLocation } from
|
|
15948
|
+
* import { world, MusicOptions, WorldSoundOptions, PlayerSoundOptions, DimensionLocation } from '@minecraft/server';
|
|
15918
15949
|
*
|
|
15919
15950
|
* function playMusicAndSound(targetLocation: DimensionLocation) {
|
|
15920
15951
|
* const players = world.getPlayers();
|
|
@@ -15924,20 +15955,20 @@ export class Player extends Entity {
|
|
|
15924
15955
|
* loop: true,
|
|
15925
15956
|
* volume: 1.0,
|
|
15926
15957
|
* };
|
|
15927
|
-
* world.playMusic(
|
|
15958
|
+
* world.playMusic('music.menu', musicOptions);
|
|
15928
15959
|
*
|
|
15929
15960
|
* const worldSoundOptions: WorldSoundOptions = {
|
|
15930
15961
|
* pitch: 0.5,
|
|
15931
15962
|
* volume: 4.0,
|
|
15932
15963
|
* };
|
|
15933
|
-
* world.playSound(
|
|
15964
|
+
* world.playSound('ambient.weather.thunder', targetLocation, worldSoundOptions);
|
|
15934
15965
|
*
|
|
15935
15966
|
* const playerSoundOptions: PlayerSoundOptions = {
|
|
15936
15967
|
* pitch: 1.0,
|
|
15937
15968
|
* volume: 1.0,
|
|
15938
15969
|
* };
|
|
15939
15970
|
*
|
|
15940
|
-
* players[0].playSound(
|
|
15971
|
+
* players[0].playSound('bucket.fill_water', playerSoundOptions);
|
|
15941
15972
|
* }
|
|
15942
15973
|
* ```
|
|
15943
15974
|
*/
|
|
@@ -16004,61 +16035,61 @@ export class Player extends Entity {
|
|
|
16004
16035
|
* {@link RawMessageError}
|
|
16005
16036
|
* @example nestedTranslation.ts
|
|
16006
16037
|
* ```typescript
|
|
16007
|
-
* import { world, DimensionLocation } from
|
|
16038
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
16008
16039
|
*
|
|
16009
16040
|
* function nestedTranslation(targetLocation: DimensionLocation) {
|
|
16010
16041
|
* // Displays "Apple or Coal"
|
|
16011
16042
|
* const rawMessage = {
|
|
16012
|
-
* translate:
|
|
16013
|
-
* with: { rawtext: [{ translate:
|
|
16043
|
+
* translate: 'accessibility.list.or.two',
|
|
16044
|
+
* with: { rawtext: [{ translate: 'item.apple.name' }, { translate: 'item.coal.name' }] },
|
|
16014
16045
|
* };
|
|
16015
16046
|
* world.sendMessage(rawMessage);
|
|
16016
16047
|
* }
|
|
16017
16048
|
* ```
|
|
16018
16049
|
* @example scoreWildcard.ts
|
|
16019
16050
|
* ```typescript
|
|
16020
|
-
* import { world, DimensionLocation } from
|
|
16051
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
16021
16052
|
*
|
|
16022
16053
|
* function scoreWildcard(targetLocation: DimensionLocation) {
|
|
16023
16054
|
* // Displays the player's score for objective "obj". Each player will see their own score.
|
|
16024
|
-
* const rawMessage = { score: { name:
|
|
16055
|
+
* const rawMessage = { score: { name: '*', objective: 'obj' } };
|
|
16025
16056
|
* world.sendMessage(rawMessage);
|
|
16026
16057
|
* }
|
|
16027
16058
|
* ```
|
|
16028
16059
|
* @example sendBasicMessage.ts
|
|
16029
16060
|
* ```typescript
|
|
16030
|
-
* import { world, DimensionLocation } from
|
|
16061
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
16031
16062
|
*
|
|
16032
16063
|
* function sendBasicMessage(targetLocation: DimensionLocation) {
|
|
16033
16064
|
* const players = world.getPlayers();
|
|
16034
16065
|
*
|
|
16035
|
-
* players[0].sendMessage(
|
|
16066
|
+
* players[0].sendMessage('Hello World!');
|
|
16036
16067
|
* }
|
|
16037
16068
|
* ```
|
|
16038
16069
|
* @example sendPlayerMessages.ts
|
|
16039
16070
|
* ```typescript
|
|
16040
|
-
* import { world, DimensionLocation } from
|
|
16071
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
16041
16072
|
*
|
|
16042
16073
|
* function sendPlayerMessages(targetLocation: DimensionLocation) {
|
|
16043
16074
|
* for (const player of world.getAllPlayers()) {
|
|
16044
16075
|
* // Displays "First or Second"
|
|
16045
|
-
* const rawMessage = { translate:
|
|
16076
|
+
* const rawMessage = { translate: 'accessibility.list.or.two', with: ['First', 'Second'] };
|
|
16046
16077
|
* player.sendMessage(rawMessage);
|
|
16047
16078
|
*
|
|
16048
16079
|
* // Displays "Hello, world!"
|
|
16049
|
-
* player.sendMessage(
|
|
16080
|
+
* player.sendMessage('Hello, world!');
|
|
16050
16081
|
*
|
|
16051
16082
|
* // Displays "Welcome, Amazing Player 1!"
|
|
16052
|
-
* player.sendMessage({ translate:
|
|
16083
|
+
* player.sendMessage({ translate: 'authentication.welcome', with: ['Amazing Player 1'] });
|
|
16053
16084
|
*
|
|
16054
16085
|
* // Displays the player's score for objective "obj". Each player will see their own score.
|
|
16055
|
-
* const rawMessageWithScore = { score: { name:
|
|
16086
|
+
* const rawMessageWithScore = { score: { name: '*', objective: 'obj' } };
|
|
16056
16087
|
* player.sendMessage(rawMessageWithScore);
|
|
16057
16088
|
*
|
|
16058
16089
|
* // Displays "Apple or Coal"
|
|
16059
16090
|
* const rawMessageWithNestedTranslations = {
|
|
16060
|
-
* translate:
|
|
16061
|
-
* with: { rawtext: [{ translate:
|
|
16091
|
+
* translate: 'accessibility.list.or.two',
|
|
16092
|
+
* with: { rawtext: [{ translate: 'item.apple.name' }, { translate: 'item.coal.name' }] },
|
|
16062
16093
|
* };
|
|
16063
16094
|
* player.sendMessage(rawMessageWithNestedTranslations);
|
|
16064
16095
|
* }
|
|
@@ -16066,14 +16097,12 @@ export class Player extends Entity {
|
|
|
16066
16097
|
* ```
|
|
16067
16098
|
* @example sendTranslatedMessage.ts
|
|
16068
16099
|
* ```typescript
|
|
16069
|
-
* import { world, DimensionLocation } from
|
|
16100
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
16070
16101
|
*
|
|
16071
|
-
* function sendTranslatedMessage(
|
|
16072
|
-
* targetLocation: DimensionLocation
|
|
16073
|
-
* ) {
|
|
16102
|
+
* function sendTranslatedMessage(targetLocation: DimensionLocation) {
|
|
16074
16103
|
* const players = world.getPlayers();
|
|
16075
16104
|
*
|
|
16076
|
-
* players[0].sendMessage({ translate:
|
|
16105
|
+
* players[0].sendMessage({ translate: 'authentication.welcome', with: ['Amazing Player 1'] });
|
|
16077
16106
|
* }
|
|
16078
16107
|
* ```
|
|
16079
16108
|
*/
|
|
@@ -16182,23 +16211,23 @@ export class Player extends Entity {
|
|
|
16182
16211
|
* import { world, MolangVariableMap, Vector3 } from '@minecraft/server';
|
|
16183
16212
|
*
|
|
16184
16213
|
* world.afterEvents.playerSpawn.subscribe(event => {
|
|
16185
|
-
*
|
|
16186
|
-
*
|
|
16187
|
-
*
|
|
16188
|
-
*
|
|
16189
|
-
*
|
|
16190
|
-
*
|
|
16191
|
-
*
|
|
16192
|
-
*
|
|
16193
|
-
*
|
|
16194
|
-
*
|
|
16195
|
-
*
|
|
16196
|
-
*
|
|
16197
|
-
*
|
|
16198
|
-
*
|
|
16199
|
-
*
|
|
16200
|
-
*
|
|
16201
|
-
*
|
|
16214
|
+
* const targetLocation = event.player.location;
|
|
16215
|
+
* for (let i = 0; i < 100; i++) {
|
|
16216
|
+
* const molang = new MolangVariableMap();
|
|
16217
|
+
*
|
|
16218
|
+
* molang.setColorRGB('variable.color', {
|
|
16219
|
+
* red: Math.random(),
|
|
16220
|
+
* green: Math.random(),
|
|
16221
|
+
* blue: Math.random(),
|
|
16222
|
+
* });
|
|
16223
|
+
*
|
|
16224
|
+
* const newLocation: Vector3 = {
|
|
16225
|
+
* x: targetLocation.x + Math.floor(Math.random() * 8) - 4,
|
|
16226
|
+
* y: targetLocation.y + Math.floor(Math.random() * 8) - 4,
|
|
16227
|
+
* z: targetLocation.z + Math.floor(Math.random() * 8) - 4,
|
|
16228
|
+
* };
|
|
16229
|
+
* event.player.spawnParticle('minecraft:colored_flame_particle', newLocation, molang);
|
|
16230
|
+
* }
|
|
16202
16231
|
* });
|
|
16203
16232
|
* ```
|
|
16204
16233
|
*/
|
|
@@ -16232,7 +16261,6 @@ export class Player extends Entity {
|
|
|
16232
16261
|
}
|
|
16233
16262
|
|
|
16234
16263
|
/**
|
|
16235
|
-
* @rc
|
|
16236
16264
|
* A container for APIs related to player aim-assist.
|
|
16237
16265
|
*/
|
|
16238
16266
|
export class PlayerAimAssist {
|
|
@@ -18105,11 +18133,11 @@ export class RandomRegionalDifficultyChanceCondition extends LootItemCondition {
|
|
|
18105
18133
|
* Contains objectives and participants for the scoreboard.
|
|
18106
18134
|
* @example updateScoreboard.ts
|
|
18107
18135
|
* ```typescript
|
|
18108
|
-
* import { world, DisplaySlotId, ObjectiveSortOrder, DimensionLocation } from
|
|
18136
|
+
* import { world, DisplaySlotId, ObjectiveSortOrder, DimensionLocation } from '@minecraft/server';
|
|
18109
18137
|
*
|
|
18110
18138
|
* function updateScoreboard(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
18111
|
-
* const scoreboardObjectiveId =
|
|
18112
|
-
* const scoreboardObjectiveDisplayName =
|
|
18139
|
+
* const scoreboardObjectiveId = 'scoreboard_demo_objective';
|
|
18140
|
+
* const scoreboardObjectiveDisplayName = 'Demo Objective';
|
|
18113
18141
|
*
|
|
18114
18142
|
* const players = world.getPlayers();
|
|
18115
18143
|
*
|
|
@@ -18124,7 +18152,7 @@ export class RandomRegionalDifficultyChanceCondition extends LootItemCondition {
|
|
|
18124
18152
|
* const player0Identity = players[0].scoreboardIdentity;
|
|
18125
18153
|
*
|
|
18126
18154
|
* if (player0Identity === undefined) {
|
|
18127
|
-
* log(
|
|
18155
|
+
* log('Could not get a scoreboard identity for player 0.');
|
|
18128
18156
|
* return -1;
|
|
18129
18157
|
* }
|
|
18130
18158
|
*
|
|
@@ -18154,11 +18182,11 @@ export class Scoreboard {
|
|
|
18154
18182
|
* @throws This function can throw errors.
|
|
18155
18183
|
* @example updateScoreboard.ts
|
|
18156
18184
|
* ```typescript
|
|
18157
|
-
* import { world, DisplaySlotId, ObjectiveSortOrder, DimensionLocation } from
|
|
18185
|
+
* import { world, DisplaySlotId, ObjectiveSortOrder, DimensionLocation } from '@minecraft/server';
|
|
18158
18186
|
*
|
|
18159
18187
|
* function updateScoreboard(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
18160
|
-
* const scoreboardObjectiveId =
|
|
18161
|
-
* const scoreboardObjectiveDisplayName =
|
|
18188
|
+
* const scoreboardObjectiveId = 'scoreboard_demo_objective';
|
|
18189
|
+
* const scoreboardObjectiveDisplayName = 'Demo Objective';
|
|
18162
18190
|
*
|
|
18163
18191
|
* const players = world.getPlayers();
|
|
18164
18192
|
*
|
|
@@ -18173,7 +18201,7 @@ export class Scoreboard {
|
|
|
18173
18201
|
* const player0Identity = players[0].scoreboardIdentity;
|
|
18174
18202
|
*
|
|
18175
18203
|
* if (player0Identity === undefined) {
|
|
18176
|
-
* log(
|
|
18204
|
+
* log('Could not get a scoreboard identity for player 0.');
|
|
18177
18205
|
* return -1;
|
|
18178
18206
|
* }
|
|
18179
18207
|
*
|
|
@@ -18418,45 +18446,43 @@ export class ScoreboardScoreInfo {
|
|
|
18418
18446
|
* showing up on the screen.
|
|
18419
18447
|
* @example setTitle.ts
|
|
18420
18448
|
* ```typescript
|
|
18421
|
-
* import { world, DimensionLocation } from
|
|
18449
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
18422
18450
|
*
|
|
18423
18451
|
* function setTitle(targetLocation: DimensionLocation) {
|
|
18424
18452
|
* const players = world.getPlayers();
|
|
18425
18453
|
*
|
|
18426
18454
|
* if (players.length > 0) {
|
|
18427
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18455
|
+
* players[0].onScreenDisplay.setTitle('§o§6Fancy Title§r');
|
|
18428
18456
|
* }
|
|
18429
18457
|
* }
|
|
18430
18458
|
* ```
|
|
18431
18459
|
* @example setTitleAndSubtitle.ts
|
|
18432
18460
|
* ```typescript
|
|
18433
|
-
* import { world, DimensionLocation } from
|
|
18461
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
18434
18462
|
*
|
|
18435
|
-
* function setTitleAndSubtitle(
|
|
18436
|
-
* targetLocation: DimensionLocation
|
|
18437
|
-
* ) {
|
|
18463
|
+
* function setTitleAndSubtitle(targetLocation: DimensionLocation) {
|
|
18438
18464
|
* const players = world.getPlayers();
|
|
18439
18465
|
*
|
|
18440
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18466
|
+
* players[0].onScreenDisplay.setTitle('Chapter 1', {
|
|
18441
18467
|
* stayDuration: 100,
|
|
18442
18468
|
* fadeInDuration: 2,
|
|
18443
18469
|
* fadeOutDuration: 4,
|
|
18444
|
-
* subtitle:
|
|
18470
|
+
* subtitle: 'Trouble in Block Town',
|
|
18445
18471
|
* });
|
|
18446
18472
|
* }
|
|
18447
18473
|
* ```
|
|
18448
18474
|
* @example countdown.ts
|
|
18449
18475
|
* ```typescript
|
|
18450
|
-
* import { world, system, DimensionLocation } from
|
|
18476
|
+
* import { world, system, DimensionLocation } from '@minecraft/server';
|
|
18451
18477
|
*
|
|
18452
18478
|
* function countdown(targetLocation: DimensionLocation) {
|
|
18453
18479
|
* const players = world.getPlayers();
|
|
18454
18480
|
*
|
|
18455
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18481
|
+
* players[0].onScreenDisplay.setTitle('Get ready!', {
|
|
18456
18482
|
* stayDuration: 220,
|
|
18457
18483
|
* fadeInDuration: 2,
|
|
18458
18484
|
* fadeOutDuration: 4,
|
|
18459
|
-
* subtitle:
|
|
18485
|
+
* subtitle: '10',
|
|
18460
18486
|
* });
|
|
18461
18487
|
*
|
|
18462
18488
|
* let countdown = 10;
|
|
@@ -18568,45 +18594,43 @@ export class ScreenDisplay {
|
|
|
18568
18594
|
* {@link RawMessageError}
|
|
18569
18595
|
* @example setTitle.ts
|
|
18570
18596
|
* ```typescript
|
|
18571
|
-
* import { world, DimensionLocation } from
|
|
18597
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
18572
18598
|
*
|
|
18573
18599
|
* function setTitle(targetLocation: DimensionLocation) {
|
|
18574
18600
|
* const players = world.getPlayers();
|
|
18575
18601
|
*
|
|
18576
18602
|
* if (players.length > 0) {
|
|
18577
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18603
|
+
* players[0].onScreenDisplay.setTitle('§o§6Fancy Title§r');
|
|
18578
18604
|
* }
|
|
18579
18605
|
* }
|
|
18580
18606
|
* ```
|
|
18581
18607
|
* @example setTitleAndSubtitle.ts
|
|
18582
18608
|
* ```typescript
|
|
18583
|
-
* import { world, DimensionLocation } from
|
|
18609
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
18584
18610
|
*
|
|
18585
|
-
* function setTitleAndSubtitle(
|
|
18586
|
-
* targetLocation: DimensionLocation
|
|
18587
|
-
* ) {
|
|
18611
|
+
* function setTitleAndSubtitle(targetLocation: DimensionLocation) {
|
|
18588
18612
|
* const players = world.getPlayers();
|
|
18589
18613
|
*
|
|
18590
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18614
|
+
* players[0].onScreenDisplay.setTitle('Chapter 1', {
|
|
18591
18615
|
* stayDuration: 100,
|
|
18592
18616
|
* fadeInDuration: 2,
|
|
18593
18617
|
* fadeOutDuration: 4,
|
|
18594
|
-
* subtitle:
|
|
18618
|
+
* subtitle: 'Trouble in Block Town',
|
|
18595
18619
|
* });
|
|
18596
18620
|
* }
|
|
18597
18621
|
* ```
|
|
18598
18622
|
* @example countdown.ts
|
|
18599
18623
|
* ```typescript
|
|
18600
|
-
* import { world, system, DimensionLocation } from
|
|
18624
|
+
* import { world, system, DimensionLocation } from '@minecraft/server';
|
|
18601
18625
|
*
|
|
18602
18626
|
* function countdown(targetLocation: DimensionLocation) {
|
|
18603
18627
|
* const players = world.getPlayers();
|
|
18604
18628
|
*
|
|
18605
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18629
|
+
* players[0].onScreenDisplay.setTitle('Get ready!', {
|
|
18606
18630
|
* stayDuration: 220,
|
|
18607
18631
|
* fadeInDuration: 2,
|
|
18608
18632
|
* fadeOutDuration: 4,
|
|
18609
|
-
* subtitle:
|
|
18633
|
+
* subtitle: '10',
|
|
18610
18634
|
* });
|
|
18611
18635
|
*
|
|
18612
18636
|
* let countdown = 10;
|
|
@@ -18637,16 +18661,16 @@ export class ScreenDisplay {
|
|
|
18637
18661
|
* {@link RawMessageError}
|
|
18638
18662
|
* @example countdown.ts
|
|
18639
18663
|
* ```typescript
|
|
18640
|
-
* import { world, system, DimensionLocation } from
|
|
18664
|
+
* import { world, system, DimensionLocation } from '@minecraft/server';
|
|
18641
18665
|
*
|
|
18642
18666
|
* function countdown(targetLocation: DimensionLocation) {
|
|
18643
18667
|
* const players = world.getPlayers();
|
|
18644
18668
|
*
|
|
18645
|
-
* players[0].onScreenDisplay.setTitle(
|
|
18669
|
+
* players[0].onScreenDisplay.setTitle('Get ready!', {
|
|
18646
18670
|
* stayDuration: 220,
|
|
18647
18671
|
* fadeInDuration: 2,
|
|
18648
18672
|
* fadeOutDuration: 4,
|
|
18649
|
-
* subtitle:
|
|
18673
|
+
* subtitle: '10',
|
|
18650
18674
|
* });
|
|
18651
18675
|
*
|
|
18652
18676
|
* let countdown = 10;
|
|
@@ -19571,16 +19595,16 @@ export class System {
|
|
|
19571
19595
|
* function to cancel the execution of this run.
|
|
19572
19596
|
* @example trapTick.ts
|
|
19573
19597
|
* ```typescript
|
|
19574
|
-
* import { world, system } from
|
|
19598
|
+
* import { world, system } from '@minecraft/server';
|
|
19575
19599
|
*
|
|
19576
19600
|
* function trapTick() {
|
|
19577
19601
|
* try {
|
|
19578
19602
|
* // Minecraft runs at 20 ticks per second.
|
|
19579
19603
|
* if (system.currentTick % 1200 === 0) {
|
|
19580
|
-
* world.sendMessage(
|
|
19604
|
+
* world.sendMessage('Another minute passes...');
|
|
19581
19605
|
* }
|
|
19582
19606
|
* } catch (e) {
|
|
19583
|
-
* console.warn(
|
|
19607
|
+
* console.warn('Error: ' + e);
|
|
19584
19608
|
* }
|
|
19585
19609
|
*
|
|
19586
19610
|
* system.run(trapTick);
|
|
@@ -19604,13 +19628,13 @@ export class System {
|
|
|
19604
19628
|
* to stop the run of this function on an interval.
|
|
19605
19629
|
* @example every30Seconds.ts
|
|
19606
19630
|
* ```typescript
|
|
19607
|
-
* import { world, system, DimensionLocation } from
|
|
19631
|
+
* import { world, system, DimensionLocation } from '@minecraft/server';
|
|
19608
19632
|
*
|
|
19609
19633
|
* function every30Seconds(targetLocation: DimensionLocation) {
|
|
19610
19634
|
* const intervalRunIdentifier = Math.floor(Math.random() * 10000);
|
|
19611
19635
|
*
|
|
19612
19636
|
* system.runInterval(() => {
|
|
19613
|
-
* world.sendMessage(
|
|
19637
|
+
* world.sendMessage('This is an interval run ' + intervalRunIdentifier + ' sending a message every 30 seconds.');
|
|
19614
19638
|
* }, 600);
|
|
19615
19639
|
* }
|
|
19616
19640
|
* ```
|
|
@@ -19631,10 +19655,10 @@ export class System {
|
|
|
19631
19655
|
* System.clearJob} to stop the run of this generator.
|
|
19632
19656
|
* @example cubeGenerator.ts
|
|
19633
19657
|
* ```typescript
|
|
19634
|
-
* import { system, BlockPermutation, DimensionLocation } from
|
|
19658
|
+
* import { system, BlockPermutation, DimensionLocation } from '@minecraft/server';
|
|
19635
19659
|
*
|
|
19636
19660
|
* function cubeGenerator(targetLocation: DimensionLocation) {
|
|
19637
|
-
* const blockPerm = BlockPermutation.resolve(
|
|
19661
|
+
* const blockPerm = BlockPermutation.resolve('minecraft:cobblestone');
|
|
19638
19662
|
*
|
|
19639
19663
|
* system.runJob(blockPlacingGenerator(blockPerm, targetLocation, 15));
|
|
19640
19664
|
* }
|
|
@@ -19830,7 +19854,6 @@ export class TargetBlockHitAfterEventSignal {
|
|
|
19830
19854
|
}
|
|
19831
19855
|
|
|
19832
19856
|
/**
|
|
19833
|
-
* @rc
|
|
19834
19857
|
* This manager is used to add, remove or query temporary
|
|
19835
19858
|
* ticking areas to a dimension. These ticking areas are
|
|
19836
19859
|
* limited by a fixed amount of ticking chunks per pack
|
|
@@ -19955,8 +19978,8 @@ export class Trigger {
|
|
|
19955
19978
|
* Contains information related to changes to a trip wire trip.
|
|
19956
19979
|
* @example tripWireTripEvent.ts
|
|
19957
19980
|
* ```typescript
|
|
19958
|
-
* import { world, system, BlockPermutation, TripWireTripAfterEvent, DimensionLocation } from
|
|
19959
|
-
* import { MinecraftBlockTypes } from
|
|
19981
|
+
* import { world, system, BlockPermutation, TripWireTripAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
19982
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
19960
19983
|
*
|
|
19961
19984
|
* function tripWireTripEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
19962
19985
|
* // set up a tripwire
|
|
@@ -19968,7 +19991,7 @@ export class Trigger {
|
|
|
19968
19991
|
* const tripwire = targetLocation.dimension.getBlock(targetLocation);
|
|
19969
19992
|
*
|
|
19970
19993
|
* if (redstone === undefined || tripwire === undefined) {
|
|
19971
|
-
* log(
|
|
19994
|
+
* log('Could not find block at location.');
|
|
19972
19995
|
* return -1;
|
|
19973
19996
|
* }
|
|
19974
19997
|
*
|
|
@@ -19980,9 +20003,9 @@ export class Trigger {
|
|
|
19980
20003
|
*
|
|
19981
20004
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
|
|
19982
20005
|
* log(
|
|
19983
|
-
*
|
|
20006
|
+
* 'Tripwire trip event at tick ' +
|
|
19984
20007
|
* system.currentTick +
|
|
19985
|
-
* (tripWireTripEvent.sources.length > 0 ?
|
|
20008
|
+
* (tripWireTripEvent.sources.length > 0 ? ' by entity ' + tripWireTripEvent.sources[0].id : '')
|
|
19986
20009
|
* );
|
|
19987
20010
|
* }
|
|
19988
20011
|
* });
|
|
@@ -20011,8 +20034,8 @@ export class TripWireTripAfterEvent extends BlockEvent {
|
|
|
20011
20034
|
* tripped.
|
|
20012
20035
|
* @example tripWireTripEvent.ts
|
|
20013
20036
|
* ```typescript
|
|
20014
|
-
* import { world, system, BlockPermutation, TripWireTripAfterEvent, DimensionLocation } from
|
|
20015
|
-
* import { MinecraftBlockTypes } from
|
|
20037
|
+
* import { world, system, BlockPermutation, TripWireTripAfterEvent, DimensionLocation } from '@minecraft/server';
|
|
20038
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
20016
20039
|
*
|
|
20017
20040
|
* function tripWireTripEvent(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
20018
20041
|
* // set up a tripwire
|
|
@@ -20024,7 +20047,7 @@ export class TripWireTripAfterEvent extends BlockEvent {
|
|
|
20024
20047
|
* const tripwire = targetLocation.dimension.getBlock(targetLocation);
|
|
20025
20048
|
*
|
|
20026
20049
|
* if (redstone === undefined || tripwire === undefined) {
|
|
20027
|
-
* log(
|
|
20050
|
+
* log('Could not find block at location.');
|
|
20028
20051
|
* return -1;
|
|
20029
20052
|
* }
|
|
20030
20053
|
*
|
|
@@ -20036,9 +20059,9 @@ export class TripWireTripAfterEvent extends BlockEvent {
|
|
|
20036
20059
|
*
|
|
20037
20060
|
* if (eventLoc.x === targetLocation.x && eventLoc.y === targetLocation.y && eventLoc.z === targetLocation.z) {
|
|
20038
20061
|
* log(
|
|
20039
|
-
*
|
|
20062
|
+
* 'Tripwire trip event at tick ' +
|
|
20040
20063
|
* system.currentTick +
|
|
20041
|
-
* (tripWireTripEvent.sources.length > 0 ?
|
|
20064
|
+
* (tripWireTripEvent.sources.length > 0 ? ' by entity ' + tripWireTripEvent.sources[0].id : '')
|
|
20042
20065
|
* );
|
|
20043
20066
|
* }
|
|
20044
20067
|
* });
|
|
@@ -20217,23 +20240,23 @@ export class World {
|
|
|
20217
20240
|
*
|
|
20218
20241
|
* @example customCommand.ts
|
|
20219
20242
|
* ```typescript
|
|
20220
|
-
* import { world, DimensionLocation } from
|
|
20243
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
20221
20244
|
*
|
|
20222
20245
|
* function customCommand(targetLocation: DimensionLocation) {
|
|
20223
|
-
* const chatCallback = world.beforeEvents.chatSend.subscribe(
|
|
20224
|
-
* if (eventData.message.includes(
|
|
20246
|
+
* const chatCallback = world.beforeEvents.chatSend.subscribe(eventData => {
|
|
20247
|
+
* if (eventData.message.includes('cancel')) {
|
|
20225
20248
|
* // Cancel event if the message contains "cancel"
|
|
20226
20249
|
* eventData.cancel = true;
|
|
20227
20250
|
* } else {
|
|
20228
|
-
* const args = eventData.message.split(
|
|
20251
|
+
* const args = eventData.message.split(' ');
|
|
20229
20252
|
*
|
|
20230
20253
|
* if (args.length > 0) {
|
|
20231
20254
|
* switch (args[0].toLowerCase()) {
|
|
20232
|
-
* case
|
|
20255
|
+
* case 'echo':
|
|
20233
20256
|
* // Send a modified version of chat message
|
|
20234
20257
|
* world.sendMessage(`Echo '${eventData.message.substring(4).trim()}'`);
|
|
20235
20258
|
* break;
|
|
20236
|
-
* case
|
|
20259
|
+
* case 'help':
|
|
20237
20260
|
* world.sendMessage(`Available commands: echo <message>`);
|
|
20238
20261
|
* break;
|
|
20239
20262
|
* }
|
|
@@ -20259,7 +20282,6 @@ export class World {
|
|
|
20259
20282
|
*/
|
|
20260
20283
|
readonly scoreboard: Scoreboard;
|
|
20261
20284
|
/**
|
|
20262
|
-
* @rc
|
|
20263
20285
|
* @remarks
|
|
20264
20286
|
* The world seed.
|
|
20265
20287
|
*
|
|
@@ -20272,7 +20294,6 @@ export class World {
|
|
|
20272
20294
|
*/
|
|
20273
20295
|
readonly structureManager: StructureManager;
|
|
20274
20296
|
/**
|
|
20275
|
-
* @rc
|
|
20276
20297
|
* @remarks
|
|
20277
20298
|
* Manager for adding, removing and querying pack specific
|
|
20278
20299
|
* ticking areas.
|
|
@@ -20293,7 +20314,6 @@ export class World {
|
|
|
20293
20314
|
*/
|
|
20294
20315
|
getAbsoluteTime(): number;
|
|
20295
20316
|
/**
|
|
20296
|
-
* @rc
|
|
20297
20317
|
* @remarks
|
|
20298
20318
|
* The aim-assist presets and categories that can be used in
|
|
20299
20319
|
* the world.
|
|
@@ -20365,68 +20385,65 @@ export class World {
|
|
|
20365
20385
|
* defined.
|
|
20366
20386
|
* @example incrementDynamicProperty.ts
|
|
20367
20387
|
* ```typescript
|
|
20368
|
-
* import { world, DimensionLocation } from
|
|
20388
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
20369
20389
|
*
|
|
20370
|
-
* function incrementDynamicProperty(
|
|
20371
|
-
*
|
|
20372
|
-
* targetLocation: DimensionLocation
|
|
20373
|
-
* ) {
|
|
20374
|
-
* let number = world.getDynamicProperty("samplelibrary:number");
|
|
20390
|
+
* function incrementDynamicProperty(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
20391
|
+
* let number = world.getDynamicProperty('samplelibrary:number');
|
|
20375
20392
|
*
|
|
20376
|
-
* log(
|
|
20393
|
+
* log('Current value is: ' + number);
|
|
20377
20394
|
*
|
|
20378
20395
|
* if (number === undefined) {
|
|
20379
20396
|
* number = 0;
|
|
20380
20397
|
* }
|
|
20381
20398
|
*
|
|
20382
|
-
* if (typeof number !==
|
|
20383
|
-
* log(
|
|
20399
|
+
* if (typeof number !== 'number') {
|
|
20400
|
+
* log('Number is of an unexpected type.');
|
|
20384
20401
|
* return -1;
|
|
20385
20402
|
* }
|
|
20386
20403
|
*
|
|
20387
|
-
* world.setDynamicProperty(
|
|
20404
|
+
* world.setDynamicProperty('samplelibrary:number', number + 1);
|
|
20388
20405
|
* }
|
|
20389
20406
|
* ```
|
|
20390
20407
|
* @example incrementDynamicPropertyInJsonBlob.ts
|
|
20391
20408
|
* ```typescript
|
|
20392
|
-
* import { world, DimensionLocation } from
|
|
20409
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
20393
20410
|
*
|
|
20394
20411
|
* function incrementDynamicPropertyInJsonBlob(
|
|
20395
20412
|
* log: (message: string, status?: number) => void,
|
|
20396
20413
|
* targetLocation: DimensionLocation
|
|
20397
20414
|
* ) {
|
|
20398
|
-
* let paintStr = world.getDynamicProperty(
|
|
20415
|
+
* let paintStr = world.getDynamicProperty('samplelibrary:longerjson');
|
|
20399
20416
|
* let paint: { color: string; intensity: number } | undefined = undefined;
|
|
20400
20417
|
*
|
|
20401
|
-
* log(
|
|
20418
|
+
* log('Current value is: ' + paintStr);
|
|
20402
20419
|
*
|
|
20403
20420
|
* if (paintStr === undefined) {
|
|
20404
20421
|
* paint = {
|
|
20405
|
-
* color:
|
|
20422
|
+
* color: 'purple',
|
|
20406
20423
|
* intensity: 0,
|
|
20407
20424
|
* };
|
|
20408
20425
|
* } else {
|
|
20409
|
-
* if (typeof paintStr !==
|
|
20410
|
-
* log(
|
|
20426
|
+
* if (typeof paintStr !== 'string') {
|
|
20427
|
+
* log('Paint is of an unexpected type.');
|
|
20411
20428
|
* return -1;
|
|
20412
20429
|
* }
|
|
20413
20430
|
*
|
|
20414
20431
|
* try {
|
|
20415
20432
|
* paint = JSON.parse(paintStr);
|
|
20416
20433
|
* } catch (e) {
|
|
20417
|
-
* log(
|
|
20434
|
+
* log('Error parsing serialized struct.');
|
|
20418
20435
|
* return -1;
|
|
20419
20436
|
* }
|
|
20420
20437
|
* }
|
|
20421
20438
|
*
|
|
20422
20439
|
* if (!paint) {
|
|
20423
|
-
* log(
|
|
20440
|
+
* log('Error parsing serialized struct.');
|
|
20424
20441
|
* return -1;
|
|
20425
20442
|
* }
|
|
20426
20443
|
*
|
|
20427
20444
|
* paint.intensity++;
|
|
20428
20445
|
* paintStr = JSON.stringify(paint); // be very careful to ensure your serialized JSON str cannot exceed limits
|
|
20429
|
-
* world.setDynamicProperty(
|
|
20446
|
+
* world.setDynamicProperty('samplelibrary:longerjson', paintStr);
|
|
20430
20447
|
* }
|
|
20431
20448
|
* ```
|
|
20432
20449
|
*/
|
|
@@ -20513,7 +20530,7 @@ export class World {
|
|
|
20513
20530
|
* {@link minecraftcommon.PropertyOutOfBoundsError}
|
|
20514
20531
|
* @example playMusicAndSound.ts
|
|
20515
20532
|
* ```typescript
|
|
20516
|
-
* import { world, MusicOptions, WorldSoundOptions, PlayerSoundOptions, DimensionLocation } from
|
|
20533
|
+
* import { world, MusicOptions, WorldSoundOptions, PlayerSoundOptions, DimensionLocation } from '@minecraft/server';
|
|
20517
20534
|
*
|
|
20518
20535
|
* function playMusicAndSound(targetLocation: DimensionLocation) {
|
|
20519
20536
|
* const players = world.getPlayers();
|
|
@@ -20523,20 +20540,20 @@ export class World {
|
|
|
20523
20540
|
* loop: true,
|
|
20524
20541
|
* volume: 1.0,
|
|
20525
20542
|
* };
|
|
20526
|
-
* world.playMusic(
|
|
20543
|
+
* world.playMusic('music.menu', musicOptions);
|
|
20527
20544
|
*
|
|
20528
20545
|
* const worldSoundOptions: WorldSoundOptions = {
|
|
20529
20546
|
* pitch: 0.5,
|
|
20530
20547
|
* volume: 4.0,
|
|
20531
20548
|
* };
|
|
20532
|
-
* world.playSound(
|
|
20549
|
+
* world.playSound('ambient.weather.thunder', targetLocation, worldSoundOptions);
|
|
20533
20550
|
*
|
|
20534
20551
|
* const playerSoundOptions: PlayerSoundOptions = {
|
|
20535
20552
|
* pitch: 1.0,
|
|
20536
20553
|
* volume: 1.0,
|
|
20537
20554
|
* };
|
|
20538
20555
|
*
|
|
20539
|
-
* players[0].playSound(
|
|
20556
|
+
* players[0].playSound('bucket.fill_water', playerSoundOptions);
|
|
20540
20557
|
* }
|
|
20541
20558
|
* ```
|
|
20542
20559
|
*/
|
|
@@ -20638,68 +20655,65 @@ export class World {
|
|
|
20638
20655
|
* {@link minecraftcommon.ArgumentOutOfBoundsError}
|
|
20639
20656
|
* @example incrementDynamicProperty.ts
|
|
20640
20657
|
* ```typescript
|
|
20641
|
-
* import { world, DimensionLocation } from
|
|
20658
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
20642
20659
|
*
|
|
20643
|
-
* function incrementDynamicProperty(
|
|
20644
|
-
*
|
|
20645
|
-
* targetLocation: DimensionLocation
|
|
20646
|
-
* ) {
|
|
20647
|
-
* let number = world.getDynamicProperty("samplelibrary:number");
|
|
20660
|
+
* function incrementDynamicProperty(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
20661
|
+
* let number = world.getDynamicProperty('samplelibrary:number');
|
|
20648
20662
|
*
|
|
20649
|
-
* log(
|
|
20663
|
+
* log('Current value is: ' + number);
|
|
20650
20664
|
*
|
|
20651
20665
|
* if (number === undefined) {
|
|
20652
20666
|
* number = 0;
|
|
20653
20667
|
* }
|
|
20654
20668
|
*
|
|
20655
|
-
* if (typeof number !==
|
|
20656
|
-
* log(
|
|
20669
|
+
* if (typeof number !== 'number') {
|
|
20670
|
+
* log('Number is of an unexpected type.');
|
|
20657
20671
|
* return -1;
|
|
20658
20672
|
* }
|
|
20659
20673
|
*
|
|
20660
|
-
* world.setDynamicProperty(
|
|
20674
|
+
* world.setDynamicProperty('samplelibrary:number', number + 1);
|
|
20661
20675
|
* }
|
|
20662
20676
|
* ```
|
|
20663
20677
|
* @example incrementDynamicPropertyInJsonBlob.ts
|
|
20664
20678
|
* ```typescript
|
|
20665
|
-
* import { world, DimensionLocation } from
|
|
20679
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
20666
20680
|
*
|
|
20667
20681
|
* function incrementDynamicPropertyInJsonBlob(
|
|
20668
20682
|
* log: (message: string, status?: number) => void,
|
|
20669
20683
|
* targetLocation: DimensionLocation
|
|
20670
20684
|
* ) {
|
|
20671
|
-
* let paintStr = world.getDynamicProperty(
|
|
20685
|
+
* let paintStr = world.getDynamicProperty('samplelibrary:longerjson');
|
|
20672
20686
|
* let paint: { color: string; intensity: number } | undefined = undefined;
|
|
20673
20687
|
*
|
|
20674
|
-
* log(
|
|
20688
|
+
* log('Current value is: ' + paintStr);
|
|
20675
20689
|
*
|
|
20676
20690
|
* if (paintStr === undefined) {
|
|
20677
20691
|
* paint = {
|
|
20678
|
-
* color:
|
|
20692
|
+
* color: 'purple',
|
|
20679
20693
|
* intensity: 0,
|
|
20680
20694
|
* };
|
|
20681
20695
|
* } else {
|
|
20682
|
-
* if (typeof paintStr !==
|
|
20683
|
-
* log(
|
|
20696
|
+
* if (typeof paintStr !== 'string') {
|
|
20697
|
+
* log('Paint is of an unexpected type.');
|
|
20684
20698
|
* return -1;
|
|
20685
20699
|
* }
|
|
20686
20700
|
*
|
|
20687
20701
|
* try {
|
|
20688
20702
|
* paint = JSON.parse(paintStr);
|
|
20689
20703
|
* } catch (e) {
|
|
20690
|
-
* log(
|
|
20704
|
+
* log('Error parsing serialized struct.');
|
|
20691
20705
|
* return -1;
|
|
20692
20706
|
* }
|
|
20693
20707
|
* }
|
|
20694
20708
|
*
|
|
20695
20709
|
* if (!paint) {
|
|
20696
|
-
* log(
|
|
20710
|
+
* log('Error parsing serialized struct.');
|
|
20697
20711
|
* return -1;
|
|
20698
20712
|
* }
|
|
20699
20713
|
*
|
|
20700
20714
|
* paint.intensity++;
|
|
20701
20715
|
* paintStr = JSON.stringify(paint); // be very careful to ensure your serialized JSON str cannot exceed limits
|
|
20702
|
-
* world.setDynamicProperty(
|
|
20716
|
+
* world.setDynamicProperty('samplelibrary:longerjson', paintStr);
|
|
20703
20717
|
* }
|
|
20704
20718
|
* ```
|
|
20705
20719
|
*/
|
|
@@ -20779,7 +20793,6 @@ export class WorldAfterEvents {
|
|
|
20779
20793
|
*/
|
|
20780
20794
|
readonly entityDie: EntityDieAfterEventSignal;
|
|
20781
20795
|
/**
|
|
20782
|
-
* @rc
|
|
20783
20796
|
* @remarks
|
|
20784
20797
|
* This property can be read in early-execution mode.
|
|
20785
20798
|
*
|
|
@@ -20812,7 +20825,6 @@ export class WorldAfterEvents {
|
|
|
20812
20825
|
*/
|
|
20813
20826
|
readonly entityHitEntity: EntityHitEntityAfterEventSignal;
|
|
20814
20827
|
/**
|
|
20815
|
-
* @rc
|
|
20816
20828
|
* @remarks
|
|
20817
20829
|
* This event fires when an entity is hurt (takes damage).
|
|
20818
20830
|
*
|
|
@@ -20821,7 +20833,6 @@ export class WorldAfterEvents {
|
|
|
20821
20833
|
*/
|
|
20822
20834
|
readonly entityHurt: EntityHurtAfterEventSignal;
|
|
20823
20835
|
/**
|
|
20824
|
-
* @rc
|
|
20825
20836
|
* @remarks
|
|
20826
20837
|
* This event fires when an entity drops items.
|
|
20827
20838
|
*
|
|
@@ -20830,7 +20841,6 @@ export class WorldAfterEvents {
|
|
|
20830
20841
|
*/
|
|
20831
20842
|
readonly entityItemDrop: EntityItemDropAfterEventSignal;
|
|
20832
20843
|
/**
|
|
20833
|
-
* @rc
|
|
20834
20844
|
* @remarks
|
|
20835
20845
|
* This event fires when an entity picks up items.
|
|
20836
20846
|
*
|
|
@@ -21174,21 +21184,18 @@ export class WorldBeforeEvents {
|
|
|
21174
21184
|
*/
|
|
21175
21185
|
readonly effectAdd: EffectAddBeforeEventSignal;
|
|
21176
21186
|
/**
|
|
21177
|
-
* @rc
|
|
21178
21187
|
* @remarks
|
|
21179
21188
|
* This property can be read in early-execution mode.
|
|
21180
21189
|
*
|
|
21181
21190
|
*/
|
|
21182
21191
|
readonly entityHeal: EntityHealBeforeEventSignal;
|
|
21183
21192
|
/**
|
|
21184
|
-
* @rc
|
|
21185
21193
|
* @remarks
|
|
21186
21194
|
* This property can be read in early-execution mode.
|
|
21187
21195
|
*
|
|
21188
21196
|
*/
|
|
21189
21197
|
readonly entityHurt: EntityHurtBeforeEventSignal;
|
|
21190
21198
|
/**
|
|
21191
|
-
* @rc
|
|
21192
21199
|
* @remarks
|
|
21193
21200
|
* This event fires before an entity picks up an item.
|
|
21194
21201
|
*
|
|
@@ -21313,7 +21320,6 @@ export interface AABB {
|
|
|
21313
21320
|
}
|
|
21314
21321
|
|
|
21315
21322
|
/**
|
|
21316
|
-
* @rc
|
|
21317
21323
|
* Used to create camera animations.
|
|
21318
21324
|
*/
|
|
21319
21325
|
export interface AnimationOptions {
|
|
@@ -21331,9 +21337,6 @@ export interface AnimationOptions {
|
|
|
21331
21337
|
totalTimeSeconds: number;
|
|
21332
21338
|
}
|
|
21333
21339
|
|
|
21334
|
-
/**
|
|
21335
|
-
* @rc
|
|
21336
|
-
*/
|
|
21337
21340
|
export interface BiomeFilter {
|
|
21338
21341
|
excludeBiomes?: string[];
|
|
21339
21342
|
excludeTags?: string[];
|
|
@@ -21400,7 +21403,6 @@ export interface BlockCustomComponent {
|
|
|
21400
21403
|
*/
|
|
21401
21404
|
onBreak?: (arg0: BlockComponentBlockBreakEvent, arg1: CustomComponentParameters) => void;
|
|
21402
21405
|
/**
|
|
21403
|
-
* @rc
|
|
21404
21406
|
* @remarks
|
|
21405
21407
|
* This function will be called when an entity fires an event
|
|
21406
21408
|
* to this block in the world.
|
|
@@ -21640,7 +21642,6 @@ export interface BlockRaycastOptions extends BlockFilter {
|
|
|
21640
21642
|
}
|
|
21641
21643
|
|
|
21642
21644
|
/**
|
|
21643
|
-
* @rc
|
|
21644
21645
|
* Used to attach the camera to a non player entity.
|
|
21645
21646
|
*/
|
|
21646
21647
|
export interface CameraAttachOptions {
|
|
@@ -22235,7 +22236,6 @@ export interface EntityFilter {
|
|
|
22235
22236
|
}
|
|
22236
22237
|
|
|
22237
22238
|
/**
|
|
22238
|
-
* @rc
|
|
22239
22239
|
* Contains optional parameters for registering an entity heal
|
|
22240
22240
|
* event.
|
|
22241
22241
|
*/
|
|
@@ -22270,7 +22270,6 @@ export interface EntityHitInformation {
|
|
|
22270
22270
|
}
|
|
22271
22271
|
|
|
22272
22272
|
/**
|
|
22273
|
-
* @rc
|
|
22274
22273
|
* Contains optional parameters for registering an entity hurt
|
|
22275
22274
|
* after event.
|
|
22276
22275
|
*/
|
|
@@ -22306,7 +22305,6 @@ export interface EntityHurtAfterEventOptions {
|
|
|
22306
22305
|
}
|
|
22307
22306
|
|
|
22308
22307
|
/**
|
|
22309
|
-
* @rc
|
|
22310
22308
|
* Contains optional parameters for registering an entity hurt
|
|
22311
22309
|
* before event.
|
|
22312
22310
|
*/
|
|
@@ -22328,11 +22326,9 @@ export interface EntityHurtBeforeEventOptions {
|
|
|
22328
22326
|
}
|
|
22329
22327
|
|
|
22330
22328
|
/**
|
|
22331
|
-
* @rc
|
|
22332
22329
|
* An interface that is passed into {@link
|
|
22333
|
-
*
|
|
22334
|
-
*
|
|
22335
|
-
* callback.
|
|
22330
|
+
* EntityItemDropAfterEventSignal.subscribe} that filters out
|
|
22331
|
+
* which events are passed to the provided callback.
|
|
22336
22332
|
*/
|
|
22337
22333
|
export interface EntityItemDropEventOptions {
|
|
22338
22334
|
/**
|
|
@@ -22352,13 +22348,10 @@ export interface EntityItemDropEventOptions {
|
|
|
22352
22348
|
}
|
|
22353
22349
|
|
|
22354
22350
|
/**
|
|
22355
|
-
* @rc
|
|
22356
22351
|
* An interface that is passed into {@link
|
|
22357
|
-
*
|
|
22358
|
-
*
|
|
22359
|
-
*
|
|
22360
|
-
* that filters out which events are passed to the provided
|
|
22361
|
-
* callback.
|
|
22352
|
+
* EntityItemPickupAfterEventSignal.subscribe} and {@link
|
|
22353
|
+
* EntityItemPickupBeforeEventSignal.subscribe} that filters
|
|
22354
|
+
* out which events are passed to the provided callback.
|
|
22362
22355
|
*/
|
|
22363
22356
|
export interface EntityItemPickupEventOptions {
|
|
22364
22357
|
/**
|
|
@@ -22381,37 +22374,35 @@ export interface EntityItemPickupEventOptions {
|
|
|
22381
22374
|
* Contains options for selecting entities within an area.
|
|
22382
22375
|
* @example blockConditional.ts
|
|
22383
22376
|
* ```typescript
|
|
22384
|
-
* import { DimensionLocation } from
|
|
22377
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
22385
22378
|
*
|
|
22386
22379
|
* function blockConditional(targetLocation: DimensionLocation) {
|
|
22387
22380
|
* targetLocation.dimension
|
|
22388
22381
|
* .getEntities({
|
|
22389
|
-
* type:
|
|
22382
|
+
* type: 'fox',
|
|
22390
22383
|
* })
|
|
22391
|
-
* .filter(
|
|
22384
|
+
* .filter(entity => {
|
|
22392
22385
|
* const block = targetLocation.dimension.getBlock({
|
|
22393
22386
|
* x: entity.location.x,
|
|
22394
22387
|
* y: entity.location.y - 1,
|
|
22395
22388
|
* z: entity.location.z,
|
|
22396
22389
|
* });
|
|
22397
22390
|
*
|
|
22398
|
-
* return block !== undefined && block.matches(
|
|
22391
|
+
* return block !== undefined && block.matches('minecraft:stone');
|
|
22399
22392
|
* })
|
|
22400
|
-
* .forEach(
|
|
22401
|
-
* targetLocation.dimension.spawnEntity(
|
|
22393
|
+
* .forEach(entity => {
|
|
22394
|
+
* targetLocation.dimension.spawnEntity('salmon', entity.location);
|
|
22402
22395
|
* });
|
|
22403
22396
|
* }
|
|
22404
22397
|
* ```
|
|
22405
22398
|
* @example findEntitiesHavingPropertyEqualsTo.ts
|
|
22406
22399
|
* ```typescript
|
|
22407
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
22400
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
22408
22401
|
*
|
|
22409
|
-
* function findEntitiesHavingPropertyEqualsTo(
|
|
22410
|
-
* targetLocation: DimensionLocation
|
|
22411
|
-
* ) {
|
|
22402
|
+
* function findEntitiesHavingPropertyEqualsTo(targetLocation: DimensionLocation) {
|
|
22412
22403
|
* // Minecraft bees have a has_nectar boolean property
|
|
22413
22404
|
* const queryOption: EntityQueryOptions = {
|
|
22414
|
-
* propertyOptions: [{ propertyId:
|
|
22405
|
+
* propertyOptions: [{ propertyId: 'minecraft:has_nectar', value: { equals: true } }],
|
|
22415
22406
|
* };
|
|
22416
22407
|
*
|
|
22417
22408
|
* const entities = targetLocation.dimension.getEntities(queryOption);
|
|
@@ -22419,38 +22410,36 @@ export interface EntityItemPickupEventOptions {
|
|
|
22419
22410
|
* ```
|
|
22420
22411
|
* @example playSoundChained.ts
|
|
22421
22412
|
* ```typescript
|
|
22422
|
-
* import { DimensionLocation } from
|
|
22413
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
22423
22414
|
*
|
|
22424
22415
|
* function playSoundChained(targetLocation: DimensionLocation) {
|
|
22425
22416
|
* const targetPlayers = targetLocation.dimension.getPlayers();
|
|
22426
22417
|
* const originEntities = targetLocation.dimension.getEntities({
|
|
22427
|
-
* type:
|
|
22428
|
-
* name:
|
|
22429
|
-
* tags: [
|
|
22430
|
-
* excludeTags: [
|
|
22418
|
+
* type: 'armor_stand',
|
|
22419
|
+
* name: 'myArmorStand',
|
|
22420
|
+
* tags: ['dummyTag1'],
|
|
22421
|
+
* excludeTags: ['dummyTag2'],
|
|
22431
22422
|
* });
|
|
22432
22423
|
*
|
|
22433
|
-
* originEntities.forEach(
|
|
22434
|
-
* targetPlayers.forEach(
|
|
22435
|
-
* player.playSound(
|
|
22424
|
+
* originEntities.forEach(entity => {
|
|
22425
|
+
* targetPlayers.forEach(player => {
|
|
22426
|
+
* player.playSound('raid.horn');
|
|
22436
22427
|
* });
|
|
22437
22428
|
* });
|
|
22438
22429
|
* }
|
|
22439
22430
|
* ```
|
|
22440
22431
|
* @example setScoreboardChained.ts
|
|
22441
22432
|
* ```typescript
|
|
22442
|
-
* import { world, DimensionLocation } from
|
|
22433
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
22443
22434
|
*
|
|
22444
|
-
* function setScoreboardChained(
|
|
22445
|
-
*
|
|
22446
|
-
* ) {
|
|
22447
|
-
* const objective = world.scoreboard.addObjective("scoreObjective1", "dummy");
|
|
22435
|
+
* function setScoreboardChained(targetLocation: DimensionLocation) {
|
|
22436
|
+
* const objective = world.scoreboard.addObjective('scoreObjective1', 'dummy');
|
|
22448
22437
|
* targetLocation.dimension
|
|
22449
22438
|
* .getEntities({
|
|
22450
|
-
* type:
|
|
22451
|
-
* name:
|
|
22439
|
+
* type: 'armor_stand',
|
|
22440
|
+
* name: 'myArmorStand',
|
|
22452
22441
|
* })
|
|
22453
|
-
* .forEach(
|
|
22442
|
+
* .forEach(entity => {
|
|
22454
22443
|
* if (entity.scoreboardIdentity !== undefined) {
|
|
22455
22444
|
* objective.setScore(entity.scoreboardIdentity, -1);
|
|
22456
22445
|
* }
|
|
@@ -22459,20 +22448,20 @@ export interface EntityItemPickupEventOptions {
|
|
|
22459
22448
|
* ```
|
|
22460
22449
|
* @example summonMobChained.ts
|
|
22461
22450
|
* ```typescript
|
|
22462
|
-
* import { DimensionLocation } from
|
|
22451
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
22463
22452
|
*
|
|
22464
22453
|
* function summonMobChained(targetLocation: DimensionLocation) {
|
|
22465
22454
|
* const armorStandArray = targetLocation.dimension.getEntities({
|
|
22466
|
-
* type:
|
|
22455
|
+
* type: 'armor_stand',
|
|
22467
22456
|
* });
|
|
22468
22457
|
* const playerArray = targetLocation.dimension.getPlayers({
|
|
22469
22458
|
* location: { x: 0, y: -60, z: 0 },
|
|
22470
22459
|
* closest: 4,
|
|
22471
22460
|
* maxDistance: 15,
|
|
22472
22461
|
* });
|
|
22473
|
-
* armorStandArray.forEach(
|
|
22474
|
-
* playerArray.forEach(
|
|
22475
|
-
* targetLocation.dimension.spawnEntity(
|
|
22462
|
+
* armorStandArray.forEach(entity => {
|
|
22463
|
+
* playerArray.forEach(player => {
|
|
22464
|
+
* targetLocation.dimension.spawnEntity('pig', {
|
|
22476
22465
|
* x: player.location.x + 1,
|
|
22477
22466
|
* y: player.location.y,
|
|
22478
22467
|
* z: player.location.z,
|
|
@@ -22483,10 +22472,10 @@ export interface EntityItemPickupEventOptions {
|
|
|
22483
22472
|
* ```
|
|
22484
22473
|
* @example bounceSkeletons.ts
|
|
22485
22474
|
* ```typescript
|
|
22486
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
22475
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
22487
22476
|
*
|
|
22488
22477
|
* function bounceSkeletons(targetLocation: DimensionLocation) {
|
|
22489
|
-
* const mobs = [
|
|
22478
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
22490
22479
|
*
|
|
22491
22480
|
* // create some sample mob data
|
|
22492
22481
|
* for (let i = 0; i < 10; i++) {
|
|
@@ -22494,7 +22483,7 @@ export interface EntityItemPickupEventOptions {
|
|
|
22494
22483
|
* }
|
|
22495
22484
|
*
|
|
22496
22485
|
* const eqo: EntityQueryOptions = {
|
|
22497
|
-
* type:
|
|
22486
|
+
* type: 'skeleton',
|
|
22498
22487
|
* };
|
|
22499
22488
|
*
|
|
22500
22489
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -22504,20 +22493,20 @@ export interface EntityItemPickupEventOptions {
|
|
|
22504
22493
|
* ```
|
|
22505
22494
|
* @example tagsQuery.ts
|
|
22506
22495
|
* ```typescript
|
|
22507
|
-
* import { EntityQueryOptions, DimensionLocation } from
|
|
22496
|
+
* import { EntityQueryOptions, DimensionLocation } from '@minecraft/server';
|
|
22508
22497
|
*
|
|
22509
22498
|
* function tagsQuery(targetLocation: DimensionLocation) {
|
|
22510
|
-
* const mobs = [
|
|
22499
|
+
* const mobs = ['creeper', 'skeleton', 'sheep'];
|
|
22511
22500
|
*
|
|
22512
22501
|
* // create some sample mob data
|
|
22513
22502
|
* for (let i = 0; i < 10; i++) {
|
|
22514
22503
|
* const mobTypeId = mobs[i % mobs.length];
|
|
22515
22504
|
* const entity = targetLocation.dimension.spawnEntity(mobTypeId, targetLocation);
|
|
22516
|
-
* entity.addTag(
|
|
22505
|
+
* entity.addTag('mobparty.' + mobTypeId);
|
|
22517
22506
|
* }
|
|
22518
22507
|
*
|
|
22519
22508
|
* const eqo: EntityQueryOptions = {
|
|
22520
|
-
* tags: [
|
|
22509
|
+
* tags: ['mobparty.skeleton'],
|
|
22521
22510
|
* };
|
|
22522
22511
|
*
|
|
22523
22512
|
* for (const entity of targetLocation.dimension.getEntities(eqo)) {
|
|
@@ -22527,7 +22516,7 @@ export interface EntityItemPickupEventOptions {
|
|
|
22527
22516
|
* ```
|
|
22528
22517
|
* @example testThatEntityIsFeatherItem.ts
|
|
22529
22518
|
* ```typescript
|
|
22530
|
-
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from
|
|
22519
|
+
* import { EntityItemComponent, EntityComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
22531
22520
|
*
|
|
22532
22521
|
* function testThatEntityIsFeatherItem(
|
|
22533
22522
|
* log: (message: string, status?: number) => void,
|
|
@@ -22542,8 +22531,8 @@ export interface EntityItemPickupEventOptions {
|
|
|
22542
22531
|
* const itemComp = item.getComponent(EntityComponentTypes.Item) as EntityItemComponent;
|
|
22543
22532
|
*
|
|
22544
22533
|
* if (itemComp) {
|
|
22545
|
-
* if (itemComp.itemStack.typeId.endsWith(
|
|
22546
|
-
* log(
|
|
22534
|
+
* if (itemComp.itemStack.typeId.endsWith('feather')) {
|
|
22535
|
+
* log('Success! Found a feather', 1);
|
|
22547
22536
|
* }
|
|
22548
22537
|
* }
|
|
22549
22538
|
* }
|
|
@@ -22720,33 +22709,30 @@ export interface EqualsComparison {
|
|
|
22720
22709
|
* Dimension.createExplosion} method.
|
|
22721
22710
|
* @example createNoBlockExplosion.ts
|
|
22722
22711
|
* ```typescript
|
|
22723
|
-
* import { DimensionLocation } from
|
|
22724
|
-
* import { Vector3Utils } from
|
|
22712
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
22713
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
22725
22714
|
*
|
|
22726
|
-
* function createNoBlockExplosion(
|
|
22727
|
-
* log: (message: string, status?: number) => void,
|
|
22728
|
-
* targetLocation: DimensionLocation
|
|
22729
|
-
* ) {
|
|
22715
|
+
* function createNoBlockExplosion(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
22730
22716
|
* const explodeNoBlocksLoc = Vector3Utils.floor(Vector3Utils.add(targetLocation, { x: 1, y: 2, z: 1 }));
|
|
22731
22717
|
*
|
|
22732
|
-
* log(
|
|
22718
|
+
* log('Creating an explosion of radius 15 that does not break blocks.');
|
|
22733
22719
|
* targetLocation.dimension.createExplosion(explodeNoBlocksLoc, 15, { breaksBlocks: false });
|
|
22734
22720
|
* }
|
|
22735
22721
|
* ```
|
|
22736
22722
|
* @example createExplosions.ts
|
|
22737
22723
|
* ```typescript
|
|
22738
|
-
* import { DimensionLocation } from
|
|
22739
|
-
* import { Vector3Utils } from
|
|
22724
|
+
* import { DimensionLocation } from '@minecraft/server';
|
|
22725
|
+
* import { Vector3Utils } from '@minecraft/math';
|
|
22740
22726
|
*
|
|
22741
22727
|
* function createExplosions(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
22742
22728
|
* const explosionLoc = Vector3Utils.add(targetLocation, { x: 0.5, y: 0.5, z: 0.5 });
|
|
22743
22729
|
*
|
|
22744
|
-
* log(
|
|
22730
|
+
* log('Creating an explosion of radius 15 that causes fire.');
|
|
22745
22731
|
* targetLocation.dimension.createExplosion(explosionLoc, 15, { causesFire: true });
|
|
22746
22732
|
*
|
|
22747
22733
|
* const belowWaterLoc = Vector3Utils.add(targetLocation, { x: 3, y: 1, z: 3 });
|
|
22748
22734
|
*
|
|
22749
|
-
* log(
|
|
22735
|
+
* log('Creating an explosion of radius 10 that can go underwater.');
|
|
22750
22736
|
* targetLocation.dimension.createExplosion(belowWaterLoc, 10, { allowUnderwater: true });
|
|
22751
22737
|
* }
|
|
22752
22738
|
* ```
|
|
@@ -22842,9 +22828,8 @@ export interface HotbarEventOptions {
|
|
|
22842
22828
|
|
|
22843
22829
|
/**
|
|
22844
22830
|
* An interface that is passed into {@link
|
|
22845
|
-
*
|
|
22846
|
-
*
|
|
22847
|
-
* callback.
|
|
22831
|
+
* PlayerButtonInputAfterEventSignal.subscribe} that filters
|
|
22832
|
+
* out which events are passed to the provided callback.
|
|
22848
22833
|
*/
|
|
22849
22834
|
export interface InputEventOptions {
|
|
22850
22835
|
/**
|
|
@@ -22977,7 +22962,6 @@ export interface ItemCustomComponent {
|
|
|
22977
22962
|
}
|
|
22978
22963
|
|
|
22979
22964
|
/**
|
|
22980
|
-
* @rc
|
|
22981
22965
|
* Contains options for filtering items.
|
|
22982
22966
|
*/
|
|
22983
22967
|
export interface ItemFilter {
|
|
@@ -23153,7 +23137,6 @@ export interface PlayAnimationOptions {
|
|
|
23153
23137
|
}
|
|
23154
23138
|
|
|
23155
23139
|
/**
|
|
23156
|
-
* @rc
|
|
23157
23140
|
* Settings relating to a player's aim-assist targeting.
|
|
23158
23141
|
*/
|
|
23159
23142
|
export interface PlayerAimAssistSettings {
|
|
@@ -23211,7 +23194,7 @@ export interface PlayerSoundOptions {
|
|
|
23211
23194
|
|
|
23212
23195
|
/**
|
|
23213
23196
|
* An interface that is passed into {@link
|
|
23214
|
-
* @minecraft/
|
|
23197
|
+
* @minecraft/server.PlayerSwingStartAfterEvent.subscribe} that
|
|
23215
23198
|
* filters out which events are passed to the provided
|
|
23216
23199
|
* callback.
|
|
23217
23200
|
*/
|
|
@@ -23235,7 +23218,6 @@ export interface PlayerSwingEventOptions {
|
|
|
23235
23218
|
}
|
|
23236
23219
|
|
|
23237
23220
|
/**
|
|
23238
|
-
* @rc
|
|
23239
23221
|
* Key frame that holds the progress of the camera animation.
|
|
23240
23222
|
*/
|
|
23241
23223
|
export interface ProgressKeyFrame {
|
|
@@ -23301,49 +23283,46 @@ export interface RangeComparison {
|
|
|
23301
23283
|
* import { DimensionLocation, world, BlockPermutation, BlockComponentTypes } from '@minecraft/server';
|
|
23302
23284
|
*
|
|
23303
23285
|
* function placeTranslatedSign(location: DimensionLocation, text: string) {
|
|
23304
|
-
*
|
|
23286
|
+
* const signBlock = location.dimension.getBlock(location);
|
|
23305
23287
|
*
|
|
23306
|
-
*
|
|
23307
|
-
*
|
|
23308
|
-
*
|
|
23309
|
-
*
|
|
23310
|
-
*
|
|
23311
|
-
*
|
|
23288
|
+
* if (!signBlock) {
|
|
23289
|
+
* console.warn('Could not find a block at specified location.');
|
|
23290
|
+
* return;
|
|
23291
|
+
* }
|
|
23292
|
+
* const signPerm = BlockPermutation.resolve('minecraft:standing_sign', { ground_sign_direction: 8 });
|
|
23293
|
+
* signBlock.setPermutation(signPerm);
|
|
23312
23294
|
*
|
|
23313
|
-
*
|
|
23314
|
-
*
|
|
23315
|
-
*
|
|
23316
|
-
*
|
|
23317
|
-
*
|
|
23318
|
-
*
|
|
23295
|
+
* const signComponent = signBlock.getComponent(BlockComponentTypes.Sign);
|
|
23296
|
+
* if (signComponent) {
|
|
23297
|
+
* signComponent.setText({ translate: 'item.skull.player.name', with: [text] });
|
|
23298
|
+
* } else {
|
|
23299
|
+
* console.error('Could not find a sign component on the block.');
|
|
23300
|
+
* }
|
|
23319
23301
|
* }
|
|
23320
23302
|
*
|
|
23321
23303
|
* placeTranslatedSign(
|
|
23322
|
-
*
|
|
23323
|
-
*
|
|
23324
|
-
*
|
|
23325
|
-
*
|
|
23326
|
-
*
|
|
23327
|
-
*
|
|
23328
|
-
*
|
|
23304
|
+
* {
|
|
23305
|
+
* dimension: world.getDimension('overworld'),
|
|
23306
|
+
* x: 0,
|
|
23307
|
+
* y: 0,
|
|
23308
|
+
* z: 0,
|
|
23309
|
+
* },
|
|
23310
|
+
* 'Steve'
|
|
23329
23311
|
* );
|
|
23330
23312
|
* ```
|
|
23331
23313
|
* @example showTranslatedMessageForm.ts
|
|
23332
23314
|
* ```typescript
|
|
23333
|
-
* import { world, DimensionLocation } from
|
|
23334
|
-
* import { MessageFormResponse, MessageFormData } from
|
|
23315
|
+
* import { world, DimensionLocation } from '@minecraft/server';
|
|
23316
|
+
* import { MessageFormResponse, MessageFormData } from '@minecraft/server-ui';
|
|
23335
23317
|
*
|
|
23336
|
-
* function showTranslatedMessageForm(
|
|
23337
|
-
* log: (message: string, status?: number) => void,
|
|
23338
|
-
* targetLocation: DimensionLocation
|
|
23339
|
-
* ) {
|
|
23318
|
+
* function showTranslatedMessageForm(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
23340
23319
|
* const players = world.getPlayers();
|
|
23341
23320
|
*
|
|
23342
23321
|
* const messageForm = new MessageFormData()
|
|
23343
|
-
* .title({ translate:
|
|
23344
|
-
* .body({ translate:
|
|
23345
|
-
* .button1(
|
|
23346
|
-
* .button2(
|
|
23322
|
+
* .title({ translate: 'permissions.removeplayer' })
|
|
23323
|
+
* .body({ translate: 'accessibility.list.or.two', with: ['Player 1', 'Player 2'] })
|
|
23324
|
+
* .button1('Player 1')
|
|
23325
|
+
* .button2('Player 2');
|
|
23347
23326
|
*
|
|
23348
23327
|
* messageForm
|
|
23349
23328
|
* .show(players[0])
|
|
@@ -23353,18 +23332,18 @@ export interface RangeComparison {
|
|
|
23353
23332
|
* return;
|
|
23354
23333
|
* }
|
|
23355
23334
|
*
|
|
23356
|
-
* log(`You selected ${formData.selection === 0 ?
|
|
23335
|
+
* log(`You selected ${formData.selection === 0 ? 'Player 1' : 'Player 2'}`);
|
|
23357
23336
|
* })
|
|
23358
23337
|
* .catch((error: Error) => {
|
|
23359
|
-
* log(
|
|
23338
|
+
* log('Failed to show form: ' + error);
|
|
23360
23339
|
* return -1;
|
|
23361
23340
|
* });
|
|
23362
23341
|
* }
|
|
23363
23342
|
* ```
|
|
23364
23343
|
* @example addTranslatedSign.ts
|
|
23365
23344
|
* ```typescript
|
|
23366
|
-
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from
|
|
23367
|
-
* import { MinecraftBlockTypes } from
|
|
23345
|
+
* import { world, BlockPermutation, BlockSignComponent, BlockComponentTypes, DimensionLocation } from '@minecraft/server';
|
|
23346
|
+
* import { MinecraftBlockTypes } from '@minecraft/vanilla-data';
|
|
23368
23347
|
*
|
|
23369
23348
|
* function addTranslatedSign(log: (message: string, status?: number) => void, targetLocation: DimensionLocation) {
|
|
23370
23349
|
* const players = world.getPlayers();
|
|
@@ -23374,7 +23353,7 @@ export interface RangeComparison {
|
|
|
23374
23353
|
* const signBlock = dim.getBlock(targetLocation);
|
|
23375
23354
|
*
|
|
23376
23355
|
* if (!signBlock) {
|
|
23377
|
-
* log(
|
|
23356
|
+
* log('Could not find a block at specified location.');
|
|
23378
23357
|
* return -1;
|
|
23379
23358
|
* }
|
|
23380
23359
|
* const signPerm = BlockPermutation.resolve(MinecraftBlockTypes.StandingSign, { ground_sign_direction: 8 });
|
|
@@ -23383,7 +23362,7 @@ export interface RangeComparison {
|
|
|
23383
23362
|
*
|
|
23384
23363
|
* const signComponent = signBlock.getComponent(BlockComponentTypes.Sign) as BlockSignComponent;
|
|
23385
23364
|
*
|
|
23386
|
-
* signComponent?.setText({ translate:
|
|
23365
|
+
* signComponent?.setText({ translate: 'item.skull.player.name', with: [players[0].name] });
|
|
23387
23366
|
* }
|
|
23388
23367
|
* ```
|
|
23389
23368
|
*/
|
|
@@ -23502,7 +23481,6 @@ export interface RGBA extends RGB {
|
|
|
23502
23481
|
}
|
|
23503
23482
|
|
|
23504
23483
|
/**
|
|
23505
|
-
* @rc
|
|
23506
23484
|
* Key frame that holds the rotation of the camera animation.
|
|
23507
23485
|
*/
|
|
23508
23486
|
export interface RotationKeyFrame {
|
|
@@ -23589,7 +23567,6 @@ export interface SpawnEntityOptions {
|
|
|
23589
23567
|
}
|
|
23590
23568
|
|
|
23591
23569
|
/**
|
|
23592
|
-
* @rc
|
|
23593
23570
|
* Collection of key frames for camera animation.
|
|
23594
23571
|
*/
|
|
23595
23572
|
export interface SplineAnimation {
|
|
@@ -23710,8 +23687,8 @@ export interface StructurePlaceOptions {
|
|
|
23710
23687
|
* Contains additional options for teleporting an entity.
|
|
23711
23688
|
* @example teleport.ts
|
|
23712
23689
|
* ```typescript
|
|
23713
|
-
* import { system, DimensionLocation } from
|
|
23714
|
-
* import { MinecraftEntityTypes } from
|
|
23690
|
+
* import { system, DimensionLocation } from '@minecraft/server';
|
|
23691
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
23715
23692
|
*
|
|
23716
23693
|
* function teleport(targetLocation: DimensionLocation) {
|
|
23717
23694
|
* const cow = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Cow, targetLocation);
|
|
@@ -23728,8 +23705,8 @@ export interface StructurePlaceOptions {
|
|
|
23728
23705
|
* ```
|
|
23729
23706
|
* @example teleportMovement.ts
|
|
23730
23707
|
* ```typescript
|
|
23731
|
-
* import { system, DimensionLocation } from
|
|
23732
|
-
* import { MinecraftEntityTypes } from
|
|
23708
|
+
* import { system, DimensionLocation } from '@minecraft/server';
|
|
23709
|
+
* import { MinecraftEntityTypes } from '@minecraft/vanilla-data';
|
|
23733
23710
|
*
|
|
23734
23711
|
* function teleportMovement(targetLocation: DimensionLocation) {
|
|
23735
23712
|
* const pig = targetLocation.dimension.spawnEntity(MinecraftEntityTypes.Pig, targetLocation);
|
|
@@ -23788,7 +23765,6 @@ export interface TeleportOptions {
|
|
|
23788
23765
|
}
|
|
23789
23766
|
|
|
23790
23767
|
/**
|
|
23791
|
-
* @rc
|
|
23792
23768
|
* A context which provides information about a specific
|
|
23793
23769
|
* ticking area.
|
|
23794
23770
|
*/
|
|
@@ -23828,7 +23804,6 @@ export interface TickingArea {
|
|
|
23828
23804
|
}
|
|
23829
23805
|
|
|
23830
23806
|
/**
|
|
23831
|
-
* @rc
|
|
23832
23807
|
* Options to create a ticking area using the {@link
|
|
23833
23808
|
* TickingAreaManager}.
|
|
23834
23809
|
*/
|
|
@@ -24121,6 +24096,16 @@ export class InvalidContainerSlotError extends Error {
|
|
|
24121
24096
|
private constructor();
|
|
24122
24097
|
}
|
|
24123
24098
|
|
|
24099
|
+
/**
|
|
24100
|
+
* @rc
|
|
24101
|
+
* This error can occur when accessing components on an entity
|
|
24102
|
+
* that doesn't have them.
|
|
24103
|
+
*/
|
|
24104
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
24105
|
+
export class InvalidEntityComponentError extends Error {
|
|
24106
|
+
private constructor();
|
|
24107
|
+
}
|
|
24108
|
+
|
|
24124
24109
|
/**
|
|
24125
24110
|
* The error called when an entity is invalid. This can occur
|
|
24126
24111
|
* when accessing components on a removed entity.
|
|
@@ -24269,7 +24254,6 @@ export class RawMessageError extends Error {
|
|
|
24269
24254
|
}
|
|
24270
24255
|
|
|
24271
24256
|
/**
|
|
24272
|
-
* @rc
|
|
24273
24257
|
* The error returned from invalid {@link TickingAreaManager}
|
|
24274
24258
|
* method calls.
|
|
24275
24259
|
*/
|