@minecraft/server 1.18.0 → 1.19.0-rc.1.21.80-preview.26

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.
Files changed (3) hide show
  1. package/README.md +3 -1
  2. package/index.d.ts +242 -3
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -2,6 +2,8 @@
2
2
 
3
3
  Contains many types related to manipulating a Minecraft world, including entities, blocks, dimensions, and more.
4
4
 
5
+ ## **NOTE: This version of this module is still in pre-release. It may change or it may be removed in future releases.**
6
+
5
7
  See full documentation for this module here:
6
8
 
7
- https://learn.microsoft.com/en-us/minecraft/creator/scriptapi/minecraft/server/minecraft-server
9
+ https://learn.microsoft.com/en-us/minecraft/creator/legacyscriptapi/minecraft/server-1xx/minecraft-server
package/index.d.ts CHANGED
@@ -7,6 +7,7 @@
7
7
  Copyright (c) Microsoft Corporation.
8
8
  ***************************************************************************** */
9
9
  /**
10
+ * @preview
10
11
  * @packageDocumentation
11
12
  * Contains many types related to manipulating a Minecraft
12
13
  * world, including entities, blocks, dimensions, and more.
@@ -15,7 +16,7 @@
15
16
  * ```json
16
17
  * {
17
18
  * "module_name": "@minecraft/server",
18
- * "version": "1.18.0"
19
+ * "version": "1.19.0"
19
20
  * }
20
21
  * ```
21
22
  *
@@ -126,6 +127,38 @@ export enum CustomComponentNameErrorReason {
126
127
  DisallowedNamespace = 2,
127
128
  }
128
129
 
130
+ /**
131
+ * @rc
132
+ * An enumeration for the various difficulty levels of
133
+ * Minecraft.
134
+ */
135
+ export enum Difficulty {
136
+ /**
137
+ * @remarks
138
+ * Easy difficulty level.
139
+ *
140
+ */
141
+ Easy = 'Easy',
142
+ /**
143
+ * @remarks
144
+ * Hard difficulty level.
145
+ *
146
+ */
147
+ Hard = 'Hard',
148
+ /**
149
+ * @remarks
150
+ * Normal difficulty level.
151
+ *
152
+ */
153
+ Normal = 'Normal',
154
+ /**
155
+ * @remarks
156
+ * Peaceful difficulty level.
157
+ *
158
+ */
159
+ Peaceful = 'Peaceful',
160
+ }
161
+
129
162
  /**
130
163
  * A general purpose relative direction enumeration.
131
164
  */
@@ -5403,6 +5436,58 @@ export class Dimension {
5403
5436
  * @throws This function can throw errors.
5404
5437
  */
5405
5438
  getTopmostBlock(locationXZ: VectorXZ, minHeight?: number): Block | undefined;
5439
+ /**
5440
+ * @rc
5441
+ * @remarks
5442
+ * Places the given feature into the dimension at the specified
5443
+ * location.
5444
+ *
5445
+ * This function can't be called in read-only mode.
5446
+ *
5447
+ * @param featureName
5448
+ * The string identifier for the feature.
5449
+ * @param location
5450
+ * Location to place the feature.
5451
+ * @param shouldThrow
5452
+ * Specifies if the function call will throw an error if the
5453
+ * feature could not be placed.
5454
+ * Note: The function call will always throw an error if using
5455
+ * an unknown feature name or trying to place in a unloaded
5456
+ * chunk.
5457
+ * @throws
5458
+ * An error will be thrown if the feature name is invalid.
5459
+ * An error will be thrown if the location is in an unloaded
5460
+ * chunk.
5461
+ *
5462
+ * {@link Error}
5463
+ *
5464
+ * {@link minecraftcommon.InvalidArgumentError}
5465
+ *
5466
+ * {@link LocationInUnloadedChunkError}
5467
+ */
5468
+ placeFeature(featureName: string, location: Vector3, shouldThrow?: boolean): boolean;
5469
+ /**
5470
+ * @rc
5471
+ * @remarks
5472
+ * Places the given feature rule into the dimension at the
5473
+ * specified location.
5474
+ *
5475
+ * This function can't be called in read-only mode.
5476
+ *
5477
+ * @param featureRuleName
5478
+ * The string identifier for the feature rule.
5479
+ * @param location
5480
+ * Location to place the feature rule.
5481
+ * @throws
5482
+ * An error will be thrown if the feature rule name is invalid.
5483
+ * An error will be thrown if the location is in an unloaded
5484
+ * chunk.
5485
+ *
5486
+ * {@link minecraftcommon.InvalidArgumentError}
5487
+ *
5488
+ * {@link LocationInUnloadedChunkError}
5489
+ */
5490
+ placeFeatureRule(featureRuleName: string, location: Vector3): boolean;
5406
5491
  /**
5407
5492
  * @remarks
5408
5493
  * Plays a sound for all players.
@@ -11039,8 +11124,9 @@ export class ItemStack {
11039
11124
  * @param componentId
11040
11125
  * The identifier of the component (e.g., 'minecraft:food'). If
11041
11126
  * no namespace prefix is specified, 'minecraft:' is assumed.
11042
- * Available component IDs can be found as part of the {@link
11043
- * ItemComponentTypes} enum.
11127
+ * Available component IDs are those in the {@link
11128
+ * ItemComponentTypes} enum and custom component IDs registered
11129
+ * with the {@link ItemComponentRegistry}.
11044
11130
  * @returns
11045
11131
  * Returns the component if it exists on the item stack,
11046
11132
  * otherwise undefined.
@@ -12393,6 +12479,22 @@ export class Player extends Entity {
12393
12479
  * @throws This function can throw errors.
12394
12480
  */
12395
12481
  addLevels(amount: number): number;
12482
+ /**
12483
+ * @rc
12484
+ * @remarks
12485
+ * For this player, removes all overrides of any Entity
12486
+ * Properties on the target Entity. This change is not applied
12487
+ * until the next tick and will not apply to other players.
12488
+ *
12489
+ * This function can't be called in read-only mode.
12490
+ *
12491
+ * @param targetEntity
12492
+ * The Entity whose Entity Property overrides are being
12493
+ * cleared.
12494
+ * @throws
12495
+ * Throws if the entity is invalid.
12496
+ */
12497
+ clearPropertyOverridesForEntity(targetEntity: Entity): void;
12396
12498
  /**
12397
12499
  * @remarks
12398
12500
  * Retrieves the active gamemode for this player, if specified.
@@ -12496,6 +12598,26 @@ export class Player extends Entity {
12496
12598
  *
12497
12599
  */
12498
12600
  queueMusic(trackId: string, musicOptions?: MusicOptions): void;
12601
+ /**
12602
+ * @rc
12603
+ * @remarks
12604
+ * For this player, removes the override on an Entity Property.
12605
+ * This change is not applied until the next tick and will not
12606
+ * apply to other players.
12607
+ *
12608
+ * This function can't be called in read-only mode.
12609
+ *
12610
+ * @param targetEntity
12611
+ * The Entity whose Entity Property override is being removed.
12612
+ * @param identifier
12613
+ * The Entity Property identifier.
12614
+ * @throws
12615
+ * Throws if the entity is invalid.
12616
+ * Throws if an invalid identifier is provided.
12617
+ * Throws if the provided value type does not match the
12618
+ * property type.
12619
+ */
12620
+ removePropertyOverrideForEntity(targetEntity: Entity, identifier: string): void;
12499
12621
  /**
12500
12622
  * @remarks
12501
12623
  * Resets the level of the player.
@@ -12515,6 +12637,10 @@ export class Player extends Entity {
12515
12637
  * This method can throw if the provided {@link RawMessage} is
12516
12638
  * in an invalid format. For example, if an empty `name` string
12517
12639
  * is provided to `score`.
12640
+ *
12641
+ * {@link InvalidEntityError}
12642
+ *
12643
+ * {@link RawMessageError}
12518
12644
  * @example nestedTranslation.ts
12519
12645
  * ```typescript
12520
12646
  * import { world, DimensionLocation } from "@minecraft/server";
@@ -12602,6 +12728,34 @@ export class Player extends Entity {
12602
12728
  * @throws This function can throw errors.
12603
12729
  */
12604
12730
  setGameMode(gameMode?: GameMode): void;
12731
+ /**
12732
+ * @rc
12733
+ * @remarks
12734
+ * For this player, overrides an Entity Property on the target
12735
+ * Entity to the provided value. This property must be client
12736
+ * synced. This change is not applied until the next tick and
12737
+ * will not apply to other players.
12738
+ *
12739
+ * This function can't be called in read-only mode.
12740
+ *
12741
+ * @param targetEntity
12742
+ * The Entity whose Entity Property is being overriden.
12743
+ * @param identifier
12744
+ * The Entity Property identifier.
12745
+ * @param value
12746
+ * The override value. The provided type must be compatible
12747
+ * with the type specified in the entity's definition.
12748
+ * @throws
12749
+ * Throws if the entity is invalid.
12750
+ * Throws if an invalid identifier is provided.
12751
+ * Throws if the provided value type does not match the
12752
+ * property type.
12753
+ * Throws if the provided value is outside the expected range
12754
+ * (int, float properties).
12755
+ * Throws if the provided string value does not match the set
12756
+ * of accepted enum values (enum properties)
12757
+ */
12758
+ setPropertyOverrideForEntity(targetEntity: Entity, identifier: string, value: boolean | number | string): void;
12605
12759
  /**
12606
12760
  * @remarks
12607
12761
  * Sets the current starting spawn point for this particular
@@ -14420,6 +14574,8 @@ export class ScreenDisplay {
14420
14574
  * This function can't be called in read-only mode.
14421
14575
  *
14422
14576
  * @throws This function can throw errors.
14577
+ *
14578
+ * {@link InvalidEntityError}
14423
14579
  */
14424
14580
  getHiddenHudElements(): HudElement[];
14425
14581
  /**
@@ -14427,6 +14583,8 @@ export class ScreenDisplay {
14427
14583
  * This function can't be called in read-only mode.
14428
14584
  *
14429
14585
  * @throws This function can throw errors.
14586
+ *
14587
+ * {@link InvalidEntityError}
14430
14588
  */
14431
14589
  hideAllExcept(hudElements?: HudElement[]): void;
14432
14590
  /**
@@ -14434,6 +14592,8 @@ export class ScreenDisplay {
14434
14592
  * This function can't be called in read-only mode.
14435
14593
  *
14436
14594
  * @throws This function can throw errors.
14595
+ *
14596
+ * {@link InvalidEntityError}
14437
14597
  */
14438
14598
  isForcedHidden(hudElement: HudElement): boolean;
14439
14599
  /**
@@ -14446,10 +14606,14 @@ export class ScreenDisplay {
14446
14606
  */
14447
14607
  isValid(): boolean;
14448
14608
  /**
14609
+ * @deprecated This function is deprecated and will be removed in 2.0.0.
14610
+ *
14449
14611
  * @remarks
14450
14612
  * This function can't be called in read-only mode.
14451
14613
  *
14452
14614
  * @throws This function can throw errors.
14615
+ *
14616
+ * {@link InvalidEntityError}
14453
14617
  */
14454
14618
  resetHudElements(): void;
14455
14619
  /**
@@ -14462,6 +14626,10 @@ export class ScreenDisplay {
14462
14626
  * @param text
14463
14627
  * New value for the action bar text.
14464
14628
  * @throws This function can throw errors.
14629
+ *
14630
+ * {@link InvalidEntityError}
14631
+ *
14632
+ * {@link RawMessageError}
14465
14633
  */
14466
14634
  setActionBar(text: (RawMessage | string)[] | RawMessage | string): void;
14467
14635
  /**
@@ -14477,6 +14645,8 @@ export class ScreenDisplay {
14477
14645
  * @param hudElements
14478
14646
  * Optional list of HUD elements to configure visibility for.
14479
14647
  * @throws This function can throw errors.
14648
+ *
14649
+ * {@link InvalidEntityError}
14480
14650
  */
14481
14651
  setHudVisibility(visible: HudVisibility, hudElements?: HudElement[]): void;
14482
14652
  /**
@@ -14489,6 +14659,12 @@ export class ScreenDisplay {
14489
14659
  * This function can't be called in read-only mode.
14490
14660
  *
14491
14661
  * @throws This function can throw errors.
14662
+ *
14663
+ * {@link minecraftcommon.ArgumentOutOfBoundsError}
14664
+ *
14665
+ * {@link InvalidEntityError}
14666
+ *
14667
+ * {@link RawMessageError}
14492
14668
  * @example setTitle.ts
14493
14669
  * ```typescript
14494
14670
  * import { world, DimensionLocation } from "@minecraft/server";
@@ -14554,6 +14730,10 @@ export class ScreenDisplay {
14554
14730
  * This function can't be called in read-only mode.
14555
14731
  *
14556
14732
  * @throws This function can throw errors.
14733
+ *
14734
+ * {@link InvalidEntityError}
14735
+ *
14736
+ * {@link RawMessageError}
14557
14737
  * @example countdown.ts
14558
14738
  * ```typescript
14559
14739
  * import { world, system, DimensionLocation } from "@minecraft/server";
@@ -15658,6 +15838,15 @@ export class World {
15658
15838
  * not fixed and will be determined by surrounding blocks.
15659
15839
  */
15660
15840
  getDefaultSpawnLocation(): Vector3;
15841
+ /**
15842
+ * @rc
15843
+ * @remarks
15844
+ * Gets the difficulty from the world.
15845
+ *
15846
+ * @returns
15847
+ * Returns the world difficulty.
15848
+ */
15849
+ getDifficulty(): Difficulty;
15661
15850
  /**
15662
15851
  * @remarks
15663
15852
  * Returns a dimension object.
@@ -15945,6 +16134,17 @@ export class World {
15945
16134
  * {@link LocationOutOfWorldBoundariesError}
15946
16135
  */
15947
16136
  setDefaultSpawnLocation(spawnLocation: Vector3): void;
16137
+ /**
16138
+ * @rc
16139
+ * @remarks
16140
+ * Sets the worlds difficulty.
16141
+ *
16142
+ * This function can't be called in read-only mode.
16143
+ *
16144
+ * @param difficulty
16145
+ * The difficulty we want to set the world to.
16146
+ */
16147
+ setDifficulty(difficulty: Difficulty): void;
15948
16148
  /**
15949
16149
  * @remarks
15950
16150
  * Sets a specified property to a value.
@@ -16654,6 +16854,40 @@ export class WorldInitializeBeforeEventSignal {
16654
16854
  unsubscribe(callback: (arg0: WorldInitializeBeforeEvent) => void): void;
16655
16855
  }
16656
16856
 
16857
+ /**
16858
+ * @rc
16859
+ * A BlockBoundingBox is an interface to an object which
16860
+ * represents an AABB aligned rectangle.
16861
+ * The BlockBoundingBox assumes that it was created in a valid
16862
+ * state (min <= max) but cannot guarantee it (unless it was
16863
+ * created using the associated {@link
16864
+ * @minecraft/server.BlockBoundingBoxUtils} utility functions.
16865
+ * The min/max coordinates represent the diametrically opposite
16866
+ * corners of the rectangle.
16867
+ * The BlockBoundingBox is not a representation of blocks - it
16868
+ * has no association with any type, it is just a mathematical
16869
+ * construct - so a rectangle with
16870
+ * ( 0,0,0 ) -> ( 0,0,0 )
16871
+ * has a size of ( 0,0,0 ) (unlike the very similar {@link
16872
+ * BlockVolume} object)
16873
+ */
16874
+ export interface BlockBoundingBox {
16875
+ /**
16876
+ * @remarks
16877
+ * A {@link Vector3} that represents the largest corner of the
16878
+ * rectangle
16879
+ *
16880
+ */
16881
+ max: Vector3;
16882
+ /**
16883
+ * @remarks
16884
+ * A {@link Vector3} that represents the smallest corner of the
16885
+ * rectangle
16886
+ *
16887
+ */
16888
+ min: Vector3;
16889
+ }
16890
+
16657
16891
  /**
16658
16892
  * Contains a set of events that will be raised for a block.
16659
16893
  * This object must be bound using the BlockRegistry.
@@ -18723,6 +18957,11 @@ export class NamespaceNameError extends Error {
18723
18957
  reason: NamespaceNameErrorReason;
18724
18958
  }
18725
18959
 
18960
+ // @ts-ignore Class inheritance allowed for native defined classes
18961
+ export class RawMessageError extends Error {
18962
+ private constructor();
18963
+ }
18964
+
18726
18965
  /**
18727
18966
  * Error thrown when the specified area contains one or more
18728
18967
  * unloaded chunks.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.18.0",
3
+ "version": "1.19.0-rc.1.21.80-preview.26",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {