@minecraft/server 2.9.0-beta.1.26.30-preview.26 → 2.9.0-beta.1.26.30-preview.28

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 +294 -48
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -47,6 +47,10 @@ export enum AimAssistTargetMode {
47
47
  * function Block.getComponent.
48
48
  */
49
49
  export enum BlockComponentTypes {
50
+ /**
51
+ * @beta
52
+ */
53
+ DynamicProperties = 'minecraft:dynamic_properties',
50
54
  FluidContainer = 'minecraft:fluid_container',
51
55
  /**
52
56
  * @remarks
@@ -1503,7 +1507,7 @@ export enum EntityHealCause {
1503
1507
  */
1504
1508
  SelfHeal = 'SelfHeal',
1505
1509
  /**
1506
- * @beta
1510
+ * @rc
1507
1511
  * @remarks
1508
1512
  * Healing caused when Totem of Undying is activated.
1509
1513
  *
@@ -3110,9 +3114,11 @@ export type BlockComponentReturnType<T extends string> = T extends keyof BlockCo
3110
3114
  : BlockCustomComponentInstance;
3111
3115
 
3112
3116
  export type BlockComponentTypeMap = {
3117
+ dynamic_properties: BlockDynamicPropertiesComponent;
3113
3118
  fluid_container: BlockFluidContainerComponent;
3114
3119
  inventory: BlockInventoryComponent;
3115
3120
  map_color: BlockMapColorComponent;
3121
+ 'minecraft:dynamic_properties': BlockDynamicPropertiesComponent;
3116
3122
  'minecraft:fluid_container': BlockFluidContainerComponent;
3117
3123
  'minecraft:inventory': BlockInventoryComponent;
3118
3124
  'minecraft:map_color': BlockMapColorComponent;
@@ -3907,14 +3913,12 @@ export class BiomeType {
3907
3913
  */
3908
3914
  readonly id: string;
3909
3915
  /**
3910
- * @rc
3911
3916
  * @remarks
3912
3917
  * Returns a list of the biome's tags.
3913
3918
  *
3914
3919
  */
3915
3920
  getTags(): string[];
3916
3921
  /**
3917
- * @rc
3918
3922
  * @remarks
3919
3923
  * Checks if the biome has all of the provided tags.
3920
3924
  *
@@ -3925,7 +3929,6 @@ export class BiomeType {
3925
3929
  }
3926
3930
 
3927
3931
  /**
3928
- * @rc
3929
3932
  * Supports a catalog of available biome types registered
3930
3933
  * within Minecraft.
3931
3934
  */
@@ -4792,7 +4795,7 @@ export class BlockComponentBlockBreakEvent extends BlockEvent {
4792
4795
  }
4793
4796
 
4794
4797
  /**
4795
- * @beta
4798
+ * @rc
4796
4799
  * Contains information regarding a specific block permutation
4797
4800
  * that was changed from a previous permutation.
4798
4801
  */
@@ -5174,6 +5177,108 @@ export class BlockCustomComponentInstance extends BlockComponent {
5174
5177
  readonly customComponentParameters: CustomComponentParameters;
5175
5178
  }
5176
5179
 
5180
+ /**
5181
+ * @beta
5182
+ * Represents the dynamic properties of a block in the world.
5183
+ * Only available with block entities. Up to 1KBytes of data
5184
+ * can be stored per block entity in their dynamic properties
5185
+ * storage.
5186
+ * @example rememberPlayerInteraction.ts
5187
+ * ```typescript
5188
+ * import { system } from '@minecraft/server-wrapper';
5189
+ *
5190
+ * system.beforeEvents.startup.subscribe(initEvent => {
5191
+ * initEvent.blockComponentRegistry.registerCustomComponent('scripting_demo_pack:block_entity_onPlayerInteract', {
5192
+ * onPlayerInteract: e => {
5193
+ * if (e.player === undefined) {
5194
+ * return;
5195
+ * }
5196
+ *
5197
+ * const dynamicProperties = e.block.getComponent('minecraft:dynamic_properties');
5198
+ * if (!dynamicProperties) {
5199
+ * return;
5200
+ * }
5201
+ *
5202
+ * const lastInteractorValue = dynamicProperties.get('last_interactor');
5203
+ * const lastVisitor = typeof lastInteractorValue === 'string' ? lastInteractorValue : 'unknown';
5204
+ * const lastTick = Number(dynamicProperties.get('last_interact_tick') ?? system.currentTick);
5205
+ * const ticksAgo = Math.max(0, system.currentTick - lastTick);
5206
+ *
5207
+ * if (lastVisitor === e.player.name) {
5208
+ * e.player.sendMessage("do you remember that player? I 'member, it was here " + String(ticksAgo) + ' ticks ago!');
5209
+ * } else {
5210
+ * e.player.sendMessage("oh, I don't remember that player");
5211
+ * }
5212
+ *
5213
+ * dynamicProperties.set('last_interactor', e.player.name);
5214
+ * dynamicProperties.set('last_interact_tick', system.currentTick);
5215
+ * },
5216
+ * });
5217
+ * });
5218
+ * ```
5219
+ */
5220
+ // @ts-ignore Class inheritance allowed for native defined classes
5221
+ export class BlockDynamicPropertiesComponent extends BlockComponent {
5222
+ private constructor();
5223
+ static readonly componentId = 'minecraft:dynamic_properties';
5224
+ /**
5225
+ * @remarks
5226
+ * Returns a DynamicProperty that was stored with the provided
5227
+ * key. Keys are unique to each content pack and cannot be used
5228
+ * to retrieve dynamic properties set from other content packs.
5229
+ * Returns undefined if the key was not found.
5230
+ *
5231
+ * @throws This function can throw errors.
5232
+ *
5233
+ * {@link Error}
5234
+ *
5235
+ * {@link InvalidBlockComponentError}
5236
+ *
5237
+ * {@link LocationInUnloadedChunkError}
5238
+ *
5239
+ * {@link LocationOutOfWorldBoundariesError}
5240
+ */
5241
+ get(key: string): boolean | number | string | Vector3 | undefined;
5242
+ /**
5243
+ * @remarks
5244
+ * Sets a dynamic property with the provided key and value.
5245
+ * Keys are unique to each content pack and cannot be used to
5246
+ * set dynamic properties for other content packs. Values can
5247
+ * be either a Number, a String or a Vector3. Setting a
5248
+ * property with an undefined value will remove it from the
5249
+ * storage.
5250
+ *
5251
+ * This function can't be called in restricted-execution mode.
5252
+ *
5253
+ * @throws This function can throw errors.
5254
+ *
5255
+ * {@link Error}
5256
+ *
5257
+ * {@link InvalidBlockComponentError}
5258
+ *
5259
+ * {@link LocationInUnloadedChunkError}
5260
+ *
5261
+ * {@link LocationOutOfWorldBoundariesError}
5262
+ */
5263
+ set(key: string, value?: boolean | number | string | Vector3): void;
5264
+ /**
5265
+ * @remarks
5266
+ * Returns the current size, in bytes, of the dynamic
5267
+ * properties storage for this block entity.
5268
+ *
5269
+ * @throws This function can throw errors.
5270
+ *
5271
+ * {@link Error}
5272
+ *
5273
+ * {@link InvalidBlockComponentError}
5274
+ *
5275
+ * {@link LocationInUnloadedChunkError}
5276
+ *
5277
+ * {@link LocationOutOfWorldBoundariesError}
5278
+ */
5279
+ totalByteCount(): number;
5280
+ }
5281
+
5177
5282
  /**
5178
5283
  * Contains information regarding an event that impacts a
5179
5284
  * specific block.
@@ -5767,7 +5872,7 @@ export class BlockPrecipitationInteractionsComponent extends BlockComponent {
5767
5872
  */
5768
5873
  accumulatesSnow(): boolean;
5769
5874
  /**
5770
- * @beta
5875
+ * @rc
5771
5876
  * @remarks
5772
5877
  * Returns `true` if this block can have snow within it, like a
5773
5878
  * flower submerged in snow. Returns `false` if this block
@@ -9646,7 +9751,6 @@ export class Entity {
9646
9751
  */
9647
9752
  addEffect(effectType: EffectType | string, duration: number, options?: EntityEffectOptions): Effect | undefined;
9648
9753
  /**
9649
- * @rc
9650
9754
  * @remarks
9651
9755
  * Adds an item to the entity's inventory.
9652
9756
  *
@@ -13517,6 +13621,54 @@ export class EntitySpawnAfterEventSignal {
13517
13621
  unsubscribe(callback: (arg0: EntitySpawnAfterEvent) => void): void;
13518
13622
  }
13519
13623
 
13624
+ /**
13625
+ * @beta
13626
+ * Contains data related to an entity beginning to sneak.
13627
+ */
13628
+ export class EntityStartSneakingAfterEvent {
13629
+ private constructor();
13630
+ /**
13631
+ * @remarks
13632
+ * Entity that has started sneaking.
13633
+ *
13634
+ */
13635
+ readonly entity: Entity;
13636
+ }
13637
+
13638
+ /**
13639
+ * @beta
13640
+ * Manages callbacks that are connected to when an entity
13641
+ * begins sneaking.
13642
+ */
13643
+ export class EntityStartSneakingAfterEventSignal {
13644
+ private constructor();
13645
+ /**
13646
+ * @remarks
13647
+ * Adds a callback that will be called when an entity begins
13648
+ * sneaking.
13649
+ *
13650
+ * This function can't be called in restricted-execution mode.
13651
+ *
13652
+ * This function can be called in early-execution mode.
13653
+ *
13654
+ */
13655
+ subscribe(
13656
+ callback: (arg0: EntityStartSneakingAfterEvent) => void,
13657
+ options?: EntitySneakingChangedEventOptions,
13658
+ ): (arg0: EntityStartSneakingAfterEvent) => void;
13659
+ /**
13660
+ * @remarks
13661
+ * Removes a callback from being called when an entity begins
13662
+ * sneaking.
13663
+ *
13664
+ * This function can't be called in restricted-execution mode.
13665
+ *
13666
+ * This function can be called in early-execution mode.
13667
+ *
13668
+ */
13669
+ unsubscribe(callback: (arg0: EntityStartSneakingAfterEvent) => void): void;
13670
+ }
13671
+
13520
13672
  /**
13521
13673
  * Defines the entity's ability to carry items. An entity with
13522
13674
  * a higher strength would have higher potential carry capacity
@@ -13736,7 +13888,7 @@ export class EntityUnderwaterMovementComponent extends EntityAttributeComponent
13736
13888
  }
13737
13889
 
13738
13890
  /**
13739
- * @beta
13891
+ * @rc
13740
13892
  * Contains information related to firing of a data driven
13741
13893
  * entity version upgrade.
13742
13894
  */
@@ -16819,6 +16971,10 @@ export class LootingEnchantFunction extends LootItemFunction {
16819
16971
  // @ts-ignore Class inheritance allowed for native defined classes
16820
16972
  export class LootItem extends LootPoolEntry {
16821
16973
  private constructor();
16974
+ /**
16975
+ * @beta
16976
+ */
16977
+ readonly conditions: LootItemCondition[];
16822
16978
  readonly functions: LootItemFunction[];
16823
16979
  /**
16824
16980
  * @remarks
@@ -17632,17 +17788,6 @@ export class Player extends Entity {
17632
17788
  * @throws This property can throw when used.
17633
17789
  */
17634
17790
  readonly onScreenDisplay: ScreenDisplay;
17635
- /**
17636
- * @beta
17637
- * @remarks
17638
- * The party information for this player, or undefined if the
17639
- * player is not in a party.
17640
- *
17641
- * @throws This property can throw when used.
17642
- *
17643
- * {@link InvalidEntityError}
17644
- */
17645
- readonly partyInfo?: PartyInfo;
17646
17791
  /**
17647
17792
  * @throws This property can throw when used.
17648
17793
  *
@@ -19604,6 +19749,76 @@ export class PlayerSpawnAfterEventSignal {
19604
19749
  unsubscribe(callback: (arg0: PlayerSpawnAfterEvent) => void): void;
19605
19750
  }
19606
19751
 
19752
+ /**
19753
+ * @beta
19754
+ * Contains information regarding an event after a player
19755
+ * starts breaking a block.
19756
+ */
19757
+ // @ts-ignore Class inheritance allowed for native defined classes
19758
+ export class PlayerStartBreakingBlockAfterEvent extends BlockEvent {
19759
+ private constructor();
19760
+ /**
19761
+ * @remarks
19762
+ * The permutation of the block that the player is starting to
19763
+ * break.
19764
+ *
19765
+ */
19766
+ readonly blockPermutation: BlockPermutation;
19767
+ /**
19768
+ * @remarks
19769
+ * The face of the block being broken.
19770
+ *
19771
+ */
19772
+ readonly face: Direction;
19773
+ /**
19774
+ * @remarks
19775
+ * The item stack that the player is using to break the block,
19776
+ * or undefined if empty hand.
19777
+ *
19778
+ */
19779
+ readonly heldItemStack?: ItemStack;
19780
+ /**
19781
+ * @remarks
19782
+ * Player that started breaking the block for this event.
19783
+ *
19784
+ */
19785
+ readonly player: Player;
19786
+ }
19787
+
19788
+ /**
19789
+ * @beta
19790
+ * Manages callbacks that are connected to when a player starts
19791
+ * breaking a block.
19792
+ */
19793
+ export class PlayerStartBreakingBlockAfterEventSignal {
19794
+ private constructor();
19795
+ /**
19796
+ * @remarks
19797
+ * Adds a callback that will be called when a player starts
19798
+ * breaking a block.
19799
+ *
19800
+ * This function can't be called in restricted-execution mode.
19801
+ *
19802
+ * This function can be called in early-execution mode.
19803
+ *
19804
+ */
19805
+ subscribe(
19806
+ callback: (arg0: PlayerStartBreakingBlockAfterEvent) => void,
19807
+ options?: PlayerBreakingBlockEventOptions,
19808
+ ): (arg0: PlayerStartBreakingBlockAfterEvent) => void;
19809
+ /**
19810
+ * @remarks
19811
+ * Removes a callback from being called when a player starts
19812
+ * breaking a block.
19813
+ *
19814
+ * This function can't be called in restricted-execution mode.
19815
+ *
19816
+ * This function can be called in early-execution mode.
19817
+ *
19818
+ */
19819
+ unsubscribe(callback: (arg0: PlayerStartBreakingBlockAfterEvent) => void): void;
19820
+ }
19821
+
19607
19822
  /**
19608
19823
  * Contains information regarding a player starting to swing
19609
19824
  * their arm.
@@ -19977,7 +20192,7 @@ export class PressurePlatePushAfterEventSignal {
19977
20192
  }
19978
20193
 
19979
20194
  /**
19980
- * @beta
20195
+ * @rc
19981
20196
  * The base class for a text primitive. Represents an object in
19982
20197
  * the world and its base properties.
19983
20198
  */
@@ -20081,7 +20296,7 @@ export class PrimitiveShape {
20081
20296
  }
20082
20297
 
20083
20298
  /**
20084
- * @beta
20299
+ * @rc
20085
20300
  * Primitive Shapes class used to allow adding and removing
20086
20301
  * text primitives to the world.
20087
20302
  */
@@ -22211,7 +22426,7 @@ export class TargetBlockHitAfterEventSignal {
22211
22426
  }
22212
22427
 
22213
22428
  /**
22214
- * @beta
22429
+ * @rc
22215
22430
  * A primitive shape class that represents a text label in the
22216
22431
  * world with a background.
22217
22432
  */
@@ -22853,7 +23068,7 @@ export class World {
22853
23068
  readonly gameRules: GameRules;
22854
23069
  readonly isHardcore: boolean;
22855
23070
  /**
22856
- * @beta
23071
+ * @rc
22857
23072
  * @remarks
22858
23073
  * Manager for adding and removing primitive text objects in
22859
23074
  * the world.
@@ -23094,7 +23309,7 @@ export class World {
23094
23309
  */
23095
23310
  getMoonPhase(): MoonPhase;
23096
23311
  /**
23097
- * @beta
23312
+ * @rc
23098
23313
  * @remarks
23099
23314
  * Returns a map of pack setting name and value pairs.
23100
23315
  *
@@ -23528,6 +23743,15 @@ export class WorldAfterEvents {
23528
23743
  *
23529
23744
  */
23530
23745
  readonly entitySpawn: EntitySpawnAfterEventSignal;
23746
+ /**
23747
+ * @beta
23748
+ * @remarks
23749
+ * This event fires when an entity starts sneaking.
23750
+ *
23751
+ * This property can be read in early-execution mode.
23752
+ *
23753
+ */
23754
+ readonly entityStartSneaking: EntityStartSneakingAfterEventSignal;
23531
23755
  /**
23532
23756
  * @beta
23533
23757
  * @remarks
@@ -23773,6 +23997,15 @@ export class WorldAfterEvents {
23773
23997
  *
23774
23998
  */
23775
23999
  readonly playerSpawn: PlayerSpawnAfterEventSignal;
24000
+ /**
24001
+ * @beta
24002
+ * @remarks
24003
+ * This event fires when a player starts breaking a block.
24004
+ *
24005
+ * This property can be read in early-execution mode.
24006
+ *
24007
+ */
24008
+ readonly playerStartBreakingBlock: PlayerStartBreakingBlockAfterEventSignal;
23776
24009
  /**
23777
24010
  * @remarks
23778
24011
  * This property can be read in early-execution mode.
@@ -24162,7 +24395,7 @@ export interface BlockCustomComponent {
24162
24395
  */
24163
24396
  beforeOnPlayerPlace?: (arg0: BlockComponentPlayerPlaceBeforeEvent, arg1: CustomComponentParameters) => void;
24164
24397
  /**
24165
- * @beta
24398
+ * @rc
24166
24399
  */
24167
24400
  onBlockStateChange?: (arg0: BlockComponentBlockStateChangeEvent, arg1: CustomComponentParameters) => void;
24168
24401
  /**
@@ -25596,6 +25829,15 @@ export interface EntityRaycastOptions extends EntityFilter {
25596
25829
  maxDistance?: number;
25597
25830
  }
25598
25831
 
25832
+ /**
25833
+ * @beta
25834
+ * Options used to filter entity start sneaking and stop
25835
+ * sneaking events.
25836
+ */
25837
+ export interface EntitySneakingChangedEventOptions {
25838
+ entityFilter?: EntityFilter;
25839
+ }
25840
+
25599
25841
  /**
25600
25842
  * @beta
25601
25843
  * Controls when a waypoint is visible based on the state of
@@ -26033,27 +26275,6 @@ export interface NotEqualsComparison {
26033
26275
  notEquals: boolean | number | string;
26034
26276
  }
26035
26277
 
26036
- /**
26037
- * @beta
26038
- * Contains information about a player's party membership. This
26039
- * object is a snapshot of the player's party state at the time
26040
- * it was retrieved and is not kept up to date.
26041
- */
26042
- export interface PartyInfo {
26043
- /**
26044
- * @remarks
26045
- * Whether this player is the leader of their party.
26046
- *
26047
- */
26048
- isLeader: boolean;
26049
- /**
26050
- * @remarks
26051
- * The unique identifier of the party this player belongs to.
26052
- *
26053
- */
26054
- partyId: string;
26055
- }
26056
-
26057
26278
  /**
26058
26279
  * Contains additional options for how an animation is played.
26059
26280
  */
@@ -26123,6 +26344,32 @@ export interface PlayerAimAssistSettings {
26123
26344
  viewAngle?: Vector2;
26124
26345
  }
26125
26346
 
26347
+ /**
26348
+ * @beta
26349
+ * An interface that is passed into {@link
26350
+ * PlayerStartBreakingBlockAfterEventSignal.subscribe} that
26351
+ * filters out which events are passed to the provided
26352
+ * callback.
26353
+ */
26354
+ export interface PlayerBreakingBlockEventOptions {
26355
+ /**
26356
+ * @remarks
26357
+ * The {@link BlockFilter} that the callback should be called
26358
+ * for. If undefined, the callback will be called for all
26359
+ * blocks.
26360
+ *
26361
+ */
26362
+ blockFilter?: BlockFilter;
26363
+ /**
26364
+ * @remarks
26365
+ * The {@link EntityFilter} that the callback should be called
26366
+ * for. If undefined, the callback will be called for all
26367
+ * players.
26368
+ *
26369
+ */
26370
+ playerFilter?: EntityFilter;
26371
+ }
26372
+
26126
26373
  /**
26127
26374
  * Additional options for how a sound plays for a player.
26128
26375
  */
@@ -27182,7 +27429,6 @@ export class InvalidContainerSlotError extends Error {
27182
27429
  }
27183
27430
 
27184
27431
  /**
27185
- * @rc
27186
27432
  * This error can occur when accessing components on an entity
27187
27433
  * that doesn't have them.
27188
27434
  */
@@ -27372,7 +27618,7 @@ export class PlaceJigsawError extends Error {
27372
27618
  }
27373
27619
 
27374
27620
  /**
27375
- * @beta
27621
+ * @rc
27376
27622
  */
27377
27623
  // @ts-ignore Class inheritance allowed for native defined classes
27378
27624
  export class PrimitiveShapeError extends Error {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "2.9.0-beta.1.26.30-preview.26",
3
+ "version": "2.9.0-beta.1.26.30-preview.28",
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.26.30-preview.26"
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.26.30-preview.28"
18
18
  },
19
19
  "license": "MIT"
20
20
  }