@minecraft/server 1.9.0-beta.1.20.60-preview.23 → 1.9.0-beta.1.20.60-preview.25
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 +594 -74
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -37,11 +37,36 @@ export enum BlockComponentTypes {
|
|
|
37
37
|
|
|
38
38
|
/**
|
|
39
39
|
* @beta
|
|
40
|
+
* An enumeration describing the state of a block piston.
|
|
40
41
|
*/
|
|
41
42
|
export enum BlockPistonState {
|
|
43
|
+
/**
|
|
44
|
+
* @beta
|
|
45
|
+
* @remarks
|
|
46
|
+
* Whether the piston is fully expanded.
|
|
47
|
+
*
|
|
48
|
+
*/
|
|
42
49
|
Expanded = 'Expanded',
|
|
50
|
+
/**
|
|
51
|
+
* @beta
|
|
52
|
+
* @remarks
|
|
53
|
+
* Whether the piston is in the process of expanding.
|
|
54
|
+
*
|
|
55
|
+
*/
|
|
43
56
|
Expanding = 'Expanding',
|
|
57
|
+
/**
|
|
58
|
+
* @beta
|
|
59
|
+
* @remarks
|
|
60
|
+
* Whether the piston is fully retracted.
|
|
61
|
+
*
|
|
62
|
+
*/
|
|
44
63
|
Retracted = 'Retracted',
|
|
64
|
+
/**
|
|
65
|
+
* @beta
|
|
66
|
+
* @remarks
|
|
67
|
+
* Whether the piston is in the process of retracting.
|
|
68
|
+
*
|
|
69
|
+
*/
|
|
45
70
|
Retracting = 'Retracting',
|
|
46
71
|
}
|
|
47
72
|
|
|
@@ -861,11 +886,37 @@ export enum GameMode {
|
|
|
861
886
|
|
|
862
887
|
/**
|
|
863
888
|
* @beta
|
|
889
|
+
* The types of item components that are accessible via
|
|
890
|
+
* function ItemStack.getComponent.
|
|
864
891
|
*/
|
|
865
892
|
export enum ItemComponentTypes {
|
|
893
|
+
/**
|
|
894
|
+
* @beta
|
|
895
|
+
* @remarks
|
|
896
|
+
* The minecraft:cooldown component.
|
|
897
|
+
*
|
|
898
|
+
*/
|
|
866
899
|
Cooldown = 'minecraft:cooldown',
|
|
900
|
+
/**
|
|
901
|
+
* @beta
|
|
902
|
+
* @remarks
|
|
903
|
+
* The minecraft:durability component.
|
|
904
|
+
*
|
|
905
|
+
*/
|
|
867
906
|
Durability = 'minecraft:durability',
|
|
907
|
+
/**
|
|
908
|
+
* @beta
|
|
909
|
+
* @remarks
|
|
910
|
+
* The minecraft:enchantable component.
|
|
911
|
+
*
|
|
912
|
+
*/
|
|
868
913
|
Enchantable = 'minecraft:enchantable',
|
|
914
|
+
/**
|
|
915
|
+
* @beta
|
|
916
|
+
* @remarks
|
|
917
|
+
* The minecraft:food component.
|
|
918
|
+
*
|
|
919
|
+
*/
|
|
869
920
|
Food = 'minecraft:food',
|
|
870
921
|
}
|
|
871
922
|
|
|
@@ -1325,6 +1376,23 @@ export type ItemComponentTypeMap = {
|
|
|
1325
1376
|
'minecraft:food': ItemFoodComponent;
|
|
1326
1377
|
};
|
|
1327
1378
|
|
|
1379
|
+
/**
|
|
1380
|
+
* @beta
|
|
1381
|
+
*/
|
|
1382
|
+
export class BiomeType {
|
|
1383
|
+
private constructor();
|
|
1384
|
+
readonly id: string;
|
|
1385
|
+
}
|
|
1386
|
+
|
|
1387
|
+
/**
|
|
1388
|
+
* @beta
|
|
1389
|
+
*/
|
|
1390
|
+
export class BiomeTypes {
|
|
1391
|
+
private constructor();
|
|
1392
|
+
static get(typeName: string): BiomeType | undefined;
|
|
1393
|
+
static getAll(): BiomeType[];
|
|
1394
|
+
}
|
|
1395
|
+
|
|
1328
1396
|
/**
|
|
1329
1397
|
* Represents a block in a dimension. A block represents a
|
|
1330
1398
|
* unique X, Y, and Z within a dimension and get/sets the state
|
|
@@ -1384,10 +1452,13 @@ export class Block {
|
|
|
1384
1452
|
* @remarks
|
|
1385
1453
|
* Returns or sets whether this block has a liquid on it.
|
|
1386
1454
|
*
|
|
1387
|
-
* This property can
|
|
1455
|
+
* @throws This property can throw when used.
|
|
1456
|
+
*
|
|
1457
|
+
* {@link LocationInUnloadedChunkError}
|
|
1388
1458
|
*
|
|
1459
|
+
* {@link LocationOutOfWorldBoundariesError}
|
|
1389
1460
|
*/
|
|
1390
|
-
isWaterlogged: boolean;
|
|
1461
|
+
readonly isWaterlogged: boolean;
|
|
1391
1462
|
/**
|
|
1392
1463
|
* @remarks
|
|
1393
1464
|
* Coordinates of the specified block.
|
|
@@ -1640,6 +1711,17 @@ export class Block {
|
|
|
1640
1711
|
* True if this block object is still working and valid.
|
|
1641
1712
|
*/
|
|
1642
1713
|
isValid(): boolean;
|
|
1714
|
+
/**
|
|
1715
|
+
* @beta
|
|
1716
|
+
* @throws This function can throw errors.
|
|
1717
|
+
*
|
|
1718
|
+
* {@link Error}
|
|
1719
|
+
*
|
|
1720
|
+
* {@link LocationInUnloadedChunkError}
|
|
1721
|
+
*
|
|
1722
|
+
* {@link LocationOutOfWorldBoundariesError}
|
|
1723
|
+
*/
|
|
1724
|
+
matches(blockName: string, states?: Record<string, boolean | number | string>): boolean;
|
|
1643
1725
|
/**
|
|
1644
1726
|
* @remarks
|
|
1645
1727
|
* Returns the {@link Block} to the north of this block
|
|
@@ -1708,6 +1790,20 @@ export class Block {
|
|
|
1708
1790
|
* {@link LocationOutOfWorldBoundariesError}
|
|
1709
1791
|
*/
|
|
1710
1792
|
setType(blockType: BlockType | string): void;
|
|
1793
|
+
/**
|
|
1794
|
+
* @beta
|
|
1795
|
+
* @remarks
|
|
1796
|
+
* This function can't be called in read-only mode.
|
|
1797
|
+
*
|
|
1798
|
+
* @throws This function can throw errors.
|
|
1799
|
+
*
|
|
1800
|
+
* {@link Error}
|
|
1801
|
+
*
|
|
1802
|
+
* {@link LocationInUnloadedChunkError}
|
|
1803
|
+
*
|
|
1804
|
+
* {@link LocationOutOfWorldBoundariesError}
|
|
1805
|
+
*/
|
|
1806
|
+
setWaterlogged(isWaterlogged: boolean): void;
|
|
1711
1807
|
/**
|
|
1712
1808
|
* @remarks
|
|
1713
1809
|
* Returns the {@link Block} to the south of this block
|
|
@@ -2156,6 +2252,9 @@ export class BlockPistonComponent extends BlockComponent {
|
|
|
2156
2252
|
*/
|
|
2157
2253
|
readonly isMoving: boolean;
|
|
2158
2254
|
/**
|
|
2255
|
+
* @remarks
|
|
2256
|
+
* The current state of the piston.
|
|
2257
|
+
*
|
|
2159
2258
|
* @throws This property can throw when used.
|
|
2160
2259
|
*/
|
|
2161
2260
|
readonly state: BlockPistonState;
|
|
@@ -2169,6 +2268,10 @@ export class BlockPistonComponent extends BlockComponent {
|
|
|
2169
2268
|
*/
|
|
2170
2269
|
getAttachedBlocks(): Block[];
|
|
2171
2270
|
/**
|
|
2271
|
+
* @remarks
|
|
2272
|
+
* Retrieves a set of block locations that this piston is
|
|
2273
|
+
* connected with.
|
|
2274
|
+
*
|
|
2172
2275
|
* @throws This function can throw errors.
|
|
2173
2276
|
*/
|
|
2174
2277
|
getAttachedBlocksLocations(): Vector3[];
|
|
@@ -2300,30 +2403,53 @@ export class BlockSignComponent extends BlockComponent {
|
|
|
2300
2403
|
* The side of the sign the message will be set on. If not
|
|
2301
2404
|
* provided, the message will be set on the front side of the
|
|
2302
2405
|
* sign.
|
|
2303
|
-
* @throws
|
|
2406
|
+
* @throws
|
|
2407
|
+
* Throws if the provided message is greater than 512
|
|
2408
|
+
* characters in length.
|
|
2304
2409
|
* @example SetRawMessage.ts
|
|
2305
2410
|
* ```typescript
|
|
2306
|
-
* const
|
|
2411
|
+
* const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
|
|
2412
|
+
* const block = world.getDimension("overworld").getBlock(signLocation);
|
|
2413
|
+
* if (!block) {
|
|
2414
|
+
* world.sendMessage("Could not find a block at specified location.");
|
|
2415
|
+
* return;
|
|
2416
|
+
* }
|
|
2417
|
+
* const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
|
|
2418
|
+
* const helloWorldMessage: RawMessage = { text: "Hello World" };
|
|
2307
2419
|
* sign.setText(helloWorldMessage);
|
|
2308
2420
|
*
|
|
2309
2421
|
* // Sign text will be saved as a RawText
|
|
2310
|
-
* const result
|
|
2311
|
-
* JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
|
|
2422
|
+
* const result = sign.getRawText();
|
|
2423
|
+
* world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
|
|
2312
2424
|
* ```
|
|
2313
2425
|
* @example SetRawText.ts
|
|
2314
2426
|
* ```typescript
|
|
2315
|
-
* const
|
|
2427
|
+
* const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
|
|
2428
|
+
* const block = world.getDimension("overworld").getBlock(signLocation);
|
|
2429
|
+
* if (!block) {
|
|
2430
|
+
* world.sendMessage("Could not find a block at specified location.");
|
|
2431
|
+
* return;
|
|
2432
|
+
* }
|
|
2433
|
+
* const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
|
|
2434
|
+
* const helloWorldText: RawText = { rawtext: [{ text: "Hello World" }] };
|
|
2316
2435
|
* sign.setText(helloWorldText);
|
|
2317
2436
|
*
|
|
2318
2437
|
* // There will be no data transformation unlike calling setText with a RawMessage
|
|
2319
|
-
* const result
|
|
2320
|
-
* JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
|
|
2438
|
+
* const result = sign.getRawText();
|
|
2439
|
+
* world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
|
|
2321
2440
|
* ```
|
|
2322
2441
|
* @example SetString.ts
|
|
2323
2442
|
* ```typescript
|
|
2443
|
+
* const signLocation: Vector3 = { x: 0, y: -60, z: 0 }; // Replace with your sign's coordinates
|
|
2444
|
+
* const block = world.getDimension("overworld").getBlock(signLocation);
|
|
2445
|
+
* if (!block) {
|
|
2446
|
+
* world.sendMessage("Could not find a block at specified location.");
|
|
2447
|
+
* return;
|
|
2448
|
+
* }
|
|
2449
|
+
* const sign = block.getComponent("minecraft:sign") as BlockSignComponent;
|
|
2324
2450
|
* // Set sign to say 'Hello'
|
|
2325
|
-
* sign.setText(
|
|
2326
|
-
* sign.getText(); // 'Hello'
|
|
2451
|
+
* sign.setText("Hello World");
|
|
2452
|
+
* world.sendMessage(sign.getText() ?? "undefined"); // 'Hello World'
|
|
2327
2453
|
* ```
|
|
2328
2454
|
*/
|
|
2329
2455
|
setText(message: RawMessage | RawText | string, side?: SignSide): void;
|
|
@@ -3484,6 +3610,8 @@ export class ContainerSlot {
|
|
|
3484
3610
|
*
|
|
3485
3611
|
* @throws
|
|
3486
3612
|
* Throws if the slot's container is invalid.
|
|
3613
|
+
*
|
|
3614
|
+
* {@link InvalidContainerSlotError}
|
|
3487
3615
|
*/
|
|
3488
3616
|
readonly isStackable: boolean;
|
|
3489
3617
|
/**
|
|
@@ -3515,6 +3643,8 @@ export class ContainerSlot {
|
|
|
3515
3643
|
*
|
|
3516
3644
|
* @throws
|
|
3517
3645
|
* Throws if the slot's container is invalid.
|
|
3646
|
+
*
|
|
3647
|
+
* {@link InvalidContainerSlotError}
|
|
3518
3648
|
*/
|
|
3519
3649
|
readonly maxAmount: number;
|
|
3520
3650
|
/**
|
|
@@ -3536,6 +3666,10 @@ export class ContainerSlot {
|
|
|
3536
3666
|
*
|
|
3537
3667
|
* @throws
|
|
3538
3668
|
* Throws if the slot's container is invalid.
|
|
3669
|
+
*
|
|
3670
|
+
* {@link minecraftcommon.EngineError}
|
|
3671
|
+
*
|
|
3672
|
+
* {@link InvalidContainerSlotError}
|
|
3539
3673
|
*/
|
|
3540
3674
|
readonly 'type': ItemType;
|
|
3541
3675
|
/**
|
|
@@ -3546,22 +3680,74 @@ export class ContainerSlot {
|
|
|
3546
3680
|
*
|
|
3547
3681
|
* @throws
|
|
3548
3682
|
* Throws if the slot's container is invalid.
|
|
3683
|
+
*
|
|
3684
|
+
* {@link InvalidContainerSlotError}
|
|
3549
3685
|
*/
|
|
3550
|
-
readonly typeId
|
|
3686
|
+
readonly typeId: string;
|
|
3551
3687
|
/**
|
|
3552
|
-
* @
|
|
3688
|
+
* @remarks
|
|
3689
|
+
* Clears all dynamic properties that have been set on this
|
|
3690
|
+
* item stack.
|
|
3691
|
+
*
|
|
3692
|
+
* @throws
|
|
3693
|
+
* Throws if the slot's container is invalid.
|
|
3694
|
+
*
|
|
3695
|
+
* {@link InvalidContainerSlotError}
|
|
3553
3696
|
*/
|
|
3554
3697
|
clearDynamicProperties(): void;
|
|
3555
3698
|
/**
|
|
3556
3699
|
* @throws This function can throw errors.
|
|
3700
|
+
*
|
|
3701
|
+
* {@link InvalidContainerSlotError}
|
|
3557
3702
|
*/
|
|
3558
|
-
|
|
3703
|
+
getCanDestroy(): string[];
|
|
3559
3704
|
/**
|
|
3560
3705
|
* @throws This function can throw errors.
|
|
3706
|
+
*
|
|
3707
|
+
* {@link InvalidContainerSlotError}
|
|
3708
|
+
*/
|
|
3709
|
+
getCanPlaceOn(): string[];
|
|
3710
|
+
/**
|
|
3711
|
+
* @remarks
|
|
3712
|
+
* Returns a property value.
|
|
3713
|
+
*
|
|
3714
|
+
* @param identifier
|
|
3715
|
+
* The property identifier.
|
|
3716
|
+
* @returns
|
|
3717
|
+
* Returns the value for the property, or undefined if the
|
|
3718
|
+
* property has not been set.
|
|
3719
|
+
* @throws
|
|
3720
|
+
* Throws if the slot's container is invalid.
|
|
3721
|
+
*
|
|
3722
|
+
* {@link InvalidContainerSlotError}
|
|
3723
|
+
*/
|
|
3724
|
+
getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
|
|
3725
|
+
/**
|
|
3726
|
+
* @remarks
|
|
3727
|
+
* Returns the available set of dynamic property identifiers
|
|
3728
|
+
* that have been used on this item stack.
|
|
3729
|
+
*
|
|
3730
|
+
* @returns
|
|
3731
|
+
* A string array of the dynamic properties set on this entity.
|
|
3732
|
+
* @throws
|
|
3733
|
+
* Throws if the slot's container is invalid.
|
|
3734
|
+
*
|
|
3735
|
+
* {@link InvalidContainerSlotError}
|
|
3561
3736
|
*/
|
|
3562
3737
|
getDynamicPropertyIds(): string[];
|
|
3563
3738
|
/**
|
|
3564
|
-
* @
|
|
3739
|
+
* @remarks
|
|
3740
|
+
* Returns the total size, in bytes, of all the dynamic
|
|
3741
|
+
* properties that are currently stored for this entity. This
|
|
3742
|
+
* includes the size of both the key and the value. This can
|
|
3743
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
3744
|
+
* example, an entity has many megabytes of associated dynamic
|
|
3745
|
+
* properties, it may be slow to load on various devices.
|
|
3746
|
+
*
|
|
3747
|
+
* @throws
|
|
3748
|
+
* Throws if the slot's container is invalid.
|
|
3749
|
+
*
|
|
3750
|
+
* {@link InvalidContainerSlotError}
|
|
3565
3751
|
*/
|
|
3566
3752
|
getDynamicPropertyTotalByteCount(): number;
|
|
3567
3753
|
/**
|
|
@@ -3572,7 +3758,10 @@ export class ContainerSlot {
|
|
|
3572
3758
|
* @returns
|
|
3573
3759
|
* Returns a copy of the item in the slot. Returns undefined if
|
|
3574
3760
|
* the slot is empty.
|
|
3575
|
-
* @throws
|
|
3761
|
+
* @throws
|
|
3762
|
+
* Throws if the slot's container is invalid.
|
|
3763
|
+
*
|
|
3764
|
+
* {@link InvalidContainerSlotError}
|
|
3576
3765
|
*/
|
|
3577
3766
|
getItem(): ItemStack | undefined;
|
|
3578
3767
|
/**
|
|
@@ -3585,6 +3774,8 @@ export class ContainerSlot {
|
|
|
3585
3774
|
* returns an empty array.
|
|
3586
3775
|
* @throws
|
|
3587
3776
|
* Throws if the slot's container is invalid.
|
|
3777
|
+
*
|
|
3778
|
+
* {@link InvalidContainerSlotError}
|
|
3588
3779
|
*/
|
|
3589
3780
|
getLore(): string[];
|
|
3590
3781
|
/**
|
|
@@ -3594,9 +3785,18 @@ export class ContainerSlot {
|
|
|
3594
3785
|
* @returns
|
|
3595
3786
|
* Returns all tags for the item in the slot. Return an empty
|
|
3596
3787
|
* array if the the slot is empty.
|
|
3597
|
-
* @throws
|
|
3788
|
+
* @throws
|
|
3789
|
+
* Throws if the slot's container is invalid.
|
|
3790
|
+
*
|
|
3791
|
+
* {@link InvalidContainerSlotError}
|
|
3598
3792
|
*/
|
|
3599
3793
|
getTags(): string[];
|
|
3794
|
+
/**
|
|
3795
|
+
* @throws This function can throw errors.
|
|
3796
|
+
*
|
|
3797
|
+
* {@link InvalidContainerSlotError}
|
|
3798
|
+
*/
|
|
3799
|
+
hasItem(): boolean;
|
|
3600
3800
|
/**
|
|
3601
3801
|
* @remarks
|
|
3602
3802
|
* Returns whether the item in the slot slot has the given tag.
|
|
@@ -3606,7 +3806,10 @@ export class ContainerSlot {
|
|
|
3606
3806
|
* @returns
|
|
3607
3807
|
* Returns false when the slot is empty or the item in the slot
|
|
3608
3808
|
* does not have the given tag.
|
|
3609
|
-
* @throws
|
|
3809
|
+
* @throws
|
|
3810
|
+
* Throws if the slot's container is invalid.
|
|
3811
|
+
*
|
|
3812
|
+
* {@link InvalidContainerSlotError}
|
|
3610
3813
|
*/
|
|
3611
3814
|
hasTag(tag: string): boolean;
|
|
3612
3815
|
/**
|
|
@@ -3624,6 +3827,8 @@ export class ContainerSlot {
|
|
|
3624
3827
|
* given `itemStack`.
|
|
3625
3828
|
* @throws
|
|
3626
3829
|
* Throws if the slot's container is invalid.
|
|
3830
|
+
*
|
|
3831
|
+
* {@link InvalidContainerSlotError}
|
|
3627
3832
|
*/
|
|
3628
3833
|
isStackableWith(itemStack: ItemStack): boolean;
|
|
3629
3834
|
/**
|
|
@@ -3647,6 +3852,10 @@ export class ContainerSlot {
|
|
|
3647
3852
|
* @throws
|
|
3648
3853
|
* Throws if the slot's container is invalid. Also throws if
|
|
3649
3854
|
* any of the provided block identifiers are invalid.
|
|
3855
|
+
*
|
|
3856
|
+
* {@link Error}
|
|
3857
|
+
*
|
|
3858
|
+
* {@link InvalidContainerSlotError}
|
|
3650
3859
|
*/
|
|
3651
3860
|
setCanDestroy(blockIdentifiers?: string[]): void;
|
|
3652
3861
|
/**
|
|
@@ -3663,10 +3872,26 @@ export class ContainerSlot {
|
|
|
3663
3872
|
* @throws
|
|
3664
3873
|
* Throws if the slot's container is invalid. Also throws if
|
|
3665
3874
|
* any of the provided block identifiers are invalid.
|
|
3875
|
+
*
|
|
3876
|
+
* {@link Error}
|
|
3877
|
+
*
|
|
3878
|
+
* {@link InvalidContainerSlotError}
|
|
3666
3879
|
*/
|
|
3667
3880
|
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
3668
3881
|
/**
|
|
3669
|
-
* @
|
|
3882
|
+
* @remarks
|
|
3883
|
+
* Sets a specified property to a value.
|
|
3884
|
+
*
|
|
3885
|
+
* @param identifier
|
|
3886
|
+
* The property identifier.
|
|
3887
|
+
* @param value
|
|
3888
|
+
* Data value of the property to set.
|
|
3889
|
+
* @throws
|
|
3890
|
+
* Throws if the slot's container is invalid.
|
|
3891
|
+
*
|
|
3892
|
+
* {@link Error}
|
|
3893
|
+
*
|
|
3894
|
+
* {@link InvalidContainerSlotError}
|
|
3670
3895
|
*/
|
|
3671
3896
|
setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
|
|
3672
3897
|
/**
|
|
@@ -3678,7 +3903,10 @@ export class ContainerSlot {
|
|
|
3678
3903
|
*
|
|
3679
3904
|
* @param itemStack
|
|
3680
3905
|
* The ItemStack to be placed in the slot.
|
|
3681
|
-
* @throws
|
|
3906
|
+
* @throws
|
|
3907
|
+
* Throws if the slot's container is invalid.
|
|
3908
|
+
*
|
|
3909
|
+
* {@link InvalidContainerSlotError}
|
|
3682
3910
|
*/
|
|
3683
3911
|
setItem(itemStack?: ItemStack): void;
|
|
3684
3912
|
/**
|
|
@@ -3693,6 +3921,10 @@ export class ContainerSlot {
|
|
|
3693
3921
|
* will clear the lore.
|
|
3694
3922
|
* @throws
|
|
3695
3923
|
* Throws if the slot's container is invalid.
|
|
3924
|
+
*
|
|
3925
|
+
* {@link Error}
|
|
3926
|
+
*
|
|
3927
|
+
* {@link InvalidContainerSlotError}
|
|
3696
3928
|
*/
|
|
3697
3929
|
setLore(loreList?: string[]): void;
|
|
3698
3930
|
}
|
|
@@ -3934,6 +4166,18 @@ export class Dimension {
|
|
|
3934
4166
|
block: BlockPermutation | BlockType | string,
|
|
3935
4167
|
options?: BlockFillOptions,
|
|
3936
4168
|
): number;
|
|
4169
|
+
/**
|
|
4170
|
+
* @beta
|
|
4171
|
+
* @remarks
|
|
4172
|
+
* This function can't be called in read-only mode.
|
|
4173
|
+
*
|
|
4174
|
+
* @throws This function can throw errors.
|
|
4175
|
+
*
|
|
4176
|
+
* {@link minecraftcommon.EngineError}
|
|
4177
|
+
*
|
|
4178
|
+
* {@link Error}
|
|
4179
|
+
*/
|
|
4180
|
+
findClosestBiome(pos: Vector3, biomeToFind: BiomeType | string, options?: BiomeSearchOptions): Vector3 | undefined;
|
|
3937
4181
|
/**
|
|
3938
4182
|
* @remarks
|
|
3939
4183
|
* Returns a block instance at the given location.
|
|
@@ -4549,7 +4793,8 @@ export class EnchantmentType {
|
|
|
4549
4793
|
|
|
4550
4794
|
/**
|
|
4551
4795
|
* @beta
|
|
4552
|
-
*
|
|
4796
|
+
* Contains a catalog of Minecraft Enchantment Types that are
|
|
4797
|
+
* available in this world.
|
|
4553
4798
|
*/
|
|
4554
4799
|
export class EnchantmentTypes {
|
|
4555
4800
|
private constructor();
|
|
@@ -5029,11 +5274,11 @@ export class Entity {
|
|
|
5029
5274
|
/**
|
|
5030
5275
|
* @remarks
|
|
5031
5276
|
* Returns the total size, in bytes, of all the dynamic
|
|
5032
|
-
* properties that are currently stored for this entity.
|
|
5033
|
-
*
|
|
5034
|
-
* for
|
|
5035
|
-
*
|
|
5036
|
-
* devices.
|
|
5277
|
+
* properties that are currently stored for this entity. This
|
|
5278
|
+
* includes the size of both the key and the value. This can
|
|
5279
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
5280
|
+
* example, an entity has many megabytes of associated dynamic
|
|
5281
|
+
* properties, it may be slow to load on various devices.
|
|
5037
5282
|
*
|
|
5038
5283
|
* @throws This function can throw errors.
|
|
5039
5284
|
*/
|
|
@@ -5115,8 +5360,10 @@ export class Entity {
|
|
|
5115
5360
|
getRotation(): Vector2;
|
|
5116
5361
|
/**
|
|
5117
5362
|
* @remarks
|
|
5363
|
+
* Returns all tags associated with the entity.
|
|
5364
|
+
*
|
|
5118
5365
|
* @returns
|
|
5119
|
-
*
|
|
5366
|
+
* An array containing all tags as strings.
|
|
5120
5367
|
* @throws This function can throw errors.
|
|
5121
5368
|
*/
|
|
5122
5369
|
getTags(): string[];
|
|
@@ -5220,10 +5467,13 @@ export class Entity {
|
|
|
5220
5467
|
* location of the entity for matching if the location is not
|
|
5221
5468
|
* specified in the passed in EntityQueryOptions.
|
|
5222
5469
|
*
|
|
5470
|
+
* @param options
|
|
5471
|
+
* The query to perform the match against.
|
|
5223
5472
|
* @returns
|
|
5224
5473
|
* Returns true if the entity matches the criteria in the
|
|
5225
5474
|
* passed in EntityQueryOptions, otherwise it returns false.
|
|
5226
|
-
* @throws
|
|
5475
|
+
* @throws
|
|
5476
|
+
* Throws if the query options are misconfigured.
|
|
5227
5477
|
*/
|
|
5228
5478
|
matches(options: EntityQueryOptions): boolean;
|
|
5229
5479
|
/**
|
|
@@ -7079,90 +7329,143 @@ export class EntityOnFireComponent extends EntityComponent {
|
|
|
7079
7329
|
|
|
7080
7330
|
/**
|
|
7081
7331
|
* @beta
|
|
7332
|
+
* The projectile component controls the properties of a
|
|
7333
|
+
* projectile entity and allows it to be shot in a given
|
|
7334
|
+
* direction.
|
|
7335
|
+
* This component is present when the entity has the
|
|
7336
|
+
* minecraft:projectile component.
|
|
7082
7337
|
*/
|
|
7083
7338
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
7084
7339
|
export class EntityProjectileComponent extends EntityComponent {
|
|
7085
7340
|
private constructor();
|
|
7086
7341
|
/**
|
|
7087
7342
|
* @remarks
|
|
7343
|
+
* The fraction of the projectile's speed maintained every tick
|
|
7344
|
+
* while traveling through air.
|
|
7345
|
+
*
|
|
7088
7346
|
* This property can't be edited in read-only mode.
|
|
7089
7347
|
*
|
|
7090
7348
|
*/
|
|
7091
7349
|
airInertia: number;
|
|
7092
7350
|
/**
|
|
7093
7351
|
* @remarks
|
|
7352
|
+
* If true, the entity will be set on fire when hurt. The
|
|
7353
|
+
* default burn duration is 5 seconds. This duration can be
|
|
7354
|
+
* modified via the onFireTime property. The entity will not
|
|
7355
|
+
* catch fire if immune or if the entity is wet.
|
|
7356
|
+
*
|
|
7094
7357
|
* This property can't be edited in read-only mode.
|
|
7095
7358
|
*
|
|
7096
7359
|
*/
|
|
7097
7360
|
catchFireOnHurt: boolean;
|
|
7098
7361
|
/**
|
|
7099
7362
|
* @remarks
|
|
7363
|
+
* If true, the projectile will spawn crit particles when hit
|
|
7364
|
+
* by a player. E.g. Player attacking a Shulker bullet.
|
|
7365
|
+
*
|
|
7100
7366
|
* This property can't be edited in read-only mode.
|
|
7101
7367
|
*
|
|
7102
7368
|
*/
|
|
7103
7369
|
critParticlesOnProjectileHurt: boolean;
|
|
7104
7370
|
/**
|
|
7105
7371
|
* @remarks
|
|
7372
|
+
* If true, the projectile will be destroyed when it takes
|
|
7373
|
+
* damage. E.g. Player attacking a Shulker bullet.
|
|
7374
|
+
*
|
|
7106
7375
|
* This property can't be edited in read-only mode.
|
|
7107
7376
|
*
|
|
7108
7377
|
*/
|
|
7109
7378
|
destroyOnProjectileHurt: boolean;
|
|
7110
7379
|
/**
|
|
7111
7380
|
* @remarks
|
|
7381
|
+
* The gravity applied to the projectile. When the entity is
|
|
7382
|
+
* not on the ground, subtracts this amount from the
|
|
7383
|
+
* projectile’s change in vertical position every tick. The
|
|
7384
|
+
* higher the value, the faster the projectile falls. If
|
|
7385
|
+
* negative, the entity will rise instead of fall.
|
|
7386
|
+
*
|
|
7112
7387
|
* This property can't be edited in read-only mode.
|
|
7113
7388
|
*
|
|
7114
7389
|
*/
|
|
7115
7390
|
gravity: number;
|
|
7116
7391
|
/**
|
|
7117
7392
|
* @remarks
|
|
7393
|
+
* The sound that plays when the projectile hits an entity.
|
|
7394
|
+
*
|
|
7118
7395
|
* This property can't be edited in read-only mode.
|
|
7119
7396
|
*
|
|
7120
7397
|
*/
|
|
7121
7398
|
hitEntitySound?: string;
|
|
7122
7399
|
/**
|
|
7123
7400
|
* @remarks
|
|
7401
|
+
* The sound that plays when the projectile hits a block.
|
|
7402
|
+
*
|
|
7124
7403
|
* This property can't be edited in read-only mode.
|
|
7125
7404
|
*
|
|
7126
7405
|
*/
|
|
7127
7406
|
hitGroundSound?: string;
|
|
7128
7407
|
/**
|
|
7129
7408
|
* @remarks
|
|
7409
|
+
* The particle that spawns when the projectile hits something.
|
|
7410
|
+
*
|
|
7130
7411
|
* This property can't be edited in read-only mode.
|
|
7131
7412
|
*
|
|
7132
7413
|
*/
|
|
7133
7414
|
hitParticle?: string;
|
|
7134
7415
|
/**
|
|
7135
7416
|
* @remarks
|
|
7417
|
+
* If true and the weather is thunder and the entity has line
|
|
7418
|
+
* of sight to the sky, the entity will be struck by lightning
|
|
7419
|
+
* when hit. E.g. A thrown Trident with the Channeling
|
|
7420
|
+
* enchantment.
|
|
7421
|
+
*
|
|
7136
7422
|
* This property can't be edited in read-only mode.
|
|
7137
7423
|
*
|
|
7138
7424
|
*/
|
|
7139
7425
|
lightningStrikeOnHit: boolean;
|
|
7140
7426
|
/**
|
|
7141
7427
|
* @remarks
|
|
7428
|
+
* The fraction of the projectile's speed maintained every tick
|
|
7429
|
+
* while traveling through a liquid.
|
|
7430
|
+
*
|
|
7142
7431
|
* This property can't be edited in read-only mode.
|
|
7143
7432
|
*
|
|
7144
7433
|
*/
|
|
7145
7434
|
liquidInertia: number;
|
|
7146
7435
|
/**
|
|
7147
7436
|
* @remarks
|
|
7437
|
+
* Duration in seconds that the entity hit will be on fire for
|
|
7438
|
+
* when catchFireOnHurt is set to true.
|
|
7439
|
+
*
|
|
7148
7440
|
* This property can't be edited in read-only mode.
|
|
7149
7441
|
*
|
|
7150
7442
|
*/
|
|
7151
7443
|
onFireTime: number;
|
|
7152
7444
|
/**
|
|
7153
7445
|
* @remarks
|
|
7446
|
+
* The owner of the projectile. This is used to determine what
|
|
7447
|
+
* the projectile can collide with and damage. It also
|
|
7448
|
+
* determines which entity is assigned as the attacker.
|
|
7449
|
+
*
|
|
7154
7450
|
* This property can't be edited in read-only mode.
|
|
7155
7451
|
*
|
|
7156
7452
|
*/
|
|
7157
7453
|
owner?: Entity;
|
|
7158
7454
|
/**
|
|
7159
7455
|
* @remarks
|
|
7456
|
+
* If true, the projectile will bounce off mobs when no damage
|
|
7457
|
+
* is taken. E.g. A spawning wither.
|
|
7458
|
+
*
|
|
7160
7459
|
* This property can't be edited in read-only mode.
|
|
7161
7460
|
*
|
|
7162
7461
|
*/
|
|
7163
7462
|
shouldBounceOnHit: boolean;
|
|
7164
7463
|
/**
|
|
7165
7464
|
* @remarks
|
|
7465
|
+
* If true, the projectile will stop moving when an entity is
|
|
7466
|
+
* hit as thought it had been blocked. E.g. Thrown trident on
|
|
7467
|
+
* hit behavior.
|
|
7468
|
+
*
|
|
7166
7469
|
* This property can't be edited in read-only mode.
|
|
7167
7470
|
*
|
|
7168
7471
|
*/
|
|
@@ -7170,9 +7473,18 @@ export class EntityProjectileComponent extends EntityComponent {
|
|
|
7170
7473
|
static readonly componentId = 'minecraft:projectile';
|
|
7171
7474
|
/**
|
|
7172
7475
|
* @remarks
|
|
7476
|
+
* Shoots the projectile with a given velocity. The projectile
|
|
7477
|
+
* will be shot from its current location.
|
|
7478
|
+
*
|
|
7173
7479
|
* This function can't be called in read-only mode.
|
|
7174
7480
|
*
|
|
7175
|
-
* @
|
|
7481
|
+
* @param velocity
|
|
7482
|
+
* The velocity to fire the projectile. This controls both the
|
|
7483
|
+
* speed and direction which which the projectile will be shot.
|
|
7484
|
+
* @param options
|
|
7485
|
+
* Optional configuration for the shoot.
|
|
7486
|
+
* @throws
|
|
7487
|
+
* Throws if the component or entity no longer exist.
|
|
7176
7488
|
*/
|
|
7177
7489
|
shoot(velocity: Vector3, options?: ProjectileShootOptions): void;
|
|
7178
7490
|
}
|
|
@@ -8104,7 +8416,7 @@ export class ItemCooldownComponent extends ItemComponent {
|
|
|
8104
8416
|
readonly cooldownCategory: string;
|
|
8105
8417
|
/**
|
|
8106
8418
|
* @remarks
|
|
8107
|
-
* Amount of time, in ticks,
|
|
8419
|
+
* Amount of time, in ticks, it will take this item to
|
|
8108
8420
|
* cooldown.
|
|
8109
8421
|
*
|
|
8110
8422
|
* @throws This property can throw when used.
|
|
@@ -8266,6 +8578,11 @@ export class ItemDurabilityComponent extends ItemComponent {
|
|
|
8266
8578
|
getDamageChance(unbreakingEnchantmentLevel?: number): number;
|
|
8267
8579
|
/**
|
|
8268
8580
|
* @remarks
|
|
8581
|
+
* Returns the min and max variables used by the damage chance
|
|
8582
|
+
* formula:
|
|
8583
|
+
* chance = (min + ((max - min) / (unbreaking + 1)))
|
|
8584
|
+
*
|
|
8585
|
+
*
|
|
8269
8586
|
* This function can't be called in read-only mode.
|
|
8270
8587
|
*
|
|
8271
8588
|
* @throws This function can throw errors.
|
|
@@ -8275,6 +8592,8 @@ export class ItemDurabilityComponent extends ItemComponent {
|
|
|
8275
8592
|
|
|
8276
8593
|
/**
|
|
8277
8594
|
* @beta
|
|
8595
|
+
* When present on an item, this item can have enchantments
|
|
8596
|
+
* applied to it.
|
|
8278
8597
|
*/
|
|
8279
8598
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
8280
8599
|
export class ItemEnchantableComponent extends ItemComponent {
|
|
@@ -8282,9 +8601,24 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8282
8601
|
static readonly componentId = 'minecraft:enchantable';
|
|
8283
8602
|
/**
|
|
8284
8603
|
* @remarks
|
|
8604
|
+
* Adds an enchantment to the item stack.
|
|
8605
|
+
*
|
|
8285
8606
|
* This function can't be called in read-only mode.
|
|
8286
8607
|
*
|
|
8287
|
-
* @
|
|
8608
|
+
* @param enchantment
|
|
8609
|
+
* The enchantment interface to be added.
|
|
8610
|
+
* @throws
|
|
8611
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8612
|
+
* enchantment type does not exist.
|
|
8613
|
+
*
|
|
8614
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8615
|
+
* if the enchantment level is outside the allowable range for
|
|
8616
|
+
* the given enchantment type.
|
|
8617
|
+
*
|
|
8618
|
+
* ScriptItemEnchantmentTypeNotCompatibleError: Exception
|
|
8619
|
+
* thrown if the enchantment is not compatible with the item
|
|
8620
|
+
* stack.
|
|
8621
|
+
*
|
|
8288
8622
|
*
|
|
8289
8623
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8290
8624
|
*
|
|
@@ -8297,9 +8631,24 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8297
8631
|
addEnchantment(enchantment: Enchantment): void;
|
|
8298
8632
|
/**
|
|
8299
8633
|
* @remarks
|
|
8634
|
+
* Adds a list of enchantments to the item stack.
|
|
8635
|
+
*
|
|
8300
8636
|
* This function can't be called in read-only mode.
|
|
8301
8637
|
*
|
|
8302
|
-
* @
|
|
8638
|
+
* @param enchantments
|
|
8639
|
+
* The list of enchantments to be added.
|
|
8640
|
+
* @throws
|
|
8641
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if any
|
|
8642
|
+
* enchantment type does not exist.
|
|
8643
|
+
*
|
|
8644
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8645
|
+
* if any enchantment level is outside the allowable range for
|
|
8646
|
+
* the given enchantment type.
|
|
8647
|
+
*
|
|
8648
|
+
* ScriptItemEnchantmentTypeNotCompatibleError: Exception
|
|
8649
|
+
* thrown if any enchantment is not compatible with the item
|
|
8650
|
+
* stack.
|
|
8651
|
+
*
|
|
8303
8652
|
*
|
|
8304
8653
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8305
8654
|
*
|
|
@@ -8311,7 +8660,23 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8311
8660
|
*/
|
|
8312
8661
|
addEnchantments(enchantments: Enchantment[]): void;
|
|
8313
8662
|
/**
|
|
8314
|
-
* @
|
|
8663
|
+
* @remarks
|
|
8664
|
+
* Checks whether an enchantment can be added to the item
|
|
8665
|
+
* stack.
|
|
8666
|
+
*
|
|
8667
|
+
* @param enchantment
|
|
8668
|
+
* The enchantment interface to be added.
|
|
8669
|
+
* @returns
|
|
8670
|
+
* Returns true if the enchantment can be added to the item
|
|
8671
|
+
* stack.
|
|
8672
|
+
* @throws
|
|
8673
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8674
|
+
* enchantment type does not exist.
|
|
8675
|
+
*
|
|
8676
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8677
|
+
* if the enchantment level is outside the allowable range for
|
|
8678
|
+
* the given enchantment type.
|
|
8679
|
+
*
|
|
8315
8680
|
*
|
|
8316
8681
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8317
8682
|
*
|
|
@@ -8319,23 +8684,50 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8319
8684
|
*/
|
|
8320
8685
|
canAddEnchantment(enchantment: Enchantment): boolean;
|
|
8321
8686
|
/**
|
|
8322
|
-
* @
|
|
8687
|
+
* @remarks
|
|
8688
|
+
* Gets the enchantment of a given type from the item stack.
|
|
8689
|
+
*
|
|
8690
|
+
* @param enchantmentType
|
|
8691
|
+
* The enchantment type to get.
|
|
8692
|
+
* @returns
|
|
8693
|
+
* Returns the enchantment if it exists on the item stack.
|
|
8694
|
+
* @throws
|
|
8695
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8696
|
+
* enchantment type does not exist.
|
|
8697
|
+
*
|
|
8323
8698
|
*
|
|
8324
8699
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8325
8700
|
*/
|
|
8326
8701
|
getEnchantment(enchantmentType: EnchantmentType | string): Enchantment | undefined;
|
|
8327
8702
|
/**
|
|
8703
|
+
* @remarks
|
|
8704
|
+
* Gets all enchantments on the item stack.
|
|
8705
|
+
*
|
|
8706
|
+
* @returns
|
|
8707
|
+
* Returns a list of enchantments on the item stack.
|
|
8328
8708
|
* @throws This function can throw errors.
|
|
8329
8709
|
*/
|
|
8330
8710
|
getEnchantments(): Enchantment[];
|
|
8331
8711
|
/**
|
|
8332
|
-
* @
|
|
8712
|
+
* @remarks
|
|
8713
|
+
* Checks whether an item stack has a given enchantment type.
|
|
8714
|
+
*
|
|
8715
|
+
* @param enchantmentType
|
|
8716
|
+
* The enchantment type to check for.
|
|
8717
|
+
* @returns
|
|
8718
|
+
* Returns true if the item stack has the enchantment type.
|
|
8719
|
+
* @throws
|
|
8720
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8721
|
+
* enchantment type does not exist.
|
|
8722
|
+
*
|
|
8333
8723
|
*
|
|
8334
8724
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8335
8725
|
*/
|
|
8336
8726
|
hasEnchantment(enchantmentType: EnchantmentType | string): boolean;
|
|
8337
8727
|
/**
|
|
8338
8728
|
* @remarks
|
|
8729
|
+
* Removes all enchantments applied to this item stack.
|
|
8730
|
+
*
|
|
8339
8731
|
* This function can't be called in read-only mode.
|
|
8340
8732
|
*
|
|
8341
8733
|
* @throws This function can throw errors.
|
|
@@ -8343,9 +8735,16 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8343
8735
|
removeAllEnchantments(): void;
|
|
8344
8736
|
/**
|
|
8345
8737
|
* @remarks
|
|
8738
|
+
* Removes an enchantment of the given type.
|
|
8739
|
+
*
|
|
8346
8740
|
* This function can't be called in read-only mode.
|
|
8347
8741
|
*
|
|
8348
|
-
* @
|
|
8742
|
+
* @param enchantmentType
|
|
8743
|
+
* The enchantment type to remove.
|
|
8744
|
+
* @throws
|
|
8745
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8746
|
+
* enchantment type does not exist.
|
|
8747
|
+
*
|
|
8349
8748
|
*
|
|
8350
8749
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8351
8750
|
*
|
|
@@ -8550,6 +8949,10 @@ export class ItemStack {
|
|
|
8550
8949
|
constructor(itemType: ItemType | string, amount?: number);
|
|
8551
8950
|
/**
|
|
8552
8951
|
* @beta
|
|
8952
|
+
* @remarks
|
|
8953
|
+
* Clears all dynamic properties that have been set on this
|
|
8954
|
+
* item stack.
|
|
8955
|
+
*
|
|
8553
8956
|
*/
|
|
8554
8957
|
clearDynamicProperties(): void;
|
|
8555
8958
|
/**
|
|
@@ -8610,14 +9013,36 @@ export class ItemStack {
|
|
|
8610
9013
|
getComponents(): ItemComponent[];
|
|
8611
9014
|
/**
|
|
8612
9015
|
* @beta
|
|
9016
|
+
* @remarks
|
|
9017
|
+
* Returns a property value.
|
|
9018
|
+
*
|
|
9019
|
+
* @param identifier
|
|
9020
|
+
* The property identifier.
|
|
9021
|
+
* @returns
|
|
9022
|
+
* Returns the value for the property, or undefined if the
|
|
9023
|
+
* property has not been set.
|
|
8613
9024
|
*/
|
|
8614
9025
|
getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
|
|
8615
9026
|
/**
|
|
8616
9027
|
* @beta
|
|
9028
|
+
* @remarks
|
|
9029
|
+
* Returns the available set of dynamic property identifiers
|
|
9030
|
+
* that have been used on this entity.
|
|
9031
|
+
*
|
|
9032
|
+
* @returns
|
|
9033
|
+
* A string array of the dynamic properties set on this entity.
|
|
8617
9034
|
*/
|
|
8618
9035
|
getDynamicPropertyIds(): string[];
|
|
8619
9036
|
/**
|
|
8620
9037
|
* @beta
|
|
9038
|
+
* @remarks
|
|
9039
|
+
* Returns the total size, in bytes, of all the dynamic
|
|
9040
|
+
* properties that are currently stored for this entity. This
|
|
9041
|
+
* includes the size of both the key and the value. This can
|
|
9042
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
9043
|
+
* example, an entity has many megabytes of associated dynamic
|
|
9044
|
+
* properties, it may be slow to load on various devices.
|
|
9045
|
+
*
|
|
8621
9046
|
*/
|
|
8622
9047
|
getDynamicPropertyTotalByteCount(): number;
|
|
8623
9048
|
/**
|
|
@@ -8717,7 +9142,16 @@ export class ItemStack {
|
|
|
8717
9142
|
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
8718
9143
|
/**
|
|
8719
9144
|
* @beta
|
|
8720
|
-
* @
|
|
9145
|
+
* @remarks
|
|
9146
|
+
* Sets a specified property to a value. Note: This function
|
|
9147
|
+
* only works with non-stackable items.
|
|
9148
|
+
*
|
|
9149
|
+
* @param identifier
|
|
9150
|
+
* The property identifier.
|
|
9151
|
+
* @param value
|
|
9152
|
+
* Data value of the property to set.
|
|
9153
|
+
* @throws
|
|
9154
|
+
* Throws if the item stack is stackable.
|
|
8721
9155
|
*/
|
|
8722
9156
|
setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
|
|
8723
9157
|
/**
|
|
@@ -9443,52 +9877,45 @@ export class PistonActivateAfterEventSignal {
|
|
|
9443
9877
|
*
|
|
9444
9878
|
* @example pistonAfterEvent.ts
|
|
9445
9879
|
* ```typescript
|
|
9446
|
-
*
|
|
9447
|
-
*
|
|
9448
|
-
*
|
|
9880
|
+
* // set up a couple of piston blocks
|
|
9881
|
+
* let piston = overworld.getBlock(targetLocation);
|
|
9882
|
+
* let button = overworld.getBlock({
|
|
9883
|
+
* x: targetLocation.x,
|
|
9884
|
+
* y: targetLocation.y + 1,
|
|
9885
|
+
* z: targetLocation.z,
|
|
9886
|
+
* });
|
|
9449
9887
|
*
|
|
9450
|
-
*
|
|
9451
|
-
*
|
|
9452
|
-
*
|
|
9453
|
-
*
|
|
9888
|
+
* if (piston === undefined || button === undefined) {
|
|
9889
|
+
* log("Could not find block at location.");
|
|
9890
|
+
* return -1;
|
|
9891
|
+
* }
|
|
9454
9892
|
*
|
|
9455
|
-
*
|
|
9456
|
-
*
|
|
9893
|
+
* piston.setPermutation(
|
|
9894
|
+
* mc.BlockPermutation.resolve("piston").withState("facing_direction", 3)
|
|
9895
|
+
* );
|
|
9896
|
+
* button.setPermutation(
|
|
9897
|
+
* mc.BlockPermutation.resolve("acacia_button").withState("facing_direction", 1)
|
|
9898
|
+
* );
|
|
9457
9899
|
*
|
|
9458
|
-
*
|
|
9900
|
+
* mc.world.afterEvents.pistonActivate.subscribe(
|
|
9901
|
+
* (pistonEvent: mc.PistonActivateAfterEvent) => {
|
|
9459
9902
|
* let eventLoc = pistonEvent.piston.block.location;
|
|
9460
9903
|
*
|
|
9461
|
-
* if (
|
|
9904
|
+
* if (
|
|
9905
|
+
* eventLoc.x === targetLocation.x &&
|
|
9906
|
+
* eventLoc.y === targetLocation.y &&
|
|
9907
|
+
* eventLoc.z === targetLocation.z
|
|
9908
|
+
* ) {
|
|
9462
9909
|
* log(
|
|
9463
9910
|
* "Piston event at " +
|
|
9464
9911
|
* mc.system.currentTick +
|
|
9465
9912
|
* (pistonEvent.piston.isMoving ? " Moving" : "") +
|
|
9466
|
-
*
|
|
9467
|
-
*
|
|
9468
|
-
* (pistonEvent.piston.isRetracting ? " Retracting" : "") +
|
|
9469
|
-
* (pistonEvent.piston.isRetracted ? " Retracted" : "")
|
|
9913
|
+
* " State: " +
|
|
9914
|
+
* pistonEvent.piston.state
|
|
9470
9915
|
* );
|
|
9471
9916
|
* }
|
|
9472
|
-
* });
|
|
9473
|
-
* ```
|
|
9474
|
-
* @example pistonEvent.ts
|
|
9475
|
-
* ```typescript
|
|
9476
|
-
* let canceled = false;
|
|
9477
|
-
*
|
|
9478
|
-
* const pistonLoc: mc.Vector3 = {
|
|
9479
|
-
* x: Math.floor(targetLocation.x) + 1,
|
|
9480
|
-
* y: Math.floor(targetLocation.y) + 2,
|
|
9481
|
-
* z: Math.floor(targetLocation.z) + 1,
|
|
9482
|
-
* };
|
|
9483
|
-
*
|
|
9484
|
-
* const pistonCallback = mc.world.beforeEvents.pistonActivate.subscribe((pistonEvent: mc.PistonActivateBeforeEvent) => {
|
|
9485
|
-
* if (pistonEvent.piston.location.equals(pistonLoc)) {
|
|
9486
|
-
* log("Cancelling piston event");
|
|
9487
|
-
* pistonEvent.cancel = true;
|
|
9488
|
-
* canceled = true;
|
|
9489
9917
|
* }
|
|
9490
|
-
*
|
|
9491
|
-
*
|
|
9918
|
+
* );
|
|
9492
9919
|
* ```
|
|
9493
9920
|
*/
|
|
9494
9921
|
subscribe(callback: (arg: PistonActivateAfterEvent) => void): (arg: PistonActivateAfterEvent) => void;
|
|
@@ -9626,9 +10053,15 @@ export class Player extends Entity {
|
|
|
9626
10053
|
/**
|
|
9627
10054
|
* @beta
|
|
9628
10055
|
* @remarks
|
|
10056
|
+
* Eats an item, providing the item's hunger and saturation
|
|
10057
|
+
* effects to the player. Can only be used on food items.
|
|
10058
|
+
*
|
|
9629
10059
|
* This function can't be called in read-only mode.
|
|
9630
10060
|
*
|
|
9631
|
-
* @
|
|
10061
|
+
* @param itemStack
|
|
10062
|
+
* The item to eat.
|
|
10063
|
+
* @throws
|
|
10064
|
+
* Throws if the item is not a food item.
|
|
9632
10065
|
*/
|
|
9633
10066
|
eatItem(itemStack: ItemStack): void;
|
|
9634
10067
|
/**
|
|
@@ -10441,21 +10874,40 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
|
|
|
10441
10874
|
private constructor();
|
|
10442
10875
|
}
|
|
10443
10876
|
|
|
10877
|
+
/**
|
|
10878
|
+
* Contains information regarding a player that is leaving the
|
|
10879
|
+
* world.
|
|
10880
|
+
*/
|
|
10444
10881
|
export class PlayerLeaveBeforeEvent {
|
|
10445
10882
|
private constructor();
|
|
10883
|
+
/**
|
|
10884
|
+
* @remarks
|
|
10885
|
+
* The leaving player.
|
|
10886
|
+
*
|
|
10887
|
+
*/
|
|
10446
10888
|
readonly player: Player;
|
|
10447
10889
|
}
|
|
10448
10890
|
|
|
10891
|
+
/**
|
|
10892
|
+
* Manages callbacks that are connected to a player leaving the
|
|
10893
|
+
* world.
|
|
10894
|
+
*/
|
|
10449
10895
|
export class PlayerLeaveBeforeEventSignal {
|
|
10450
10896
|
private constructor();
|
|
10451
10897
|
/**
|
|
10452
10898
|
* @remarks
|
|
10899
|
+
* Adds a callback that will be called when a player leaves the
|
|
10900
|
+
* world.
|
|
10901
|
+
*
|
|
10453
10902
|
* This function can't be called in read-only mode.
|
|
10454
10903
|
*
|
|
10455
10904
|
*/
|
|
10456
10905
|
subscribe(callback: (arg: PlayerLeaveBeforeEvent) => void): (arg: PlayerLeaveBeforeEvent) => void;
|
|
10457
10906
|
/**
|
|
10458
10907
|
* @remarks
|
|
10908
|
+
* Removes a callback that will be called when a player leaves
|
|
10909
|
+
* the world.
|
|
10910
|
+
*
|
|
10459
10911
|
* This function can't be called in read-only mode.
|
|
10460
10912
|
*
|
|
10461
10913
|
* @throws This function can throw errors.
|
|
@@ -10535,6 +10987,11 @@ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
|
|
|
10535
10987
|
*
|
|
10536
10988
|
*/
|
|
10537
10989
|
readonly faceLocation: Vector3;
|
|
10990
|
+
/**
|
|
10991
|
+
* @remarks
|
|
10992
|
+
* The block permutation that is being placed.
|
|
10993
|
+
*
|
|
10994
|
+
*/
|
|
10538
10995
|
readonly permutationBeingPlaced: BlockPermutation;
|
|
10539
10996
|
/**
|
|
10540
10997
|
* @remarks
|
|
@@ -11352,6 +11809,10 @@ export class System {
|
|
|
11352
11809
|
*
|
|
11353
11810
|
*/
|
|
11354
11811
|
readonly currentTick: number;
|
|
11812
|
+
/**
|
|
11813
|
+
* @beta
|
|
11814
|
+
*/
|
|
11815
|
+
clearJob(jobId: number): void;
|
|
11355
11816
|
/**
|
|
11356
11817
|
* @remarks
|
|
11357
11818
|
* Cancels the execution of a function run that was previously
|
|
@@ -11410,6 +11871,10 @@ export class System {
|
|
|
11410
11871
|
* ```
|
|
11411
11872
|
*/
|
|
11412
11873
|
runInterval(callback: () => void, tickInterval?: number): number;
|
|
11874
|
+
/**
|
|
11875
|
+
* @beta
|
|
11876
|
+
*/
|
|
11877
|
+
runJob(generator: Generator<void, void, void>): number;
|
|
11413
11878
|
/**
|
|
11414
11879
|
* @remarks
|
|
11415
11880
|
* Runs a set of code at a future time specified by tickDelay.
|
|
@@ -11876,6 +12341,37 @@ export class WeatherChangeAfterEventSignal {
|
|
|
11876
12341
|
unsubscribe(callback: (arg: WeatherChangeAfterEvent) => void): void;
|
|
11877
12342
|
}
|
|
11878
12343
|
|
|
12344
|
+
/**
|
|
12345
|
+
* @beta
|
|
12346
|
+
*/
|
|
12347
|
+
export class WeatherChangeBeforeEvent {
|
|
12348
|
+
private constructor();
|
|
12349
|
+
cancel: boolean;
|
|
12350
|
+
duration: number;
|
|
12351
|
+
newWeather: WeatherType;
|
|
12352
|
+
readonly previousWeather: WeatherType;
|
|
12353
|
+
}
|
|
12354
|
+
|
|
12355
|
+
/**
|
|
12356
|
+
* @beta
|
|
12357
|
+
*/
|
|
12358
|
+
export class WeatherChangeBeforeEventSignal {
|
|
12359
|
+
private constructor();
|
|
12360
|
+
/**
|
|
12361
|
+
* @remarks
|
|
12362
|
+
* This function can't be called in read-only mode.
|
|
12363
|
+
*
|
|
12364
|
+
*/
|
|
12365
|
+
subscribe(callback: (arg: WeatherChangeBeforeEvent) => void): (arg: WeatherChangeBeforeEvent) => void;
|
|
12366
|
+
/**
|
|
12367
|
+
* @remarks
|
|
12368
|
+
* This function can't be called in read-only mode.
|
|
12369
|
+
*
|
|
12370
|
+
* @throws This function can throw errors.
|
|
12371
|
+
*/
|
|
12372
|
+
unsubscribe(callback: (arg: WeatherChangeBeforeEvent) => void): void;
|
|
12373
|
+
}
|
|
12374
|
+
|
|
11879
12375
|
/**
|
|
11880
12376
|
* A class that wraps the state of a world - a set of
|
|
11881
12377
|
* dimensions and the environment of Minecraft.
|
|
@@ -12742,6 +13238,10 @@ export class WorldBeforeEvents {
|
|
|
12742
13238
|
*
|
|
12743
13239
|
*/
|
|
12744
13240
|
readonly playerPlaceBlock: PlayerPlaceBlockBeforeEventSignal;
|
|
13241
|
+
/**
|
|
13242
|
+
* @beta
|
|
13243
|
+
*/
|
|
13244
|
+
readonly weatherChange: WeatherChangeBeforeEventSignal;
|
|
12745
13245
|
}
|
|
12746
13246
|
|
|
12747
13247
|
/**
|
|
@@ -12786,6 +13286,13 @@ export class WorldInitializeAfterEventSignal {
|
|
|
12786
13286
|
unsubscribe(callback: (arg: WorldInitializeAfterEvent) => void): void;
|
|
12787
13287
|
}
|
|
12788
13288
|
|
|
13289
|
+
/**
|
|
13290
|
+
* @beta
|
|
13291
|
+
*/
|
|
13292
|
+
export interface BiomeSearchOptions {
|
|
13293
|
+
boundingSize?: Vector3;
|
|
13294
|
+
}
|
|
13295
|
+
|
|
12789
13296
|
/**
|
|
12790
13297
|
* Contains optional parameters for registering a block event.
|
|
12791
13298
|
*/
|
|
@@ -13168,8 +13675,8 @@ export interface DimensionLocation {
|
|
|
13168
13675
|
|
|
13169
13676
|
/**
|
|
13170
13677
|
* @beta
|
|
13171
|
-
* This
|
|
13172
|
-
* applied to an item.
|
|
13678
|
+
* This interface represents a specific leveled enchantment
|
|
13679
|
+
* that is applied to an item.
|
|
13173
13680
|
*/
|
|
13174
13681
|
export interface Enchantment {
|
|
13175
13682
|
/**
|
|
@@ -13647,6 +14154,11 @@ export interface PlayAnimationOptions {
|
|
|
13647
14154
|
*
|
|
13648
14155
|
*/
|
|
13649
14156
|
nextState?: string;
|
|
14157
|
+
/**
|
|
14158
|
+
* @remarks
|
|
14159
|
+
* A list of players the animation will be visible to.
|
|
14160
|
+
*
|
|
14161
|
+
*/
|
|
13650
14162
|
players?: string[];
|
|
13651
14163
|
/**
|
|
13652
14164
|
* @remarks
|
|
@@ -14007,6 +14519,14 @@ export class EnchantmentTypeUnknownIdError extends Error {
|
|
|
14007
14519
|
private constructor();
|
|
14008
14520
|
}
|
|
14009
14521
|
|
|
14522
|
+
/**
|
|
14523
|
+
* @beta
|
|
14524
|
+
*/
|
|
14525
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
14526
|
+
export class InvalidContainerSlotError extends Error {
|
|
14527
|
+
private constructor();
|
|
14528
|
+
}
|
|
14529
|
+
|
|
14010
14530
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
14011
14531
|
export class LocationInUnloadedChunkError extends Error {
|
|
14012
14532
|
private constructor();
|