@minecraft/server 1.9.0-beta.1.20.60-preview.22 → 1.9.0-beta.1.20.60-preview.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.d.ts +632 -68
- 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
|
|
|
@@ -439,6 +464,7 @@ export enum EntityComponentTypes {
|
|
|
439
464
|
NavigationWalk = 'minecraft:navigation.walk',
|
|
440
465
|
Npc = 'minecraft:npc',
|
|
441
466
|
OnFire = 'minecraft:onfire',
|
|
467
|
+
Projectile = 'minecraft:projectile',
|
|
442
468
|
PushThrough = 'minecraft:push_through',
|
|
443
469
|
Rideable = 'minecraft:rideable',
|
|
444
470
|
Riding = 'minecraft:riding',
|
|
@@ -860,11 +886,37 @@ export enum GameMode {
|
|
|
860
886
|
|
|
861
887
|
/**
|
|
862
888
|
* @beta
|
|
889
|
+
* The types of item components that are accessible via
|
|
890
|
+
* function ItemStack.getComponent.
|
|
863
891
|
*/
|
|
864
892
|
export enum ItemComponentTypes {
|
|
893
|
+
/**
|
|
894
|
+
* @beta
|
|
895
|
+
* @remarks
|
|
896
|
+
* The minecraft:cooldown component.
|
|
897
|
+
*
|
|
898
|
+
*/
|
|
865
899
|
Cooldown = 'minecraft:cooldown',
|
|
900
|
+
/**
|
|
901
|
+
* @beta
|
|
902
|
+
* @remarks
|
|
903
|
+
* The minecraft:durability component.
|
|
904
|
+
*
|
|
905
|
+
*/
|
|
866
906
|
Durability = 'minecraft:durability',
|
|
907
|
+
/**
|
|
908
|
+
* @beta
|
|
909
|
+
* @remarks
|
|
910
|
+
* The minecraft:enchantable component.
|
|
911
|
+
*
|
|
912
|
+
*/
|
|
867
913
|
Enchantable = 'minecraft:enchantable',
|
|
914
|
+
/**
|
|
915
|
+
* @beta
|
|
916
|
+
* @remarks
|
|
917
|
+
* The minecraft:food component.
|
|
918
|
+
*
|
|
919
|
+
*/
|
|
868
920
|
Food = 'minecraft:food',
|
|
869
921
|
}
|
|
870
922
|
|
|
@@ -1266,6 +1318,7 @@ export type EntityComponentTypeMap = {
|
|
|
1266
1318
|
'minecraft:navigation.walk': EntityNavigationWalkComponent;
|
|
1267
1319
|
'minecraft:npc': EntityNpcComponent;
|
|
1268
1320
|
'minecraft:onfire': EntityOnFireComponent;
|
|
1321
|
+
'minecraft:projectile': EntityProjectileComponent;
|
|
1269
1322
|
'minecraft:push_through': EntityPushThroughComponent;
|
|
1270
1323
|
'minecraft:rideable': EntityRideableComponent;
|
|
1271
1324
|
'minecraft:riding': EntityRidingComponent;
|
|
@@ -1295,6 +1348,7 @@ export type EntityComponentTypeMap = {
|
|
|
1295
1348
|
'navigation.walk': EntityNavigationWalkComponent;
|
|
1296
1349
|
npc: EntityNpcComponent;
|
|
1297
1350
|
onfire: EntityOnFireComponent;
|
|
1351
|
+
projectile: EntityProjectileComponent;
|
|
1298
1352
|
push_through: EntityPushThroughComponent;
|
|
1299
1353
|
rideable: EntityRideableComponent;
|
|
1300
1354
|
riding: EntityRidingComponent;
|
|
@@ -1322,6 +1376,23 @@ export type ItemComponentTypeMap = {
|
|
|
1322
1376
|
'minecraft:food': ItemFoodComponent;
|
|
1323
1377
|
};
|
|
1324
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
|
+
|
|
1325
1396
|
/**
|
|
1326
1397
|
* Represents a block in a dimension. A block represents a
|
|
1327
1398
|
* unique X, Y, and Z within a dimension and get/sets the state
|
|
@@ -1381,10 +1452,13 @@ export class Block {
|
|
|
1381
1452
|
* @remarks
|
|
1382
1453
|
* Returns or sets whether this block has a liquid on it.
|
|
1383
1454
|
*
|
|
1384
|
-
* This property can
|
|
1455
|
+
* @throws This property can throw when used.
|
|
1456
|
+
*
|
|
1457
|
+
* {@link LocationInUnloadedChunkError}
|
|
1385
1458
|
*
|
|
1459
|
+
* {@link LocationOutOfWorldBoundariesError}
|
|
1386
1460
|
*/
|
|
1387
|
-
isWaterlogged: boolean;
|
|
1461
|
+
readonly isWaterlogged: boolean;
|
|
1388
1462
|
/**
|
|
1389
1463
|
* @remarks
|
|
1390
1464
|
* Coordinates of the specified block.
|
|
@@ -1637,6 +1711,17 @@ export class Block {
|
|
|
1637
1711
|
* True if this block object is still working and valid.
|
|
1638
1712
|
*/
|
|
1639
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;
|
|
1640
1725
|
/**
|
|
1641
1726
|
* @remarks
|
|
1642
1727
|
* Returns the {@link Block} to the north of this block
|
|
@@ -1705,6 +1790,20 @@ export class Block {
|
|
|
1705
1790
|
* {@link LocationOutOfWorldBoundariesError}
|
|
1706
1791
|
*/
|
|
1707
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;
|
|
1708
1807
|
/**
|
|
1709
1808
|
* @remarks
|
|
1710
1809
|
* Returns the {@link Block} to the south of this block
|
|
@@ -2153,6 +2252,9 @@ export class BlockPistonComponent extends BlockComponent {
|
|
|
2153
2252
|
*/
|
|
2154
2253
|
readonly isMoving: boolean;
|
|
2155
2254
|
/**
|
|
2255
|
+
* @remarks
|
|
2256
|
+
* The current state of the piston.
|
|
2257
|
+
*
|
|
2156
2258
|
* @throws This property can throw when used.
|
|
2157
2259
|
*/
|
|
2158
2260
|
readonly state: BlockPistonState;
|
|
@@ -2166,6 +2268,10 @@ export class BlockPistonComponent extends BlockComponent {
|
|
|
2166
2268
|
*/
|
|
2167
2269
|
getAttachedBlocks(): Block[];
|
|
2168
2270
|
/**
|
|
2271
|
+
* @remarks
|
|
2272
|
+
* Retrieves a set of block locations that this piston is
|
|
2273
|
+
* connected with.
|
|
2274
|
+
*
|
|
2169
2275
|
* @throws This function can throw errors.
|
|
2170
2276
|
*/
|
|
2171
2277
|
getAttachedBlocksLocations(): Vector3[];
|
|
@@ -2297,30 +2403,53 @@ export class BlockSignComponent extends BlockComponent {
|
|
|
2297
2403
|
* The side of the sign the message will be set on. If not
|
|
2298
2404
|
* provided, the message will be set on the front side of the
|
|
2299
2405
|
* sign.
|
|
2300
|
-
* @throws
|
|
2406
|
+
* @throws
|
|
2407
|
+
* Throws if the provided message is greater than 512
|
|
2408
|
+
* characters in length.
|
|
2301
2409
|
* @example SetRawMessage.ts
|
|
2302
2410
|
* ```typescript
|
|
2303
|
-
* 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" };
|
|
2304
2419
|
* sign.setText(helloWorldMessage);
|
|
2305
2420
|
*
|
|
2306
2421
|
* // Sign text will be saved as a RawText
|
|
2307
|
-
* const result
|
|
2308
|
-
* JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
|
|
2422
|
+
* const result = sign.getRawText();
|
|
2423
|
+
* world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
|
|
2309
2424
|
* ```
|
|
2310
2425
|
* @example SetRawText.ts
|
|
2311
2426
|
* ```typescript
|
|
2312
|
-
* 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" }] };
|
|
2313
2435
|
* sign.setText(helloWorldText);
|
|
2314
2436
|
*
|
|
2315
2437
|
* // There will be no data transformation unlike calling setText with a RawMessage
|
|
2316
|
-
* const result
|
|
2317
|
-
* JSON.stringify(result); // { rawtext: [{ text: 'Hello World' }] };
|
|
2438
|
+
* const result = sign.getRawText();
|
|
2439
|
+
* world.sendMessage(JSON.stringify(result)); // { rawtext: [{ text: 'Hello World' }] };
|
|
2318
2440
|
* ```
|
|
2319
2441
|
* @example SetString.ts
|
|
2320
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;
|
|
2321
2450
|
* // Set sign to say 'Hello'
|
|
2322
|
-
* sign.setText(
|
|
2323
|
-
* sign.getText(); // 'Hello'
|
|
2451
|
+
* sign.setText("Hello World");
|
|
2452
|
+
* world.sendMessage(sign.getText() ?? "undefined"); // 'Hello World'
|
|
2324
2453
|
* ```
|
|
2325
2454
|
*/
|
|
2326
2455
|
setText(message: RawMessage | RawText | string, side?: SignSide): void;
|
|
@@ -3545,6 +3674,52 @@ export class ContainerSlot {
|
|
|
3545
3674
|
* Throws if the slot's container is invalid.
|
|
3546
3675
|
*/
|
|
3547
3676
|
readonly typeId?: string;
|
|
3677
|
+
/**
|
|
3678
|
+
* @remarks
|
|
3679
|
+
* Clears all dynamic properties that have been set on this
|
|
3680
|
+
* item stack.
|
|
3681
|
+
*
|
|
3682
|
+
* @throws
|
|
3683
|
+
* Throws if the slot's container is invalid.
|
|
3684
|
+
*/
|
|
3685
|
+
clearDynamicProperties(): void;
|
|
3686
|
+
/**
|
|
3687
|
+
* @remarks
|
|
3688
|
+
* Returns a property value.
|
|
3689
|
+
*
|
|
3690
|
+
* @param identifier
|
|
3691
|
+
* The property identifier.
|
|
3692
|
+
* @returns
|
|
3693
|
+
* Returns the value for the property, or undefined if the
|
|
3694
|
+
* property has not been set.
|
|
3695
|
+
* @throws
|
|
3696
|
+
* Throws if the slot's container is invalid.
|
|
3697
|
+
*/
|
|
3698
|
+
getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
|
|
3699
|
+
/**
|
|
3700
|
+
* @remarks
|
|
3701
|
+
* Returns the available set of dynamic property identifiers
|
|
3702
|
+
* that have been used on this item stack.
|
|
3703
|
+
*
|
|
3704
|
+
* @returns
|
|
3705
|
+
* A string array of the dynamic properties set on this entity.
|
|
3706
|
+
* @throws
|
|
3707
|
+
* Throws if the slot's container is invalid.
|
|
3708
|
+
*/
|
|
3709
|
+
getDynamicPropertyIds(): string[];
|
|
3710
|
+
/**
|
|
3711
|
+
* @remarks
|
|
3712
|
+
* Returns the total size, in bytes, of all the dynamic
|
|
3713
|
+
* properties that are currently stored for this entity. This
|
|
3714
|
+
* includes the size of both the key and the value. This can
|
|
3715
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
3716
|
+
* example, an entity has many megabytes of associated dynamic
|
|
3717
|
+
* properties, it may be slow to load on various devices.
|
|
3718
|
+
*
|
|
3719
|
+
* @throws
|
|
3720
|
+
* Throws if the slot's container is invalid.
|
|
3721
|
+
*/
|
|
3722
|
+
getDynamicPropertyTotalByteCount(): number;
|
|
3548
3723
|
/**
|
|
3549
3724
|
* @remarks
|
|
3550
3725
|
* Creates an exact copy of the item stack, including any
|
|
@@ -3553,7 +3728,8 @@ export class ContainerSlot {
|
|
|
3553
3728
|
* @returns
|
|
3554
3729
|
* Returns a copy of the item in the slot. Returns undefined if
|
|
3555
3730
|
* the slot is empty.
|
|
3556
|
-
* @throws
|
|
3731
|
+
* @throws
|
|
3732
|
+
* Throws if the slot's container is invalid.
|
|
3557
3733
|
*/
|
|
3558
3734
|
getItem(): ItemStack | undefined;
|
|
3559
3735
|
/**
|
|
@@ -3575,7 +3751,8 @@ export class ContainerSlot {
|
|
|
3575
3751
|
* @returns
|
|
3576
3752
|
* Returns all tags for the item in the slot. Return an empty
|
|
3577
3753
|
* array if the the slot is empty.
|
|
3578
|
-
* @throws
|
|
3754
|
+
* @throws
|
|
3755
|
+
* Throws if the slot's container is invalid.
|
|
3579
3756
|
*/
|
|
3580
3757
|
getTags(): string[];
|
|
3581
3758
|
/**
|
|
@@ -3587,7 +3764,8 @@ export class ContainerSlot {
|
|
|
3587
3764
|
* @returns
|
|
3588
3765
|
* Returns false when the slot is empty or the item in the slot
|
|
3589
3766
|
* does not have the given tag.
|
|
3590
|
-
* @throws
|
|
3767
|
+
* @throws
|
|
3768
|
+
* Throws if the slot's container is invalid.
|
|
3591
3769
|
*/
|
|
3592
3770
|
hasTag(tag: string): boolean;
|
|
3593
3771
|
/**
|
|
@@ -3646,6 +3824,18 @@ export class ContainerSlot {
|
|
|
3646
3824
|
* any of the provided block identifiers are invalid.
|
|
3647
3825
|
*/
|
|
3648
3826
|
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
3827
|
+
/**
|
|
3828
|
+
* @remarks
|
|
3829
|
+
* Sets a specified property to a value.
|
|
3830
|
+
*
|
|
3831
|
+
* @param identifier
|
|
3832
|
+
* The property identifier.
|
|
3833
|
+
* @param value
|
|
3834
|
+
* Data value of the property to set.
|
|
3835
|
+
* @throws
|
|
3836
|
+
* Throws if the slot's container is invalid.
|
|
3837
|
+
*/
|
|
3838
|
+
setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
|
|
3649
3839
|
/**
|
|
3650
3840
|
* @remarks
|
|
3651
3841
|
* Sets the given ItemStack in the slot, replacing any existing
|
|
@@ -3655,7 +3845,8 @@ export class ContainerSlot {
|
|
|
3655
3845
|
*
|
|
3656
3846
|
* @param itemStack
|
|
3657
3847
|
* The ItemStack to be placed in the slot.
|
|
3658
|
-
* @throws
|
|
3848
|
+
* @throws
|
|
3849
|
+
* Throws if the slot's container is invalid.
|
|
3659
3850
|
*/
|
|
3660
3851
|
setItem(itemStack?: ItemStack): void;
|
|
3661
3852
|
/**
|
|
@@ -3911,6 +4102,18 @@ export class Dimension {
|
|
|
3911
4102
|
block: BlockPermutation | BlockType | string,
|
|
3912
4103
|
options?: BlockFillOptions,
|
|
3913
4104
|
): number;
|
|
4105
|
+
/**
|
|
4106
|
+
* @beta
|
|
4107
|
+
* @remarks
|
|
4108
|
+
* This function can't be called in read-only mode.
|
|
4109
|
+
*
|
|
4110
|
+
* @throws This function can throw errors.
|
|
4111
|
+
*
|
|
4112
|
+
* {@link minecraftcommon.EngineError}
|
|
4113
|
+
*
|
|
4114
|
+
* {@link Error}
|
|
4115
|
+
*/
|
|
4116
|
+
findClosestBiome(pos: Vector3, biomeToFind: BiomeType | string, options?: BiomeSearchOptions): Vector3 | undefined;
|
|
3914
4117
|
/**
|
|
3915
4118
|
* @remarks
|
|
3916
4119
|
* Returns a block instance at the given location.
|
|
@@ -4526,7 +4729,8 @@ export class EnchantmentType {
|
|
|
4526
4729
|
|
|
4527
4730
|
/**
|
|
4528
4731
|
* @beta
|
|
4529
|
-
*
|
|
4732
|
+
* Contains a catalog of Minecraft Enchantment Types that are
|
|
4733
|
+
* available in this world.
|
|
4530
4734
|
*/
|
|
4531
4735
|
export class EnchantmentTypes {
|
|
4532
4736
|
private constructor();
|
|
@@ -4749,7 +4953,7 @@ export class Entity {
|
|
|
4749
4953
|
* log("Created a sneaking wolf.", 1);
|
|
4750
4954
|
* ```
|
|
4751
4955
|
*/
|
|
4752
|
-
addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions):
|
|
4956
|
+
addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions): Effect | undefined;
|
|
4753
4957
|
/**
|
|
4754
4958
|
* @remarks
|
|
4755
4959
|
* Adds a specified tag to an entity.
|
|
@@ -5006,11 +5210,11 @@ export class Entity {
|
|
|
5006
5210
|
/**
|
|
5007
5211
|
* @remarks
|
|
5008
5212
|
* Returns the total size, in bytes, of all the dynamic
|
|
5009
|
-
* properties that are currently stored for this entity.
|
|
5010
|
-
*
|
|
5011
|
-
* for
|
|
5012
|
-
*
|
|
5013
|
-
* devices.
|
|
5213
|
+
* properties that are currently stored for this entity. This
|
|
5214
|
+
* includes the size of both the key and the value. This can
|
|
5215
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
5216
|
+
* example, an entity has many megabytes of associated dynamic
|
|
5217
|
+
* properties, it may be slow to load on various devices.
|
|
5014
5218
|
*
|
|
5015
5219
|
* @throws This function can throw errors.
|
|
5016
5220
|
*/
|
|
@@ -5092,8 +5296,10 @@ export class Entity {
|
|
|
5092
5296
|
getRotation(): Vector2;
|
|
5093
5297
|
/**
|
|
5094
5298
|
* @remarks
|
|
5299
|
+
* Returns all tags associated with the entity.
|
|
5300
|
+
*
|
|
5095
5301
|
* @returns
|
|
5096
|
-
*
|
|
5302
|
+
* An array containing all tags as strings.
|
|
5097
5303
|
* @throws This function can throw errors.
|
|
5098
5304
|
*/
|
|
5099
5305
|
getTags(): string[];
|
|
@@ -5197,10 +5403,13 @@ export class Entity {
|
|
|
5197
5403
|
* location of the entity for matching if the location is not
|
|
5198
5404
|
* specified in the passed in EntityQueryOptions.
|
|
5199
5405
|
*
|
|
5406
|
+
* @param options
|
|
5407
|
+
* The query to perform the match against.
|
|
5200
5408
|
* @returns
|
|
5201
5409
|
* Returns true if the entity matches the criteria in the
|
|
5202
5410
|
* passed in EntityQueryOptions, otherwise it returns false.
|
|
5203
|
-
* @throws
|
|
5411
|
+
* @throws
|
|
5412
|
+
* Throws if the query options are misconfigured.
|
|
5204
5413
|
*/
|
|
5205
5414
|
matches(options: EntityQueryOptions): boolean;
|
|
5206
5415
|
/**
|
|
@@ -7054,6 +7263,168 @@ export class EntityOnFireComponent extends EntityComponent {
|
|
|
7054
7263
|
static readonly componentId = 'minecraft:onfire';
|
|
7055
7264
|
}
|
|
7056
7265
|
|
|
7266
|
+
/**
|
|
7267
|
+
* @beta
|
|
7268
|
+
* The projectile component controls the properties of a
|
|
7269
|
+
* projectile entity and allows it to be shot in a given
|
|
7270
|
+
* direction.
|
|
7271
|
+
* This component is present when the entity has the
|
|
7272
|
+
* minecraft:projectile component.
|
|
7273
|
+
*/
|
|
7274
|
+
// @ts-ignore Class inheritance allowed for native defined classes
|
|
7275
|
+
export class EntityProjectileComponent extends EntityComponent {
|
|
7276
|
+
private constructor();
|
|
7277
|
+
/**
|
|
7278
|
+
* @remarks
|
|
7279
|
+
* The fraction of the projectile's speed maintained every tick
|
|
7280
|
+
* while traveling through air.
|
|
7281
|
+
*
|
|
7282
|
+
* This property can't be edited in read-only mode.
|
|
7283
|
+
*
|
|
7284
|
+
*/
|
|
7285
|
+
airInertia: number;
|
|
7286
|
+
/**
|
|
7287
|
+
* @remarks
|
|
7288
|
+
* If true, the entity will be set on fire when hurt. The
|
|
7289
|
+
* default burn duration is 5 seconds. This duration can be
|
|
7290
|
+
* modified via the onFireTime property. The entity will not
|
|
7291
|
+
* catch fire if immune or if the entity is wet.
|
|
7292
|
+
*
|
|
7293
|
+
* This property can't be edited in read-only mode.
|
|
7294
|
+
*
|
|
7295
|
+
*/
|
|
7296
|
+
catchFireOnHurt: boolean;
|
|
7297
|
+
/**
|
|
7298
|
+
* @remarks
|
|
7299
|
+
* If true, the projectile will spawn crit particles when hit
|
|
7300
|
+
* by a player. E.g. Player attacking a Shulker bullet.
|
|
7301
|
+
*
|
|
7302
|
+
* This property can't be edited in read-only mode.
|
|
7303
|
+
*
|
|
7304
|
+
*/
|
|
7305
|
+
critParticlesOnProjectileHurt: boolean;
|
|
7306
|
+
/**
|
|
7307
|
+
* @remarks
|
|
7308
|
+
* If true, the projectile will be destroyed when it takes
|
|
7309
|
+
* damage. E.g. Player attacking a Shulker bullet.
|
|
7310
|
+
*
|
|
7311
|
+
* This property can't be edited in read-only mode.
|
|
7312
|
+
*
|
|
7313
|
+
*/
|
|
7314
|
+
destroyOnProjectileHurt: boolean;
|
|
7315
|
+
/**
|
|
7316
|
+
* @remarks
|
|
7317
|
+
* The gravity applied to the projectile. When the entity is
|
|
7318
|
+
* not on the ground, subtracts this amount from the
|
|
7319
|
+
* projectile’s change in vertical position every tick. The
|
|
7320
|
+
* higher the value, the faster the projectile falls. If
|
|
7321
|
+
* negative, the entity will rise instead of fall.
|
|
7322
|
+
*
|
|
7323
|
+
* This property can't be edited in read-only mode.
|
|
7324
|
+
*
|
|
7325
|
+
*/
|
|
7326
|
+
gravity: number;
|
|
7327
|
+
/**
|
|
7328
|
+
* @remarks
|
|
7329
|
+
* The sound that plays when the projectile hits an entity.
|
|
7330
|
+
*
|
|
7331
|
+
* This property can't be edited in read-only mode.
|
|
7332
|
+
*
|
|
7333
|
+
*/
|
|
7334
|
+
hitEntitySound?: string;
|
|
7335
|
+
/**
|
|
7336
|
+
* @remarks
|
|
7337
|
+
* The sound that plays when the projectile hits a block.
|
|
7338
|
+
*
|
|
7339
|
+
* This property can't be edited in read-only mode.
|
|
7340
|
+
*
|
|
7341
|
+
*/
|
|
7342
|
+
hitGroundSound?: string;
|
|
7343
|
+
/**
|
|
7344
|
+
* @remarks
|
|
7345
|
+
* The particle that spawns when the projectile hits something.
|
|
7346
|
+
*
|
|
7347
|
+
* This property can't be edited in read-only mode.
|
|
7348
|
+
*
|
|
7349
|
+
*/
|
|
7350
|
+
hitParticle?: string;
|
|
7351
|
+
/**
|
|
7352
|
+
* @remarks
|
|
7353
|
+
* If true and the weather is thunder and the entity has line
|
|
7354
|
+
* of sight to the sky, the entity will be struck by lightning
|
|
7355
|
+
* when hit. E.g. A thrown Trident with the Channeling
|
|
7356
|
+
* enchantment.
|
|
7357
|
+
*
|
|
7358
|
+
* This property can't be edited in read-only mode.
|
|
7359
|
+
*
|
|
7360
|
+
*/
|
|
7361
|
+
lightningStrikeOnHit: boolean;
|
|
7362
|
+
/**
|
|
7363
|
+
* @remarks
|
|
7364
|
+
* The fraction of the projectile's speed maintained every tick
|
|
7365
|
+
* while traveling through a liquid.
|
|
7366
|
+
*
|
|
7367
|
+
* This property can't be edited in read-only mode.
|
|
7368
|
+
*
|
|
7369
|
+
*/
|
|
7370
|
+
liquidInertia: number;
|
|
7371
|
+
/**
|
|
7372
|
+
* @remarks
|
|
7373
|
+
* Duration in seconds that the entity hit will be on fire for
|
|
7374
|
+
* when catchFireOnHurt is set to true.
|
|
7375
|
+
*
|
|
7376
|
+
* This property can't be edited in read-only mode.
|
|
7377
|
+
*
|
|
7378
|
+
*/
|
|
7379
|
+
onFireTime: number;
|
|
7380
|
+
/**
|
|
7381
|
+
* @remarks
|
|
7382
|
+
* The owner of the projectile. This is used to determine what
|
|
7383
|
+
* the projectile can collide with and damage. It also
|
|
7384
|
+
* determines which entity is assigned as the attacker.
|
|
7385
|
+
*
|
|
7386
|
+
* This property can't be edited in read-only mode.
|
|
7387
|
+
*
|
|
7388
|
+
*/
|
|
7389
|
+
owner?: Entity;
|
|
7390
|
+
/**
|
|
7391
|
+
* @remarks
|
|
7392
|
+
* If true, the projectile will bounce off mobs when no damage
|
|
7393
|
+
* is taken. E.g. A spawning wither.
|
|
7394
|
+
*
|
|
7395
|
+
* This property can't be edited in read-only mode.
|
|
7396
|
+
*
|
|
7397
|
+
*/
|
|
7398
|
+
shouldBounceOnHit: boolean;
|
|
7399
|
+
/**
|
|
7400
|
+
* @remarks
|
|
7401
|
+
* If true, the projectile will stop moving when an entity is
|
|
7402
|
+
* hit as thought it had been blocked. E.g. Thrown trident on
|
|
7403
|
+
* hit behavior.
|
|
7404
|
+
*
|
|
7405
|
+
* This property can't be edited in read-only mode.
|
|
7406
|
+
*
|
|
7407
|
+
*/
|
|
7408
|
+
stopOnHit: boolean;
|
|
7409
|
+
static readonly componentId = 'minecraft:projectile';
|
|
7410
|
+
/**
|
|
7411
|
+
* @remarks
|
|
7412
|
+
* Shoots the projectile with a given velocity. The projectile
|
|
7413
|
+
* will be shot from its current location.
|
|
7414
|
+
*
|
|
7415
|
+
* This function can't be called in read-only mode.
|
|
7416
|
+
*
|
|
7417
|
+
* @param velocity
|
|
7418
|
+
* The velocity to fire the projectile. This controls both the
|
|
7419
|
+
* speed and direction which which the projectile will be shot.
|
|
7420
|
+
* @param options
|
|
7421
|
+
* Optional configuration for the shoot.
|
|
7422
|
+
* @throws
|
|
7423
|
+
* Throws if the component or entity no longer exist.
|
|
7424
|
+
*/
|
|
7425
|
+
shoot(velocity: Vector3, options?: ProjectileShootOptions): void;
|
|
7426
|
+
}
|
|
7427
|
+
|
|
7057
7428
|
/**
|
|
7058
7429
|
* Sets the distance through which the entity can push through.
|
|
7059
7430
|
*/
|
|
@@ -7981,7 +8352,7 @@ export class ItemCooldownComponent extends ItemComponent {
|
|
|
7981
8352
|
readonly cooldownCategory: string;
|
|
7982
8353
|
/**
|
|
7983
8354
|
* @remarks
|
|
7984
|
-
* Amount of time, in ticks,
|
|
8355
|
+
* Amount of time, in ticks, it will take this item to
|
|
7985
8356
|
* cooldown.
|
|
7986
8357
|
*
|
|
7987
8358
|
* @throws This property can throw when used.
|
|
@@ -8143,6 +8514,11 @@ export class ItemDurabilityComponent extends ItemComponent {
|
|
|
8143
8514
|
getDamageChance(unbreakingEnchantmentLevel?: number): number;
|
|
8144
8515
|
/**
|
|
8145
8516
|
* @remarks
|
|
8517
|
+
* Returns the min and max variables used by the damage chance
|
|
8518
|
+
* formula:
|
|
8519
|
+
* chance = (min + ((max - min) / (unbreaking + 1)))
|
|
8520
|
+
*
|
|
8521
|
+
*
|
|
8146
8522
|
* This function can't be called in read-only mode.
|
|
8147
8523
|
*
|
|
8148
8524
|
* @throws This function can throw errors.
|
|
@@ -8152,6 +8528,8 @@ export class ItemDurabilityComponent extends ItemComponent {
|
|
|
8152
8528
|
|
|
8153
8529
|
/**
|
|
8154
8530
|
* @beta
|
|
8531
|
+
* When present on an item, this item can have enchantments
|
|
8532
|
+
* applied to it.
|
|
8155
8533
|
*/
|
|
8156
8534
|
// @ts-ignore Class inheritance allowed for native defined classes
|
|
8157
8535
|
export class ItemEnchantableComponent extends ItemComponent {
|
|
@@ -8159,9 +8537,24 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8159
8537
|
static readonly componentId = 'minecraft:enchantable';
|
|
8160
8538
|
/**
|
|
8161
8539
|
* @remarks
|
|
8540
|
+
* Adds an enchantment to the item stack.
|
|
8541
|
+
*
|
|
8162
8542
|
* This function can't be called in read-only mode.
|
|
8163
8543
|
*
|
|
8164
|
-
* @
|
|
8544
|
+
* @param enchantment
|
|
8545
|
+
* The enchantment interface to be added.
|
|
8546
|
+
* @throws
|
|
8547
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8548
|
+
* enchantment type does not exist.
|
|
8549
|
+
*
|
|
8550
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8551
|
+
* if the enchantment level is outside the allowable range for
|
|
8552
|
+
* the given enchantment type.
|
|
8553
|
+
*
|
|
8554
|
+
* ScriptItemEnchantmentTypeNotCompatibleError: Exception
|
|
8555
|
+
* thrown if the enchantment is not compatible with the item
|
|
8556
|
+
* stack.
|
|
8557
|
+
*
|
|
8165
8558
|
*
|
|
8166
8559
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8167
8560
|
*
|
|
@@ -8174,9 +8567,24 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8174
8567
|
addEnchantment(enchantment: Enchantment): void;
|
|
8175
8568
|
/**
|
|
8176
8569
|
* @remarks
|
|
8570
|
+
* Adds a list of enchantments to the item stack.
|
|
8571
|
+
*
|
|
8177
8572
|
* This function can't be called in read-only mode.
|
|
8178
8573
|
*
|
|
8179
|
-
* @
|
|
8574
|
+
* @param enchantments
|
|
8575
|
+
* The list of enchantments to be added.
|
|
8576
|
+
* @throws
|
|
8577
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if any
|
|
8578
|
+
* enchantment type does not exist.
|
|
8579
|
+
*
|
|
8580
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8581
|
+
* if any enchantment level is outside the allowable range for
|
|
8582
|
+
* the given enchantment type.
|
|
8583
|
+
*
|
|
8584
|
+
* ScriptItemEnchantmentTypeNotCompatibleError: Exception
|
|
8585
|
+
* thrown if any enchantment is not compatible with the item
|
|
8586
|
+
* stack.
|
|
8587
|
+
*
|
|
8180
8588
|
*
|
|
8181
8589
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8182
8590
|
*
|
|
@@ -8188,7 +8596,23 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8188
8596
|
*/
|
|
8189
8597
|
addEnchantments(enchantments: Enchantment[]): void;
|
|
8190
8598
|
/**
|
|
8191
|
-
* @
|
|
8599
|
+
* @remarks
|
|
8600
|
+
* Checks whether an enchantment can be added to the item
|
|
8601
|
+
* stack.
|
|
8602
|
+
*
|
|
8603
|
+
* @param enchantment
|
|
8604
|
+
* The enchantment interface to be added.
|
|
8605
|
+
* @returns
|
|
8606
|
+
* Returns true if the enchantment can be added to the item
|
|
8607
|
+
* stack.
|
|
8608
|
+
* @throws
|
|
8609
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8610
|
+
* enchantment type does not exist.
|
|
8611
|
+
*
|
|
8612
|
+
* ScriptItemEnchantmentLevelOutOfBoundsError: Exception thrown
|
|
8613
|
+
* if the enchantment level is outside the allowable range for
|
|
8614
|
+
* the given enchantment type.
|
|
8615
|
+
*
|
|
8192
8616
|
*
|
|
8193
8617
|
* {@link EnchantmentLevelOutOfBoundsError}
|
|
8194
8618
|
*
|
|
@@ -8196,23 +8620,50 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8196
8620
|
*/
|
|
8197
8621
|
canAddEnchantment(enchantment: Enchantment): boolean;
|
|
8198
8622
|
/**
|
|
8199
|
-
* @
|
|
8623
|
+
* @remarks
|
|
8624
|
+
* Gets the enchantment of a given type from the item stack.
|
|
8625
|
+
*
|
|
8626
|
+
* @param enchantmentType
|
|
8627
|
+
* The enchantment type to get.
|
|
8628
|
+
* @returns
|
|
8629
|
+
* Returns the enchantment if it exists on the item stack.
|
|
8630
|
+
* @throws
|
|
8631
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8632
|
+
* enchantment type does not exist.
|
|
8633
|
+
*
|
|
8200
8634
|
*
|
|
8201
8635
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8202
8636
|
*/
|
|
8203
8637
|
getEnchantment(enchantmentType: EnchantmentType | string): Enchantment | undefined;
|
|
8204
8638
|
/**
|
|
8639
|
+
* @remarks
|
|
8640
|
+
* Gets all enchantments on the item stack.
|
|
8641
|
+
*
|
|
8642
|
+
* @returns
|
|
8643
|
+
* Returns a list of enchantments on the item stack.
|
|
8205
8644
|
* @throws This function can throw errors.
|
|
8206
8645
|
*/
|
|
8207
8646
|
getEnchantments(): Enchantment[];
|
|
8208
8647
|
/**
|
|
8209
|
-
* @
|
|
8648
|
+
* @remarks
|
|
8649
|
+
* Checks whether an item stack has a given enchantment type.
|
|
8650
|
+
*
|
|
8651
|
+
* @param enchantmentType
|
|
8652
|
+
* The enchantment type to check for.
|
|
8653
|
+
* @returns
|
|
8654
|
+
* Returns true if the item stack has the enchantment type.
|
|
8655
|
+
* @throws
|
|
8656
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8657
|
+
* enchantment type does not exist.
|
|
8658
|
+
*
|
|
8210
8659
|
*
|
|
8211
8660
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8212
8661
|
*/
|
|
8213
8662
|
hasEnchantment(enchantmentType: EnchantmentType | string): boolean;
|
|
8214
8663
|
/**
|
|
8215
8664
|
* @remarks
|
|
8665
|
+
* Removes all enchantments applied to this item stack.
|
|
8666
|
+
*
|
|
8216
8667
|
* This function can't be called in read-only mode.
|
|
8217
8668
|
*
|
|
8218
8669
|
* @throws This function can throw errors.
|
|
@@ -8220,9 +8671,16 @@ export class ItemEnchantableComponent extends ItemComponent {
|
|
|
8220
8671
|
removeAllEnchantments(): void;
|
|
8221
8672
|
/**
|
|
8222
8673
|
* @remarks
|
|
8674
|
+
* Removes an enchantment of the given type.
|
|
8675
|
+
*
|
|
8223
8676
|
* This function can't be called in read-only mode.
|
|
8224
8677
|
*
|
|
8225
|
-
* @
|
|
8678
|
+
* @param enchantmentType
|
|
8679
|
+
* The enchantment type to remove.
|
|
8680
|
+
* @throws
|
|
8681
|
+
* ScriptItemEnchantmentUnknownIdError: Exception thrown if the
|
|
8682
|
+
* enchantment type does not exist.
|
|
8683
|
+
*
|
|
8226
8684
|
*
|
|
8227
8685
|
* {@link EnchantmentTypeUnknownIdError}
|
|
8228
8686
|
*
|
|
@@ -8425,6 +8883,14 @@ export class ItemStack {
|
|
|
8425
8883
|
* the range of 1-255.
|
|
8426
8884
|
*/
|
|
8427
8885
|
constructor(itemType: ItemType | string, amount?: number);
|
|
8886
|
+
/**
|
|
8887
|
+
* @beta
|
|
8888
|
+
* @remarks
|
|
8889
|
+
* Clears all dynamic properties that have been set on this
|
|
8890
|
+
* item stack.
|
|
8891
|
+
*
|
|
8892
|
+
*/
|
|
8893
|
+
clearDynamicProperties(): void;
|
|
8428
8894
|
/**
|
|
8429
8895
|
* @remarks
|
|
8430
8896
|
* Creates an exact copy of the item stack, including any
|
|
@@ -8481,6 +8947,40 @@ export class ItemStack {
|
|
|
8481
8947
|
*
|
|
8482
8948
|
*/
|
|
8483
8949
|
getComponents(): ItemComponent[];
|
|
8950
|
+
/**
|
|
8951
|
+
* @beta
|
|
8952
|
+
* @remarks
|
|
8953
|
+
* Returns a property value.
|
|
8954
|
+
*
|
|
8955
|
+
* @param identifier
|
|
8956
|
+
* The property identifier.
|
|
8957
|
+
* @returns
|
|
8958
|
+
* Returns the value for the property, or undefined if the
|
|
8959
|
+
* property has not been set.
|
|
8960
|
+
*/
|
|
8961
|
+
getDynamicProperty(identifier: string): boolean | number | string | Vector3 | undefined;
|
|
8962
|
+
/**
|
|
8963
|
+
* @beta
|
|
8964
|
+
* @remarks
|
|
8965
|
+
* Returns the available set of dynamic property identifiers
|
|
8966
|
+
* that have been used on this entity.
|
|
8967
|
+
*
|
|
8968
|
+
* @returns
|
|
8969
|
+
* A string array of the dynamic properties set on this entity.
|
|
8970
|
+
*/
|
|
8971
|
+
getDynamicPropertyIds(): string[];
|
|
8972
|
+
/**
|
|
8973
|
+
* @beta
|
|
8974
|
+
* @remarks
|
|
8975
|
+
* Returns the total size, in bytes, of all the dynamic
|
|
8976
|
+
* properties that are currently stored for this entity. This
|
|
8977
|
+
* includes the size of both the key and the value. This can
|
|
8978
|
+
* be useful for diagnosing performance warning signs - if, for
|
|
8979
|
+
* example, an entity has many megabytes of associated dynamic
|
|
8980
|
+
* properties, it may be slow to load on various devices.
|
|
8981
|
+
*
|
|
8982
|
+
*/
|
|
8983
|
+
getDynamicPropertyTotalByteCount(): number;
|
|
8484
8984
|
/**
|
|
8485
8985
|
* @remarks
|
|
8486
8986
|
* Returns the lore value - a secondary display string - for an
|
|
@@ -8576,6 +9076,20 @@ export class ItemStack {
|
|
|
8576
9076
|
* ```
|
|
8577
9077
|
*/
|
|
8578
9078
|
setCanPlaceOn(blockIdentifiers?: string[]): void;
|
|
9079
|
+
/**
|
|
9080
|
+
* @beta
|
|
9081
|
+
* @remarks
|
|
9082
|
+
* Sets a specified property to a value. Note: This function
|
|
9083
|
+
* only works with non-stackable items.
|
|
9084
|
+
*
|
|
9085
|
+
* @param identifier
|
|
9086
|
+
* The property identifier.
|
|
9087
|
+
* @param value
|
|
9088
|
+
* Data value of the property to set.
|
|
9089
|
+
* @throws
|
|
9090
|
+
* Throws if the item stack is stackable.
|
|
9091
|
+
*/
|
|
9092
|
+
setDynamicProperty(identifier: string, value?: boolean | number | string | Vector3): void;
|
|
8579
9093
|
/**
|
|
8580
9094
|
* @remarks
|
|
8581
9095
|
* Sets the lore value - a secondary display string - for an
|
|
@@ -9299,52 +9813,45 @@ export class PistonActivateAfterEventSignal {
|
|
|
9299
9813
|
*
|
|
9300
9814
|
* @example pistonAfterEvent.ts
|
|
9301
9815
|
* ```typescript
|
|
9302
|
-
*
|
|
9303
|
-
*
|
|
9304
|
-
*
|
|
9816
|
+
* // set up a couple of piston blocks
|
|
9817
|
+
* let piston = overworld.getBlock(targetLocation);
|
|
9818
|
+
* let button = overworld.getBlock({
|
|
9819
|
+
* x: targetLocation.x,
|
|
9820
|
+
* y: targetLocation.y + 1,
|
|
9821
|
+
* z: targetLocation.z,
|
|
9822
|
+
* });
|
|
9305
9823
|
*
|
|
9306
|
-
*
|
|
9307
|
-
*
|
|
9308
|
-
*
|
|
9309
|
-
*
|
|
9824
|
+
* if (piston === undefined || button === undefined) {
|
|
9825
|
+
* log("Could not find block at location.");
|
|
9826
|
+
* return -1;
|
|
9827
|
+
* }
|
|
9310
9828
|
*
|
|
9311
|
-
*
|
|
9312
|
-
*
|
|
9829
|
+
* piston.setPermutation(
|
|
9830
|
+
* mc.BlockPermutation.resolve("piston").withState("facing_direction", 3)
|
|
9831
|
+
* );
|
|
9832
|
+
* button.setPermutation(
|
|
9833
|
+
* mc.BlockPermutation.resolve("acacia_button").withState("facing_direction", 1)
|
|
9834
|
+
* );
|
|
9313
9835
|
*
|
|
9314
|
-
*
|
|
9836
|
+
* mc.world.afterEvents.pistonActivate.subscribe(
|
|
9837
|
+
* (pistonEvent: mc.PistonActivateAfterEvent) => {
|
|
9315
9838
|
* let eventLoc = pistonEvent.piston.block.location;
|
|
9316
9839
|
*
|
|
9317
|
-
* if (
|
|
9840
|
+
* if (
|
|
9841
|
+
* eventLoc.x === targetLocation.x &&
|
|
9842
|
+
* eventLoc.y === targetLocation.y &&
|
|
9843
|
+
* eventLoc.z === targetLocation.z
|
|
9844
|
+
* ) {
|
|
9318
9845
|
* log(
|
|
9319
9846
|
* "Piston event at " +
|
|
9320
9847
|
* mc.system.currentTick +
|
|
9321
9848
|
* (pistonEvent.piston.isMoving ? " Moving" : "") +
|
|
9322
|
-
*
|
|
9323
|
-
*
|
|
9324
|
-
* (pistonEvent.piston.isRetracting ? " Retracting" : "") +
|
|
9325
|
-
* (pistonEvent.piston.isRetracted ? " Retracted" : "")
|
|
9849
|
+
* " State: " +
|
|
9850
|
+
* pistonEvent.piston.state
|
|
9326
9851
|
* );
|
|
9327
9852
|
* }
|
|
9328
|
-
* });
|
|
9329
|
-
* ```
|
|
9330
|
-
* @example pistonEvent.ts
|
|
9331
|
-
* ```typescript
|
|
9332
|
-
* let canceled = false;
|
|
9333
|
-
*
|
|
9334
|
-
* const pistonLoc: mc.Vector3 = {
|
|
9335
|
-
* x: Math.floor(targetLocation.x) + 1,
|
|
9336
|
-
* y: Math.floor(targetLocation.y) + 2,
|
|
9337
|
-
* z: Math.floor(targetLocation.z) + 1,
|
|
9338
|
-
* };
|
|
9339
|
-
*
|
|
9340
|
-
* const pistonCallback = mc.world.beforeEvents.pistonActivate.subscribe((pistonEvent: mc.PistonActivateBeforeEvent) => {
|
|
9341
|
-
* if (pistonEvent.piston.location.equals(pistonLoc)) {
|
|
9342
|
-
* log("Cancelling piston event");
|
|
9343
|
-
* pistonEvent.cancel = true;
|
|
9344
|
-
* canceled = true;
|
|
9345
9853
|
* }
|
|
9346
|
-
*
|
|
9347
|
-
*
|
|
9854
|
+
* );
|
|
9348
9855
|
* ```
|
|
9349
9856
|
*/
|
|
9350
9857
|
subscribe(callback: (arg: PistonActivateAfterEvent) => void): (arg: PistonActivateAfterEvent) => void;
|
|
@@ -9482,9 +9989,15 @@ export class Player extends Entity {
|
|
|
9482
9989
|
/**
|
|
9483
9990
|
* @beta
|
|
9484
9991
|
* @remarks
|
|
9992
|
+
* Eats an item, providing the item's hunger and saturation
|
|
9993
|
+
* effects to the player. Can only be used on food items.
|
|
9994
|
+
*
|
|
9485
9995
|
* This function can't be called in read-only mode.
|
|
9486
9996
|
*
|
|
9487
|
-
* @
|
|
9997
|
+
* @param itemStack
|
|
9998
|
+
* The item to eat.
|
|
9999
|
+
* @throws
|
|
10000
|
+
* Throws if the item is not a food item.
|
|
9488
10001
|
*/
|
|
9489
10002
|
eatItem(itemStack: ItemStack): void;
|
|
9490
10003
|
/**
|
|
@@ -10297,21 +10810,40 @@ export class PlayerLeaveAfterEventSignal extends IPlayerLeaveAfterEventSignal {
|
|
|
10297
10810
|
private constructor();
|
|
10298
10811
|
}
|
|
10299
10812
|
|
|
10813
|
+
/**
|
|
10814
|
+
* Contains information regarding a player that is leaving the
|
|
10815
|
+
* world.
|
|
10816
|
+
*/
|
|
10300
10817
|
export class PlayerLeaveBeforeEvent {
|
|
10301
10818
|
private constructor();
|
|
10819
|
+
/**
|
|
10820
|
+
* @remarks
|
|
10821
|
+
* The leaving player.
|
|
10822
|
+
*
|
|
10823
|
+
*/
|
|
10302
10824
|
readonly player: Player;
|
|
10303
10825
|
}
|
|
10304
10826
|
|
|
10827
|
+
/**
|
|
10828
|
+
* Manages callbacks that are connected to a player leaving the
|
|
10829
|
+
* world.
|
|
10830
|
+
*/
|
|
10305
10831
|
export class PlayerLeaveBeforeEventSignal {
|
|
10306
10832
|
private constructor();
|
|
10307
10833
|
/**
|
|
10308
10834
|
* @remarks
|
|
10835
|
+
* Adds a callback that will be called when a player leaves the
|
|
10836
|
+
* world.
|
|
10837
|
+
*
|
|
10309
10838
|
* This function can't be called in read-only mode.
|
|
10310
10839
|
*
|
|
10311
10840
|
*/
|
|
10312
10841
|
subscribe(callback: (arg: PlayerLeaveBeforeEvent) => void): (arg: PlayerLeaveBeforeEvent) => void;
|
|
10313
10842
|
/**
|
|
10314
10843
|
* @remarks
|
|
10844
|
+
* Removes a callback that will be called when a player leaves
|
|
10845
|
+
* the world.
|
|
10846
|
+
*
|
|
10315
10847
|
* This function can't be called in read-only mode.
|
|
10316
10848
|
*
|
|
10317
10849
|
* @throws This function can throw errors.
|
|
@@ -10391,6 +10923,11 @@ export class PlayerPlaceBlockBeforeEvent extends BlockEvent {
|
|
|
10391
10923
|
*
|
|
10392
10924
|
*/
|
|
10393
10925
|
readonly faceLocation: Vector3;
|
|
10926
|
+
/**
|
|
10927
|
+
* @remarks
|
|
10928
|
+
* The block permutation that is being placed.
|
|
10929
|
+
*
|
|
10930
|
+
*/
|
|
10394
10931
|
readonly permutationBeingPlaced: BlockPermutation;
|
|
10395
10932
|
/**
|
|
10396
10933
|
* @remarks
|
|
@@ -11208,6 +11745,10 @@ export class System {
|
|
|
11208
11745
|
*
|
|
11209
11746
|
*/
|
|
11210
11747
|
readonly currentTick: number;
|
|
11748
|
+
/**
|
|
11749
|
+
* @beta
|
|
11750
|
+
*/
|
|
11751
|
+
clearJob(jobId: number): void;
|
|
11211
11752
|
/**
|
|
11212
11753
|
* @remarks
|
|
11213
11754
|
* Cancels the execution of a function run that was previously
|
|
@@ -11266,6 +11807,10 @@ export class System {
|
|
|
11266
11807
|
* ```
|
|
11267
11808
|
*/
|
|
11268
11809
|
runInterval(callback: () => void, tickInterval?: number): number;
|
|
11810
|
+
/**
|
|
11811
|
+
* @beta
|
|
11812
|
+
*/
|
|
11813
|
+
runJob(generator: Generator<void, void, void>): number;
|
|
11269
11814
|
/**
|
|
11270
11815
|
* @remarks
|
|
11271
11816
|
* Runs a set of code at a future time specified by tickDelay.
|
|
@@ -12642,6 +13187,13 @@ export class WorldInitializeAfterEventSignal {
|
|
|
12642
13187
|
unsubscribe(callback: (arg: WorldInitializeAfterEvent) => void): void;
|
|
12643
13188
|
}
|
|
12644
13189
|
|
|
13190
|
+
/**
|
|
13191
|
+
* @beta
|
|
13192
|
+
*/
|
|
13193
|
+
export interface BiomeSearchOptions {
|
|
13194
|
+
boundingSize?: Vector3;
|
|
13195
|
+
}
|
|
13196
|
+
|
|
12645
13197
|
/**
|
|
12646
13198
|
* Contains optional parameters for registering a block event.
|
|
12647
13199
|
*/
|
|
@@ -13024,8 +13576,8 @@ export interface DimensionLocation {
|
|
|
13024
13576
|
|
|
13025
13577
|
/**
|
|
13026
13578
|
* @beta
|
|
13027
|
-
* This
|
|
13028
|
-
* applied to an item.
|
|
13579
|
+
* This interface represents a specific leveled enchantment
|
|
13580
|
+
* that is applied to an item.
|
|
13029
13581
|
*/
|
|
13030
13582
|
export interface Enchantment {
|
|
13031
13583
|
/**
|
|
@@ -13503,6 +14055,11 @@ export interface PlayAnimationOptions {
|
|
|
13503
14055
|
*
|
|
13504
14056
|
*/
|
|
13505
14057
|
nextState?: string;
|
|
14058
|
+
/**
|
|
14059
|
+
* @remarks
|
|
14060
|
+
* A list of players the animation will be visible to.
|
|
14061
|
+
*
|
|
14062
|
+
*/
|
|
13506
14063
|
players?: string[];
|
|
13507
14064
|
/**
|
|
13508
14065
|
* @remarks
|
|
@@ -13538,6 +14095,13 @@ export interface PlayerSoundOptions {
|
|
|
13538
14095
|
volume?: number;
|
|
13539
14096
|
}
|
|
13540
14097
|
|
|
14098
|
+
/**
|
|
14099
|
+
* @beta
|
|
14100
|
+
*/
|
|
14101
|
+
export interface ProjectileShootOptions {
|
|
14102
|
+
uncertainty?: number;
|
|
14103
|
+
}
|
|
14104
|
+
|
|
13541
14105
|
/**
|
|
13542
14106
|
* Defines a JSON structure that is used for more flexible.
|
|
13543
14107
|
*/
|