@minecraft/server 2.3.0-beta.1.21.110-preview.24 → 2.3.0-beta.1.21.110-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 (2) hide show
  1. package/index.d.ts +347 -29
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -133,7 +133,7 @@ export enum BlockVolumeIntersection {
133
133
  }
134
134
 
135
135
  /**
136
- * @beta
136
+ * @rc
137
137
  * An enum of error reasons relating to using {@link
138
138
  * ItemBookComponent}.
139
139
  */
@@ -1891,6 +1891,26 @@ export enum GraphicsMode {
1891
1891
  Simple = 'Simple',
1892
1892
  }
1893
1893
 
1894
+ /**
1895
+ * @beta
1896
+ * Specifies options related to the item currently being held
1897
+ * by an entity.
1898
+ */
1899
+ export enum HeldItemOption {
1900
+ /**
1901
+ * @remarks
1902
+ * Any item is being held.
1903
+ *
1904
+ */
1905
+ AnyItem = 'AnyItem',
1906
+ /**
1907
+ * @remarks
1908
+ * No item is being held.
1909
+ *
1910
+ */
1911
+ NoItem = 'NoItem',
1912
+ }
1913
+
1894
1914
  export enum HudElement {
1895
1915
  PaperDoll = 0,
1896
1916
  Armor = 1,
@@ -2076,7 +2096,7 @@ export enum InputPermissionCategory {
2076
2096
  */
2077
2097
  export enum ItemComponentTypes {
2078
2098
  /**
2079
- * @beta
2099
+ * @rc
2080
2100
  * @remarks
2081
2101
  * The minecraft:book component.
2082
2102
  *
@@ -5742,7 +5762,7 @@ export class Camera {
5742
5762
  */
5743
5763
  setDefaultCamera(cameraPreset: string, easeOptions?: EaseOptions): void;
5744
5764
  /**
5745
- * @beta
5765
+ * @rc
5746
5766
  * @remarks
5747
5767
  * This function can't be called in read-only mode.
5748
5768
  *
@@ -6828,7 +6848,7 @@ export class ContainerSlot {
6828
6848
  */
6829
6849
  getLore(): string[];
6830
6850
  /**
6831
- * @beta
6851
+ * @rc
6832
6852
  * @remarks
6833
6853
  * Returns the lore value - a secondary display string - for an
6834
6854
  * ItemStack. String lore lines will be converted to a {@link
@@ -7318,8 +7338,6 @@ export class Dimension {
7318
7338
  * time to complete, so avoid using many of these calls within
7319
7339
  * a particular tick.
7320
7340
  *
7321
- * This function can't be called in read-only mode.
7322
- *
7323
7341
  * @param pos
7324
7342
  * Starting location to look for a biome to find.
7325
7343
  * @param biomeToFind
@@ -7384,8 +7402,6 @@ export class Dimension {
7384
7402
  * based on the given options (by default will find the first
7385
7403
  * solid block above).
7386
7404
  *
7387
- * This function can't be called in read-only mode.
7388
- *
7389
7405
  * @param location
7390
7406
  * Location to retrieve the block above from.
7391
7407
  * @param options
@@ -7399,8 +7415,6 @@ export class Dimension {
7399
7415
  * based on the given options (by default will find the first
7400
7416
  * solid block below).
7401
7417
  *
7402
- * This function can't be called in read-only mode.
7403
- *
7404
7418
  * @param location
7405
7419
  * Location to retrieve the block below from.
7406
7420
  * @param options
@@ -7566,8 +7580,6 @@ export class Dimension {
7566
7580
  * Returns the total brightness level of light shining on a
7567
7581
  * certain block position.
7568
7582
  *
7569
- * This function can't be called in read-only mode.
7570
- *
7571
7583
  * @param location
7572
7584
  * Location of the block we want to check the brightness of.
7573
7585
  * @returns
@@ -7602,8 +7614,6 @@ export class Dimension {
7602
7614
  * Returns the brightness level of light shining from the sky
7603
7615
  * on a certain block position.
7604
7616
  *
7605
- * This function can't be called in read-only mode.
7606
- *
7607
7617
  * @param location
7608
7618
  * Position of the block we want to check the brightness of.
7609
7619
  * @returns
@@ -7619,8 +7629,6 @@ export class Dimension {
7619
7629
  * @remarks
7620
7630
  * Returns the highest block at the given XZ location.
7621
7631
  *
7622
- * This function can't be called in read-only mode.
7623
- *
7624
7632
  * @param locationXZ
7625
7633
  * Location to retrieve the topmost block for.
7626
7634
  * @param minHeight
@@ -7634,13 +7642,21 @@ export class Dimension {
7634
7642
  * @remarks
7635
7643
  * Returns the current weather.
7636
7644
  *
7637
- * This function can't be called in read-only mode.
7638
- *
7639
7645
  * @returns
7640
7646
  * Returns a WeatherType that explains the broad category of
7641
7647
  * weather that is currently going on.
7642
7648
  */
7643
7649
  getWeather(): WeatherType;
7650
+ /**
7651
+ * @beta
7652
+ * @remarks
7653
+ * Returns true if the chunk at the given location is loaded
7654
+ * (and valid for use with scripting).
7655
+ *
7656
+ * @param location
7657
+ * Location to check if the chunk is loaded.
7658
+ */
7659
+ isChunkLoaded(location: Vector3): boolean;
7644
7660
  /**
7645
7661
  * @remarks
7646
7662
  * Places the given feature into the dimension at the specified
@@ -8241,6 +8257,16 @@ export class EffectTypes {
8241
8257
  static getAll(): EffectType[];
8242
8258
  }
8243
8259
 
8260
+ /**
8261
+ * @beta
8262
+ * Represents a completely empty entry in a loot pool. If this
8263
+ * entry is chosen, no items will drop.
8264
+ */
8265
+ // @ts-ignore Class inheritance allowed for native defined classes
8266
+ export class EmptyLootItem extends LootPoolEntry {
8267
+ private constructor();
8268
+ }
8269
+
8244
8270
  /**
8245
8271
  * Contains information on a type of enchantment.
8246
8272
  */
@@ -12601,7 +12627,7 @@ export class InputInfo {
12601
12627
  }
12602
12628
 
12603
12629
  /**
12604
- * @beta
12630
+ * @rc
12605
12631
  * When present on an item, this item is a book item. Can
12606
12632
  * access and modify the contents of the book and sign it.
12607
12633
  */
@@ -13914,7 +13940,7 @@ export class ItemStack {
13914
13940
  */
13915
13941
  getLore(): string[];
13916
13942
  /**
13917
- * @beta
13943
+ * @rc
13918
13944
  * @remarks
13919
13945
  * Returns the lore value - a secondary display string - for an
13920
13946
  * ItemStack. String lore lines will be converted to a {@link
@@ -14685,6 +14711,166 @@ export class ListBlockVolume extends BlockVolumeBase {
14685
14711
 
14686
14712
  /**
14687
14713
  * @beta
14714
+ * Represents a loot pool entry containing an item to drop.
14715
+ */
14716
+ // @ts-ignore Class inheritance allowed for native defined classes
14717
+ export class LootItem extends LootPoolEntry {
14718
+ private constructor();
14719
+ /**
14720
+ * @remarks
14721
+ * The name of the item contained in this entry.
14722
+ *
14723
+ */
14724
+ readonly name?: ItemType;
14725
+ }
14726
+
14727
+ /**
14728
+ * @beta
14729
+ * A collection of entries which individually determine loot
14730
+ * drops. Can contain values determining drop outcomes,
14731
+ * including rolls, bonus rolls and tiers.
14732
+ */
14733
+ export class LootPool {
14734
+ private constructor();
14735
+ /**
14736
+ * @remarks
14737
+ * Returns the number of extra times a loot pool will be rolled
14738
+ * based on the player's luck level, represented as a range
14739
+ * from minimum to maximum rolls.
14740
+ *
14741
+ */
14742
+ readonly bonusRolls: minecraftcommon.NumberRange;
14743
+ /**
14744
+ * @remarks
14745
+ * Gets a complete list of all loot pool entries contained in
14746
+ * the loot pool.
14747
+ *
14748
+ */
14749
+ readonly entries: LootPoolEntry[];
14750
+ /**
14751
+ * @remarks
14752
+ * Returns the number of times a loot pool will be rolled,
14753
+ * represented as a range from minimum to maximum rolls.
14754
+ *
14755
+ */
14756
+ readonly rolls: minecraftcommon.NumberRange;
14757
+ /**
14758
+ * @remarks
14759
+ * Gets the loot pool tier values for a given table if they
14760
+ * exist.
14761
+ *
14762
+ */
14763
+ readonly tiers?: LootPoolTiers;
14764
+ }
14765
+
14766
+ /**
14767
+ * @beta
14768
+ * Represents one entry within Loot Table, which describes one
14769
+ * possible drop when a loot drop occurs. Can contain an item,
14770
+ * another loot table, a path to another loot table, or an
14771
+ * empty drop.
14772
+ */
14773
+ export class LootPoolEntry {
14774
+ private constructor();
14775
+ /**
14776
+ * @remarks
14777
+ * Gets the quality of a given loot pool entry.
14778
+ *
14779
+ */
14780
+ readonly quality: number;
14781
+ /**
14782
+ * @remarks
14783
+ * Gets the subtable of a given loot pool entry.
14784
+ *
14785
+ */
14786
+ readonly subTable?: LootPoolEntry;
14787
+ /**
14788
+ * @remarks
14789
+ * Gets the weight of a given loot pool entry.
14790
+ *
14791
+ */
14792
+ readonly weight: number;
14793
+ }
14794
+
14795
+ /**
14796
+ * @beta
14797
+ * Represents the values which determine loot drops in a tiered
14798
+ * loot pool. Potential drops from tiered loot pools are
14799
+ * ordered, and chosen via logic controlled by the values in
14800
+ * this object.
14801
+ */
14802
+ export class LootPoolTiers {
14803
+ private constructor();
14804
+ /**
14805
+ * @remarks
14806
+ * The chance for each bonus roll attempt to upgrade the tier
14807
+ * of the dropped item.
14808
+ *
14809
+ */
14810
+ readonly bonusChance: number;
14811
+ /**
14812
+ * @remarks
14813
+ * The number of attempts for the loot drop to upgrade its
14814
+ * tier, thereby incrementing its position in the loot pool
14815
+ * entry array, resulting in a higher tier drop.
14816
+ *
14817
+ */
14818
+ readonly bonusRolls: number;
14819
+ /**
14820
+ * @remarks
14821
+ * Represents the upper bound for the starting point in
14822
+ * determining which tier of loot to drop. The lower bound is
14823
+ * always 1. For example, a value of 3 would result in the tier
14824
+ * drop logic starting at a randomly selected position in the
14825
+ * loot pool entry array between 1 and 3.
14826
+ *
14827
+ */
14828
+ readonly initialRange: number;
14829
+ }
14830
+
14831
+ /**
14832
+ * @beta
14833
+ * Represents a single Loot Table, which determines what items
14834
+ * are generated when killing a mob, breaking a block, filling
14835
+ * a container, and more.
14836
+ */
14837
+ export class LootTable {
14838
+ private constructor();
14839
+ /**
14840
+ * @remarks
14841
+ * Returns the path to the JSON file that represents this loot
14842
+ * table. Does not include file extension, or 'loot_tables/'
14843
+ * folder prefix. Example: `entities/creeper`.
14844
+ *
14845
+ */
14846
+ readonly path: string;
14847
+ /**
14848
+ * @remarks
14849
+ * Returns the array of loot pools on a given loot table.
14850
+ *
14851
+ */
14852
+ readonly pools: LootPool[];
14853
+ }
14854
+
14855
+ /**
14856
+ * @beta
14857
+ * Represents a loot pool entry containing another separate,
14858
+ * nested loot table.
14859
+ */
14860
+ // @ts-ignore Class inheritance allowed for native defined classes
14861
+ export class LootTableEntry extends LootPoolEntry {
14862
+ private constructor();
14863
+ /**
14864
+ * @remarks
14865
+ * Gets the loot table stored as a subtable in the parent loot
14866
+ * pool.
14867
+ *
14868
+ */
14869
+ readonly lootTable: LootTable;
14870
+ }
14871
+
14872
+ /**
14873
+ * @rc
14688
14874
  * Manager for Loot Table related APIs. Allows for generation
14689
14875
  * of drops from blocks and entities according to their loot
14690
14876
  * tables.
@@ -14767,6 +14953,51 @@ export class LootTableManager {
14767
14953
  * Can be empty if no loot dropped.
14768
14954
  */
14769
14955
  generateLootFromEntityType(entityType: EntityType, tool?: ItemStack): ItemStack[] | undefined;
14956
+ /**
14957
+ * @beta
14958
+ * @remarks
14959
+ * Generates loot from a given LootTable.
14960
+ *
14961
+ * @param tool
14962
+ * Optional. The tool to use in the looting operation.
14963
+ * @returns
14964
+ * An array of item stacks dropped from the loot drop event.
14965
+ * Can be empty if no loot dropped, or undefined if the
14966
+ * provided tool is insufficient to mine the block.
14967
+ */
14968
+ generateLootFromTable(lootTable: LootTable, tool?: ItemStack): ItemStack[] | undefined;
14969
+ /**
14970
+ * @beta
14971
+ * @remarks
14972
+ * Retrieves a single loot table from the level's current
14973
+ * registry.
14974
+ *
14975
+ * @param path
14976
+ * Path to the table to retrieve. Does not include file
14977
+ * extension, or 'loot_tables/' folder prefix. Example:
14978
+ * `entities/creeper`.
14979
+ * @returns
14980
+ * Returns a LootTable if one is found, or `undefined` if the
14981
+ * provided path does not correspond to an existing loot table.
14982
+ */
14983
+ getLootTable(path: string): LootTable | undefined;
14984
+ }
14985
+
14986
+ /**
14987
+ * @beta
14988
+ * Represents a loot pool entry containing a reference to
14989
+ * another loot table, described by its path.
14990
+ */
14991
+ // @ts-ignore Class inheritance allowed for native defined classes
14992
+ export class LootTableReference extends LootPoolEntry {
14993
+ private constructor();
14994
+ /**
14995
+ * @remarks
14996
+ * The path to the referenced loot table. Example:
14997
+ * `loot_tables/chests/village/village_bundle.json`
14998
+ *
14999
+ */
15000
+ readonly path: string;
14770
15001
  }
14771
15002
 
14772
15003
  /**
@@ -16993,6 +17224,65 @@ export class PlayerSpawnAfterEventSignal {
16993
17224
  unsubscribe(callback: (arg0: PlayerSpawnAfterEvent) => void): void;
16994
17225
  }
16995
17226
 
17227
+ /**
17228
+ * @beta
17229
+ * Contains information regarding a player starting to swing
17230
+ * their arm.
17231
+ */
17232
+ export class PlayerSwingStartAfterEvent {
17233
+ private constructor();
17234
+ /**
17235
+ * @remarks
17236
+ * The item stack being held by the player at the start of
17237
+ * their swing.
17238
+ *
17239
+ */
17240
+ readonly heldItemStack?: ItemStack;
17241
+ /**
17242
+ * @remarks
17243
+ * Source Player for this event.
17244
+ *
17245
+ */
17246
+ readonly player: Player;
17247
+ }
17248
+
17249
+ /**
17250
+ * @beta
17251
+ * Manages callbacks that are connected to when a player starts
17252
+ * to swing their arm (e.g. attacking, using an item,
17253
+ * interacting).
17254
+ */
17255
+ export class PlayerSwingStartAfterEventSignal {
17256
+ private constructor();
17257
+ /**
17258
+ * @remarks
17259
+ * Adds a callback that will be called when a player starts to
17260
+ * swing their arm (e.g. attacking, using an item,
17261
+ * interacting).
17262
+ *
17263
+ * This function can't be called in read-only mode.
17264
+ *
17265
+ * This function can be called in early-execution mode.
17266
+ *
17267
+ */
17268
+ subscribe(
17269
+ callback: (arg0: PlayerSwingStartAfterEvent) => void,
17270
+ options?: PlayerSwingEventOptions,
17271
+ ): (arg0: PlayerSwingStartAfterEvent) => void;
17272
+ /**
17273
+ * @remarks
17274
+ * Removes a callback from being called when a player starts to
17275
+ * swing their arm (e.g. attacking, using an item,
17276
+ * interacting).
17277
+ *
17278
+ * This function can't be called in read-only mode.
17279
+ *
17280
+ * This function can be called in early-execution mode.
17281
+ *
17282
+ */
17283
+ unsubscribe(callback: (arg0: PlayerSwingStartAfterEvent) => void): void;
17284
+ }
17285
+
16996
17286
  /**
16997
17287
  * @beta
16998
17288
  * Represents how the potion effect is delivered.
@@ -19452,7 +19742,14 @@ export class World {
19452
19742
  */
19453
19743
  getEntity(id: string): Entity | undefined;
19454
19744
  /**
19455
- * @beta
19745
+ * @rc
19746
+ * @remarks
19747
+ * Returns a manager capable of generating loot from an
19748
+ * assortment of sources.
19749
+ *
19750
+ * @returns
19751
+ * A loot table manager with a variety of loot generation
19752
+ * methods.
19456
19753
  */
19457
19754
  getLootTableManager(): LootTableManager;
19458
19755
  /**
@@ -20078,6 +20375,13 @@ export class WorldAfterEvents {
20078
20375
  *
20079
20376
  */
20080
20377
  readonly playerSpawn: PlayerSpawnAfterEventSignal;
20378
+ /**
20379
+ * @beta
20380
+ * @remarks
20381
+ * This property can be read in early-execution mode.
20382
+ *
20383
+ */
20384
+ readonly playerSwingStart: PlayerSwingStartAfterEventSignal;
20081
20385
  /**
20082
20386
  * @remarks
20083
20387
  * A pressure plate has popped back up (i.e., there are no
@@ -20650,12 +20954,8 @@ export interface CameraFixedBoomOptions {
20650
20954
  }
20651
20955
 
20652
20956
  /**
20653
- * @beta
20957
+ * @rc
20654
20958
  * Used to change the field of view of the current camera.
20655
- *
20656
- * Required Experiments:
20657
- * - Required Experiment Toggle: Experimental Creator Cameras
20658
- *
20659
20959
  */
20660
20960
  export interface CameraFovOptions {
20661
20961
  easeOptions?: EaseOptions;
@@ -22052,6 +22352,24 @@ export interface PlayerSoundOptions {
22052
22352
  volume?: number;
22053
22353
  }
22054
22354
 
22355
+ /**
22356
+ * @beta
22357
+ * An interface that is passed into {@link
22358
+ * @minecraft/Server.PlayerSwingStartAfterEvent.subscribe} that
22359
+ * filters out which events are passed to the provided
22360
+ * callback.
22361
+ */
22362
+ export interface PlayerSwingEventOptions {
22363
+ /**
22364
+ * @remarks
22365
+ * The held item option that the callback should be called for.
22366
+ * If undefined, the callback will be called whether or not the
22367
+ * player is holding an item in their hand.
22368
+ *
22369
+ */
22370
+ heldItemOption?: HeldItemOption;
22371
+ }
22372
+
22055
22373
  /**
22056
22374
  * Optional arguments for
22057
22375
  * @minecraft/server.EntityProjectileComponent.shoot.
@@ -22659,7 +22977,7 @@ export class BlockCustomComponentReloadVersionError extends Error {
22659
22977
  }
22660
22978
 
22661
22979
  /**
22662
- * @beta
22980
+ * @rc
22663
22981
  * Errors that can be thrown when using {@link
22664
22982
  * ItemBookComponent}.
22665
22983
  */
@@ -22677,7 +22995,7 @@ export class BookError extends Error {
22677
22995
  }
22678
22996
 
22679
22997
  /**
22680
- * @beta
22998
+ * @rc
22681
22999
  * The error called if page content being set on an {@link
22682
23000
  * ItemBookComponent} are invalid ie. exceeding the maximum
22683
23001
  * page length.
@@ -22822,7 +23140,7 @@ export class InvalidEntityError extends Error {
22822
23140
  }
22823
23141
 
22824
23142
  /**
22825
- * @beta
23143
+ * @rc
22826
23144
  * The error called when an item is invalid. This can occur
22827
23145
  * when accessing components on a removed item.
22828
23146
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "2.3.0-beta.1.21.110-preview.24",
3
+ "version": "2.3.0-beta.1.21.110-preview.26",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -14,7 +14,7 @@
14
14
  ],
15
15
  "peerDependencies": {
16
16
  "@minecraft/common": "^1.2.0",
17
- "@minecraft/vanilla-data": ">=1.20.70 || 1.21.110-preview.24"
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.21.110-preview.26"
18
18
  },
19
19
  "license": "MIT"
20
20
  }