@minecraft/server 1.7.0-beta.1.20.40-preview.24 → 1.8.0-beta.1.20.50-preview.20

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 +330 -12
  2. package/package.json +2 -2
package/index.d.ts CHANGED
@@ -16,12 +16,26 @@
16
16
  * ```json
17
17
  * {
18
18
  * "module_name": "@minecraft/server",
19
- * "version": "1.7.0-internal.1.20.40-preview.24"
19
+ * "version": "1.8.0-internal.1.20.50-preview.20"
20
20
  * }
21
21
  * ```
22
22
  *
23
23
  */
24
24
  import * as minecraftcommon from '@minecraft/common';
25
+ /**
26
+ * @beta
27
+ */
28
+ export enum BlockComponentTypes {
29
+ Inventory = 'minecraft:inventory',
30
+ LavaContainer = 'minecraft:lavaContainer',
31
+ Piston = 'minecraft:piston',
32
+ PotionContainer = 'minecraft:potionContainer',
33
+ RecordPlayer = 'minecraft:recordPlayer',
34
+ Sign = 'minecraft:sign',
35
+ SnowContainer = 'minecraft:snowContainer',
36
+ WaterContainer = 'minecraft:waterContainer',
37
+ }
38
+
25
39
  /**
26
40
  * @beta
27
41
  * Description of the resulting intersection test on two
@@ -348,6 +362,73 @@ export enum EasingType {
348
362
  Spring = 'Spring',
349
363
  }
350
364
 
365
+ /**
366
+ * @beta
367
+ */
368
+ export enum EntityComponentTypes {
369
+ AddRider = 'minecraft:addrider',
370
+ Ageable = 'minecraft:ageable',
371
+ Breathable = 'minecraft:breathable',
372
+ CanClimb = 'minecraft:can_climb',
373
+ CanFly = 'minecraft:can_fly',
374
+ CanPowerJump = 'minecraft:can_power_jump',
375
+ Color = 'minecraft:color',
376
+ Equippable = 'minecraft:equippable',
377
+ FireImmune = 'minecraft:fire_immune',
378
+ FloatsInLiquid = 'minecraft:floats_in_liquid',
379
+ FlyingSpeed = 'minecraft:flying_speed',
380
+ FrictionModifier = 'minecraft:friction_modifier',
381
+ GroundOffset = 'minecraft:ground_offset',
382
+ Healable = 'minecraft:healable',
383
+ Health = 'minecraft:health',
384
+ Inventory = 'minecraft:inventory',
385
+ IsBaby = 'minecraft:is_baby',
386
+ IsCharged = 'minecraft:is_charged',
387
+ IsChested = 'minecraft:is_chested',
388
+ IsDyeable = 'minecraft:is_dyeable',
389
+ IsHiddenWhenInvisible = 'minecraft:is_hidden_when_invisible',
390
+ IsIgnited = 'minecraft:is_ignited',
391
+ IsIllagerCaptain = 'minecraft:is_illager_captain',
392
+ IsSaddled = 'minecraft:is_saddled',
393
+ IsShaking = 'minecraft:is_shaking',
394
+ IsSheared = 'minecraft:is_sheared',
395
+ IsStackable = 'minecraft:is_stackable',
396
+ IsStunned = 'minecraft:is_stunned',
397
+ IsTamed = 'minecraft:is_tamed',
398
+ Item = 'minecraft:item',
399
+ LavaMovement = 'minecraft:lava_movement',
400
+ Leashable = 'minecraft:leashable',
401
+ MarkVariant = 'minecraft:mark_variant',
402
+ MountTaming = 'minecraft:tamemount',
403
+ Movement = 'minecraft:movement',
404
+ MovementAmphibious = 'minecraft:movement.amphibious',
405
+ MovementBasic = 'minecraft:movement.basic',
406
+ MovementFly = 'minecraft:movement.fly',
407
+ MovementGeneric = 'minecraft:movement.generic',
408
+ MovementGlide = 'minecraft:movement.glide',
409
+ MovementHover = 'minecraft:movement.hover',
410
+ MovementJump = 'minecraft:movement.jump',
411
+ MovementSkip = 'minecraft:movement.skip',
412
+ MovementSway = 'minecraft:movement.sway',
413
+ NavigationClimb = 'minecraft:navigation.climb',
414
+ NavigationFloat = 'minecraft:navigation.float',
415
+ NavigationFly = 'minecraft:navigation.fly',
416
+ NavigationGeneric = 'minecraft:navigation.generic',
417
+ NavigationHover = 'minecraft:navigation.hover',
418
+ NavigationWalk = 'minecraft:navigation.walk',
419
+ OnFire = 'minecraft:onfire',
420
+ PushThrough = 'minecraft:push_through',
421
+ Rideable = 'minecraft:rideable',
422
+ Riding = 'minecraft:riding',
423
+ Scale = 'minecraft:scale',
424
+ SkinId = 'minecraft:skin_id',
425
+ Strength = 'minecraft:strength',
426
+ Tameable = 'minecraft:tameable',
427
+ UnderwaterMovement = 'minecraft:underwater_movement',
428
+ Variant = 'minecraft:variant',
429
+ WantsJockey = 'minecraft:wants_jockey',
430
+ }
431
+
351
432
  /**
352
433
  * @beta
353
434
  * Describes the source of damage from an Entity.
@@ -799,6 +880,16 @@ export enum GameMode {
799
880
  survival = 'survival',
800
881
  }
801
882
 
883
+ /**
884
+ * @beta
885
+ */
886
+ export enum ItemComponentTypes {
887
+ Cooldown = 'minecraft:cooldown',
888
+ Durability = 'minecraft:durability',
889
+ Enchants = 'minecraft:enchantments',
890
+ Food = 'minecraft:food',
891
+ }
892
+
802
893
  /**
803
894
  * @beta
804
895
  * Describes how an an item can be moved within a container.
@@ -1081,6 +1172,170 @@ export enum WeatherType {
1081
1172
  Thunder = 'Thunder',
1082
1173
  }
1083
1174
 
1175
+ /**
1176
+ * @beta
1177
+ */
1178
+ export type BlockComponentTypeMap = {
1179
+ inventory: BlockInventoryComponent;
1180
+ lavaContainer: BlockLavaContainerComponent;
1181
+ 'minecraft:inventory': BlockInventoryComponent;
1182
+ 'minecraft:lavaContainer': BlockLavaContainerComponent;
1183
+ 'minecraft:piston': BlockPistonComponent;
1184
+ 'minecraft:potionContainer': BlockPotionContainerComponent;
1185
+ 'minecraft:recordPlayer': BlockRecordPlayerComponent;
1186
+ 'minecraft:sign': BlockSignComponent;
1187
+ 'minecraft:snowContainer': BlockSnowContainerComponent;
1188
+ 'minecraft:waterContainer': BlockWaterContainerComponent;
1189
+ piston: BlockPistonComponent;
1190
+ potionContainer: BlockPotionContainerComponent;
1191
+ recordPlayer: BlockRecordPlayerComponent;
1192
+ sign: BlockSignComponent;
1193
+ snowContainer: BlockSnowContainerComponent;
1194
+ waterContainer: BlockWaterContainerComponent;
1195
+ };
1196
+
1197
+ /**
1198
+ * @beta
1199
+ */
1200
+ export type EntityComponentTypeMap = {
1201
+ addrider: EntityAddRiderComponent;
1202
+ ageable: EntityAgeableComponent;
1203
+ breathable: EntityBreathableComponent;
1204
+ can_climb: EntityCanClimbComponent;
1205
+ can_fly: EntityCanFlyComponent;
1206
+ can_power_jump: EntityCanPowerJumpComponent;
1207
+ color: EntityColorComponent;
1208
+ equippable: EntityEquippableComponent;
1209
+ fire_immune: EntityFireImmuneComponent;
1210
+ floats_in_liquid: EntityFloatsInLiquidComponent;
1211
+ flying_speed: EntityFlyingSpeedComponent;
1212
+ friction_modifier: EntityFrictionModifierComponent;
1213
+ ground_offset: EntityGroundOffsetComponent;
1214
+ healable: EntityHealableComponent;
1215
+ health: EntityHealthComponent;
1216
+ inventory: EntityInventoryComponent;
1217
+ is_baby: EntityIsBabyComponent;
1218
+ is_charged: EntityIsChargedComponent;
1219
+ is_chested: EntityIsChestedComponent;
1220
+ is_dyeable: EntityIsDyeableComponent;
1221
+ is_hidden_when_invisible: EntityIsHiddenWhenInvisibleComponent;
1222
+ is_ignited: EntityIsIgnitedComponent;
1223
+ is_illager_captain: EntityIsIllagerCaptainComponent;
1224
+ is_saddled: EntityIsSaddledComponent;
1225
+ is_shaking: EntityIsShakingComponent;
1226
+ is_sheared: EntityIsShearedComponent;
1227
+ is_stackable: EntityIsStackableComponent;
1228
+ is_stunned: EntityIsStunnedComponent;
1229
+ is_tamed: EntityIsTamedComponent;
1230
+ item: EntityItemComponent;
1231
+ lava_movement: EntityLavaMovementComponent;
1232
+ leashable: EntityLeashableComponent;
1233
+ mark_variant: EntityMarkVariantComponent;
1234
+ 'minecraft:addrider': EntityAddRiderComponent;
1235
+ 'minecraft:ageable': EntityAgeableComponent;
1236
+ 'minecraft:breathable': EntityBreathableComponent;
1237
+ 'minecraft:can_climb': EntityCanClimbComponent;
1238
+ 'minecraft:can_fly': EntityCanFlyComponent;
1239
+ 'minecraft:can_power_jump': EntityCanPowerJumpComponent;
1240
+ 'minecraft:color': EntityColorComponent;
1241
+ 'minecraft:equippable': EntityEquippableComponent;
1242
+ 'minecraft:fire_immune': EntityFireImmuneComponent;
1243
+ 'minecraft:floats_in_liquid': EntityFloatsInLiquidComponent;
1244
+ 'minecraft:flying_speed': EntityFlyingSpeedComponent;
1245
+ 'minecraft:friction_modifier': EntityFrictionModifierComponent;
1246
+ 'minecraft:ground_offset': EntityGroundOffsetComponent;
1247
+ 'minecraft:healable': EntityHealableComponent;
1248
+ 'minecraft:health': EntityHealthComponent;
1249
+ 'minecraft:inventory': EntityInventoryComponent;
1250
+ 'minecraft:is_baby': EntityIsBabyComponent;
1251
+ 'minecraft:is_charged': EntityIsChargedComponent;
1252
+ 'minecraft:is_chested': EntityIsChestedComponent;
1253
+ 'minecraft:is_dyeable': EntityIsDyeableComponent;
1254
+ 'minecraft:is_hidden_when_invisible': EntityIsHiddenWhenInvisibleComponent;
1255
+ 'minecraft:is_ignited': EntityIsIgnitedComponent;
1256
+ 'minecraft:is_illager_captain': EntityIsIllagerCaptainComponent;
1257
+ 'minecraft:is_saddled': EntityIsSaddledComponent;
1258
+ 'minecraft:is_shaking': EntityIsShakingComponent;
1259
+ 'minecraft:is_sheared': EntityIsShearedComponent;
1260
+ 'minecraft:is_stackable': EntityIsStackableComponent;
1261
+ 'minecraft:is_stunned': EntityIsStunnedComponent;
1262
+ 'minecraft:is_tamed': EntityIsTamedComponent;
1263
+ 'minecraft:item': EntityItemComponent;
1264
+ 'minecraft:lava_movement': EntityLavaMovementComponent;
1265
+ 'minecraft:leashable': EntityLeashableComponent;
1266
+ 'minecraft:mark_variant': EntityMarkVariantComponent;
1267
+ 'minecraft:movement': EntityMovementComponent;
1268
+ 'minecraft:movement.amphibious': EntityMovementAmphibiousComponent;
1269
+ 'minecraft:movement.basic': EntityMovementBasicComponent;
1270
+ 'minecraft:movement.fly': EntityMovementFlyComponent;
1271
+ 'minecraft:movement.generic': EntityMovementGenericComponent;
1272
+ 'minecraft:movement.glide': EntityMovementGlideComponent;
1273
+ 'minecraft:movement.hover': EntityMovementHoverComponent;
1274
+ 'minecraft:movement.jump': EntityMovementJumpComponent;
1275
+ 'minecraft:movement.skip': EntityMovementSkipComponent;
1276
+ 'minecraft:movement.sway': EntityMovementSwayComponent;
1277
+ 'minecraft:navigation.climb': EntityNavigationClimbComponent;
1278
+ 'minecraft:navigation.float': EntityNavigationFloatComponent;
1279
+ 'minecraft:navigation.fly': EntityNavigationFlyComponent;
1280
+ 'minecraft:navigation.generic': EntityNavigationGenericComponent;
1281
+ 'minecraft:navigation.hover': EntityNavigationHoverComponent;
1282
+ 'minecraft:navigation.walk': EntityNavigationWalkComponent;
1283
+ 'minecraft:onfire': EntityOnFireComponent;
1284
+ 'minecraft:push_through': EntityPushThroughComponent;
1285
+ 'minecraft:rideable': EntityRideableComponent;
1286
+ 'minecraft:riding': EntityRidingComponent;
1287
+ 'minecraft:scale': EntityScaleComponent;
1288
+ 'minecraft:skin_id': EntitySkinIdComponent;
1289
+ 'minecraft:strength': EntityStrengthComponent;
1290
+ 'minecraft:tameable': EntityTameableComponent;
1291
+ 'minecraft:tamemount': EntityMountTamingComponent;
1292
+ 'minecraft:underwater_movement': EntityUnderwaterMovementComponent;
1293
+ 'minecraft:variant': EntityVariantComponent;
1294
+ 'minecraft:wants_jockey': EntityWantsJockeyComponent;
1295
+ movement: EntityMovementComponent;
1296
+ 'movement.amphibious': EntityMovementAmphibiousComponent;
1297
+ 'movement.basic': EntityMovementBasicComponent;
1298
+ 'movement.fly': EntityMovementFlyComponent;
1299
+ 'movement.generic': EntityMovementGenericComponent;
1300
+ 'movement.glide': EntityMovementGlideComponent;
1301
+ 'movement.hover': EntityMovementHoverComponent;
1302
+ 'movement.jump': EntityMovementJumpComponent;
1303
+ 'movement.skip': EntityMovementSkipComponent;
1304
+ 'movement.sway': EntityMovementSwayComponent;
1305
+ 'navigation.climb': EntityNavigationClimbComponent;
1306
+ 'navigation.float': EntityNavigationFloatComponent;
1307
+ 'navigation.fly': EntityNavigationFlyComponent;
1308
+ 'navigation.generic': EntityNavigationGenericComponent;
1309
+ 'navigation.hover': EntityNavigationHoverComponent;
1310
+ 'navigation.walk': EntityNavigationWalkComponent;
1311
+ onfire: EntityOnFireComponent;
1312
+ push_through: EntityPushThroughComponent;
1313
+ rideable: EntityRideableComponent;
1314
+ riding: EntityRidingComponent;
1315
+ scale: EntityScaleComponent;
1316
+ skin_id: EntitySkinIdComponent;
1317
+ strength: EntityStrengthComponent;
1318
+ tameable: EntityTameableComponent;
1319
+ tamemount: EntityMountTamingComponent;
1320
+ underwater_movement: EntityUnderwaterMovementComponent;
1321
+ variant: EntityVariantComponent;
1322
+ wants_jockey: EntityWantsJockeyComponent;
1323
+ };
1324
+
1325
+ /**
1326
+ * @beta
1327
+ */
1328
+ export type ItemComponentTypeMap = {
1329
+ cooldown: ItemCooldownComponent;
1330
+ durability: ItemDurabilityComponent;
1331
+ enchantments: ItemEnchantsComponent;
1332
+ food: ItemFoodComponent;
1333
+ 'minecraft:cooldown': ItemCooldownComponent;
1334
+ 'minecraft:durability': ItemDurabilityComponent;
1335
+ 'minecraft:enchantments': ItemEnchantsComponent;
1336
+ 'minecraft:food': ItemFoodComponent;
1337
+ };
1338
+
1084
1339
  /**
1085
1340
  * @beta
1086
1341
  * Represents a block in a dimension. A block represents a
@@ -1300,6 +1555,11 @@ export class Block {
1300
1555
  * for a block - for example, an inventory component of a chest
1301
1556
  * block.
1302
1557
  *
1558
+ * @param componentId
1559
+ * The identifier of the component (e.g.,
1560
+ * 'minecraft:inventory'). If no namespace prefix is specified,
1561
+ * 'minecraft:' is assumed. Available component IDs can be
1562
+ * found as part of the {@link BlockComponentTypes} enum.
1303
1563
  * @returns
1304
1564
  * Returns the component if it exists on the block, otherwise
1305
1565
  * undefined.
@@ -1309,7 +1569,7 @@ export class Block {
1309
1569
  *
1310
1570
  * {@link LocationOutOfWorldBoundariesError}
1311
1571
  */
1312
- getComponent(componentName: string): BlockComponent | undefined;
1572
+ getComponent<T extends keyof BlockComponentTypeMap>(componentId: T): BlockComponentTypeMap[T] | undefined;
1313
1573
  /**
1314
1574
  * @beta
1315
1575
  * @remarks
@@ -4207,12 +4467,6 @@ export class EffectAddAfterEvent {
4207
4467
  *
4208
4468
  */
4209
4469
  effect: Effect;
4210
- /**
4211
- * @remarks
4212
- * This property can't be edited in read-only mode.
4213
- *
4214
- */
4215
- effectState: number;
4216
4470
  /**
4217
4471
  * @remarks
4218
4472
  * Entity that the effect is being added to.
@@ -4254,6 +4508,62 @@ export class EffectAddAfterEventSignal {
4254
4508
  unsubscribe(callback: (arg: EffectAddAfterEvent) => void): void;
4255
4509
  }
4256
4510
 
4511
+ /**
4512
+ * @beta
4513
+ * Contains information related to changes to an effect - like
4514
+ * poison - being added to an entity.
4515
+ */
4516
+ export class EffectAddBeforeEvent {
4517
+ private constructor();
4518
+ /**
4519
+ * @remarks
4520
+ * When set to true will cancel the event.
4521
+ *
4522
+ */
4523
+ cancel: boolean;
4524
+ duration: number;
4525
+ /**
4526
+ * @remarks
4527
+ * The type of the effect that is being added.
4528
+ *
4529
+ */
4530
+ readonly effectType: string;
4531
+ /**
4532
+ * @remarks
4533
+ * Entity that the effect is being added to.
4534
+ *
4535
+ */
4536
+ readonly entity: Entity;
4537
+ }
4538
+
4539
+ /**
4540
+ * @beta
4541
+ * Manages callbacks that are connected to when an effect is
4542
+ * added to an entity.
4543
+ */
4544
+ export class EffectAddBeforeEventSignal {
4545
+ private constructor();
4546
+ /**
4547
+ * @remarks
4548
+ * Adds a callback that will be called when an effect is added
4549
+ * to an entity.
4550
+ *
4551
+ * This function can't be called in read-only mode.
4552
+ *
4553
+ */
4554
+ subscribe(callback: (arg: EffectAddBeforeEvent) => void): (arg: EffectAddBeforeEvent) => void;
4555
+ /**
4556
+ * @remarks
4557
+ * Removes a callback from being called when an effect is added
4558
+ * to an entity.
4559
+ *
4560
+ * This function can't be called in read-only mode.
4561
+ *
4562
+ * @throws This function can throw errors.
4563
+ */
4564
+ unsubscribe(callback: (arg: EffectAddBeforeEvent) => void): void;
4565
+ }
4566
+
4257
4567
  /**
4258
4568
  * @beta
4259
4569
  * Represents a type of effect - like poison - that can be
@@ -4922,12 +5232,12 @@ export class Entity {
4922
5232
  * The identifier of the component (e.g., 'minecraft:health').
4923
5233
  * If no namespace prefix is specified, 'minecraft:' is
4924
5234
  * assumed. Available component IDs can be found as part of the
4925
- * {@link @minecraft/server.EntityComponentTypes} enum.
5235
+ * {@link EntityComponentTypes} enum.
4926
5236
  * @returns
4927
5237
  * Returns the component if it exists on the entity, otherwise
4928
5238
  * undefined.
4929
5239
  */
4930
- getComponent(componentId: string): EntityComponent | undefined;
5240
+ getComponent<T extends keyof EntityComponentTypeMap>(componentId: T): EntityComponentTypeMap[T] | undefined;
4931
5241
  /**
4932
5242
  * @beta
4933
5243
  * @remarks
@@ -8430,7 +8740,7 @@ export class ItemStack {
8430
8740
  * The identifier of the component (e.g., 'minecraft:food'). If
8431
8741
  * no namespace prefix is specified, 'minecraft:' is assumed.
8432
8742
  * Available component IDs can be found as part of the {@link
8433
- * @minecraft/server.ItemComponentTypes} enum.
8743
+ * ItemComponentTypes} enum.
8434
8744
  * @returns
8435
8745
  * Returns the component if it exists on the item stack,
8436
8746
  * otherwise undefined.
@@ -8442,7 +8752,7 @@ export class ItemStack {
8442
8752
  * const maxDurability = durability.maxDurability;
8443
8753
  * ```
8444
8754
  */
8445
- getComponent(componentId: string): ItemComponent | undefined;
8755
+ getComponent<T extends keyof ItemComponentTypeMap>(componentId: T): ItemComponentTypeMap[T] | undefined;
8446
8756
  /**
8447
8757
  * @remarks
8448
8758
  * Returns all components that are both present on this item
@@ -12654,6 +12964,14 @@ export class WorldBeforeEvents {
12654
12964
  *
12655
12965
  */
12656
12966
  readonly dataDrivenEntityTriggerEvent: DataDrivenEntityTriggerBeforeEventSignal;
12967
+ /**
12968
+ * @beta
12969
+ * @remarks
12970
+ * This event is triggered after an event has been added to an
12971
+ * entity.
12972
+ *
12973
+ */
12974
+ readonly effectAdd: EffectAddBeforeEventSignal;
12657
12975
  /**
12658
12976
  * @beta
12659
12977
  * @remarks
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@minecraft/server",
3
- "version": "1.7.0-beta.1.20.40-preview.24",
3
+ "version": "1.8.0-beta.1.20.50-preview.20",
4
4
  "description": "",
5
5
  "contributors": [
6
6
  {
@@ -13,7 +13,7 @@
13
13
  }
14
14
  ],
15
15
  "dependencies": {
16
- "@minecraft/common": "^1.0.0-rc.1.20.40-preview.24"
16
+ "@minecraft/common": "^1.0.0-rc.1.20.50-preview.20"
17
17
  },
18
18
  "license": "MIT"
19
19
  }