@minecraft/server 2.9.0-beta.1.26.30-preview.27 → 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 +227 -42
  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;
@@ -4789,7 +4795,7 @@ export class BlockComponentBlockBreakEvent extends BlockEvent {
4789
4795
  }
4790
4796
 
4791
4797
  /**
4792
- * @beta
4798
+ * @rc
4793
4799
  * Contains information regarding a specific block permutation
4794
4800
  * that was changed from a previous permutation.
4795
4801
  */
@@ -5171,6 +5177,108 @@ export class BlockCustomComponentInstance extends BlockComponent {
5171
5177
  readonly customComponentParameters: CustomComponentParameters;
5172
5178
  }
5173
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
+
5174
5282
  /**
5175
5283
  * Contains information regarding an event that impacts a
5176
5284
  * specific block.
@@ -13780,7 +13888,7 @@ export class EntityUnderwaterMovementComponent extends EntityAttributeComponent
13780
13888
  }
13781
13889
 
13782
13890
  /**
13783
- * @beta
13891
+ * @rc
13784
13892
  * Contains information related to firing of a data driven
13785
13893
  * entity version upgrade.
13786
13894
  */
@@ -16863,6 +16971,10 @@ export class LootingEnchantFunction extends LootItemFunction {
16863
16971
  // @ts-ignore Class inheritance allowed for native defined classes
16864
16972
  export class LootItem extends LootPoolEntry {
16865
16973
  private constructor();
16974
+ /**
16975
+ * @beta
16976
+ */
16977
+ readonly conditions: LootItemCondition[];
16866
16978
  readonly functions: LootItemFunction[];
16867
16979
  /**
16868
16980
  * @remarks
@@ -17676,17 +17788,6 @@ export class Player extends Entity {
17676
17788
  * @throws This property can throw when used.
17677
17789
  */
17678
17790
  readonly onScreenDisplay: ScreenDisplay;
17679
- /**
17680
- * @beta
17681
- * @remarks
17682
- * The party information for this player, or undefined if the
17683
- * player is not in a party.
17684
- *
17685
- * @throws This property can throw when used.
17686
- *
17687
- * {@link InvalidEntityError}
17688
- */
17689
- readonly partyInfo?: PartyInfo;
17690
17791
  /**
17691
17792
  * @throws This property can throw when used.
17692
17793
  *
@@ -19648,6 +19749,76 @@ export class PlayerSpawnAfterEventSignal {
19648
19749
  unsubscribe(callback: (arg0: PlayerSpawnAfterEvent) => void): void;
19649
19750
  }
19650
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
+
19651
19822
  /**
19652
19823
  * Contains information regarding a player starting to swing
19653
19824
  * their arm.
@@ -20021,7 +20192,7 @@ export class PressurePlatePushAfterEventSignal {
20021
20192
  }
20022
20193
 
20023
20194
  /**
20024
- * @beta
20195
+ * @rc
20025
20196
  * The base class for a text primitive. Represents an object in
20026
20197
  * the world and its base properties.
20027
20198
  */
@@ -20125,7 +20296,7 @@ export class PrimitiveShape {
20125
20296
  }
20126
20297
 
20127
20298
  /**
20128
- * @beta
20299
+ * @rc
20129
20300
  * Primitive Shapes class used to allow adding and removing
20130
20301
  * text primitives to the world.
20131
20302
  */
@@ -22255,7 +22426,7 @@ export class TargetBlockHitAfterEventSignal {
22255
22426
  }
22256
22427
 
22257
22428
  /**
22258
- * @beta
22429
+ * @rc
22259
22430
  * A primitive shape class that represents a text label in the
22260
22431
  * world with a background.
22261
22432
  */
@@ -22897,7 +23068,7 @@ export class World {
22897
23068
  readonly gameRules: GameRules;
22898
23069
  readonly isHardcore: boolean;
22899
23070
  /**
22900
- * @beta
23071
+ * @rc
22901
23072
  * @remarks
22902
23073
  * Manager for adding and removing primitive text objects in
22903
23074
  * the world.
@@ -23138,7 +23309,7 @@ export class World {
23138
23309
  */
23139
23310
  getMoonPhase(): MoonPhase;
23140
23311
  /**
23141
- * @beta
23312
+ * @rc
23142
23313
  * @remarks
23143
23314
  * Returns a map of pack setting name and value pairs.
23144
23315
  *
@@ -23826,6 +23997,15 @@ export class WorldAfterEvents {
23826
23997
  *
23827
23998
  */
23828
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;
23829
24009
  /**
23830
24010
  * @remarks
23831
24011
  * This property can be read in early-execution mode.
@@ -24215,7 +24395,7 @@ export interface BlockCustomComponent {
24215
24395
  */
24216
24396
  beforeOnPlayerPlace?: (arg0: BlockComponentPlayerPlaceBeforeEvent, arg1: CustomComponentParameters) => void;
24217
24397
  /**
24218
- * @beta
24398
+ * @rc
24219
24399
  */
24220
24400
  onBlockStateChange?: (arg0: BlockComponentBlockStateChangeEvent, arg1: CustomComponentParameters) => void;
24221
24401
  /**
@@ -26095,27 +26275,6 @@ export interface NotEqualsComparison {
26095
26275
  notEquals: boolean | number | string;
26096
26276
  }
26097
26277
 
26098
- /**
26099
- * @beta
26100
- * Contains information about a player's party membership. This
26101
- * object is a snapshot of the player's party state at the time
26102
- * it was retrieved and is not kept up to date.
26103
- */
26104
- export interface PartyInfo {
26105
- /**
26106
- * @remarks
26107
- * Whether this player is the leader of their party.
26108
- *
26109
- */
26110
- isLeader: boolean;
26111
- /**
26112
- * @remarks
26113
- * The unique identifier of the party this player belongs to.
26114
- *
26115
- */
26116
- partyId: string;
26117
- }
26118
-
26119
26278
  /**
26120
26279
  * Contains additional options for how an animation is played.
26121
26280
  */
@@ -26185,6 +26344,32 @@ export interface PlayerAimAssistSettings {
26185
26344
  viewAngle?: Vector2;
26186
26345
  }
26187
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
+
26188
26373
  /**
26189
26374
  * Additional options for how a sound plays for a player.
26190
26375
  */
@@ -27433,7 +27618,7 @@ export class PlaceJigsawError extends Error {
27433
27618
  }
27434
27619
 
27435
27620
  /**
27436
- * @beta
27621
+ * @rc
27437
27622
  */
27438
27623
  // @ts-ignore Class inheritance allowed for native defined classes
27439
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.27",
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.27"
17
+ "@minecraft/vanilla-data": ">=1.20.70 || 1.26.30-preview.28"
18
18
  },
19
19
  "license": "MIT"
20
20
  }