bloxd-types 0.1.0

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.
@@ -0,0 +1,4003 @@
1
+ export interface GameApi {
2
+ /** The ID of the player running the code.
3
+ *
4
+ * Lobby code usually has nobody running it, so this is null.
5
+ */
6
+ myId: string | null
7
+ /** The position of the code block or press to code board */
8
+ thisPos: [number, number, number]
9
+ /** The owner of the current custom lobby */
10
+ lobbyOwnerId: string | null
11
+ /**
12
+ * Get position of a player / entity.
13
+ * @param entityId
14
+ */
15
+ getPosition(entityId: EntityId): Pos
16
+ /**
17
+ * Set position of a player / entity.
18
+ * @param entityId
19
+ * @param x Can also be an array, in which case y and z shouldn't be passed
20
+ * @param y
21
+ * @param z
22
+ */
23
+ setPosition(entityId: EntityId, x: number | number[], y?: number, z?: number): void
24
+ /**
25
+ * Get the scale of a lifeform.
26
+ * @param lifeformId
27
+ */
28
+ getLifeformScale(lifeformId: LifeformId): number
29
+ /**
30
+ * Set the visual + physical scale of a lifeform. A scale of 1 is the default size,
31
+ *
32
+ * @param lifeformId
33
+ * @param scale Must be a finite positive number.
34
+ */
35
+ setLifeformScale(lifeformId: LifeformId, scale: number): void
36
+ /**
37
+ * Get all the player ids.
38
+ */
39
+ getPlayerIds(): PlayerId[]
40
+ /**
41
+ * Whether a player is currently in the game
42
+ *
43
+ * @param playerId
44
+ */
45
+ playerIsInGame(playerId: PlayerId): boolean
46
+ /**
47
+ * @param playerId
48
+ * @returns
49
+ */
50
+ playerIsLoggedIn(playerId: PlayerId): boolean
51
+ /**
52
+ * Returns the party that the player was in when they joined the game. The returned object contains the playerDbIds, as well
53
+ * as the playerIds if available, of the party leader and members.
54
+ *
55
+ * @param playerId
56
+ * @returns
57
+ */
58
+ getPlayerPartyWhenJoined(playerId: PlayerId): PNull<{ partyCode: string; playerDbIds: PlayerDbId[] }>
59
+ /**
60
+ * Get the number of players in the room
61
+ */
62
+ getNumPlayers(): number
63
+ /**
64
+ * Get the co-ordinates of the blocks the player is standing on as a list. For example, if the center of the player is at 0,0,0
65
+ * this function will return [[0, -1, 0], [-1, -1, 0], [0, -1, -1], [-1, -1, -1]]
66
+ * If the player is just standing on one block, the function would return e.g. [[0, 0, 0]]
67
+ * If the player is middair then returns an empty list [].
68
+ *
69
+ * @param playerId
70
+ */
71
+ getBlockCoordinatesPlayerStandingOn(playerId: PlayerId): number[][]
72
+ /**
73
+ * Get the types of block the player is standing on
74
+ * For example, if a player is standing on 4 dirt blocks, this will return ["Dirt", "Dirt", "Dirt", "Dirt"]
75
+ * @param playerId
76
+ */
77
+ getBlockTypesPlayerStandingOn(playerId: PlayerId): any[]
78
+ /**
79
+ * Get the up to 12 unit co-ordinates the lifeform is located within
80
+ * (A lifeform is modelled as having four corners and can be in up to 3 blocks vertically)
81
+ *
82
+ * @param lifeformId
83
+ * @returns List of x, y, z positions e.g. [[-1, 0, 0], [-1, 1, 0], [-1, 2, 0]]
84
+ */
85
+ getUnitCoordinatesLifeformWithin(lifeformId: LifeformId): number[][]
86
+ /**
87
+ * Show the shop tutorial for a player. Will not be shown if they have ever seen the shop tutorial in your game before.
88
+ * @param playerId
89
+ */
90
+ showShopTutorial(playerId: PlayerId): void
91
+ /**
92
+ * Get the current shield of an entity.
93
+ * @param entityId
94
+ */
95
+ getShieldAmount(entityId: EntityId): number
96
+ /**
97
+ * Set the current shield of a lifeform.
98
+ *
99
+ * @param lifeformId
100
+ * @param newShieldAmount
101
+ */
102
+ setShieldAmount(lifeformId: LifeformId, newShieldAmount: number): void
103
+ /**
104
+ * Get the current health of an entity.
105
+ * @param entityId
106
+ */
107
+ getHealth(entityId: PlayerId): number
108
+ /**
109
+ * @param lifeformId
110
+ * @param changeAmount Must be an integer. A positive amount will increase the entity's health. A negative amount will decrease the entity's shield first, then their health.
111
+ * @param whoDidDamage Optional - If damage done by another player
112
+ * @param broadcastLifeformHurt
113
+ *
114
+ * @return Whether the entity was killed
115
+ */
116
+ applyHealthChange(lifeformId: LifeformId, changeAmount: number, whoDidDamage?: LifeformId | { lifeformId: LifeformId; withItem: string }, broadcastLifeformHurt?: boolean): boolean
117
+ /**
118
+ * Set the current health of an entity.
119
+ * If you want to set their health to more than their current max health, the optional increaseMaxHealthIfNeeded must be true.
120
+ *
121
+ * @param entityId
122
+ * @param newHealth Can be null to make the player not have health
123
+ * @param whoDidDamage Optional
124
+ * @param increaseMaxHealthIfNeeded Optional
125
+ *
126
+ * @return Whether this change in health killed the player
127
+ */
128
+ setHealth(entityId: EntityId, newHealth: PNull<number>, whoDidDamage?: LifeformId | { lifeformId: LifeformId; withItem: string }, increaseMaxHealthIfNeeded?: boolean): boolean
129
+ /**
130
+ * Make it as if hittingEId hit hitEId
131
+ *
132
+ * @param hittingEId
133
+ * @param hitEId
134
+ * @param dirFacing
135
+ * @param bodyPartHit
136
+ * @param overrides
137
+ * @returns whether the attack damaged the lifeform
138
+ */
139
+ applyMeleeHit(hittingEId: LifeformId, hitEId: LifeformId, dirFacing: number[], bodyPartHit?: PNull<LifeformBodyPart>, overrides?: { damage?: PNull<number>; heldItemName?: PNull<string>; horizontalKbMultiplier?: number; verticalKbMultiplier?: number; }): boolean
140
+ /**
141
+ * Apply damage to a lifeform.
142
+ * eId is the player initiating the damage, hitEId is the lifeform being hit.
143
+ *
144
+ * It is recommended to self-inflict damage when the game code wants to apply damage to a lifeform.
145
+ *
146
+ * @param eId
147
+ * @param hitEId
148
+ * @param attemptedDmgAmt
149
+ * @param withItem
150
+ * @param bodyPartHit
151
+ * @param attackDir
152
+ * @param showCritParticles
153
+ * @param reduceVerticalKbVelocity
154
+ * @param horizontalKbMultiplier
155
+ * @param verticalKbMultiplier
156
+ * @param broadcastEntityHurt
157
+ * @param attackCooldownSettings
158
+ * @param hittingSoundOverride
159
+ * @param ignoreOtherEntitySettingCanAttack
160
+ * @param isTrueDamage
161
+ * @param damagerDbId
162
+ *
163
+ * @returns whether the attack damaged the lifeform
164
+ */
165
+ attemptApplyDamage({
166
+ eId,
167
+ hitEId,
168
+ attemptedDmgAmt,
169
+ withItem,
170
+ bodyPartHit,
171
+ attackDir,
172
+ showCritParticles,
173
+ reduceVerticalKbVelocity,
174
+ horizontalKbMultiplier,
175
+ verticalKbMultiplier,
176
+ broadcastEntityHurt,
177
+ attackCooldownSettings,
178
+ hittingSoundOverride,
179
+ ignoreOtherEntitySettingCanAttack,
180
+ isTrueDamage,
181
+ damagerDbId,
182
+ }: PlayerAttemptDamageOtherPlayerOpts): boolean
183
+ /**
184
+ * Create enchantment attributes for an item at a given enchantment level. Same behaviour as if that level of enchant was selected for the item in an enchanting table.
185
+ * @param itemName
186
+ * @param enchantmentLevel
187
+ */
188
+ createEnchantmentAttributesForItem(itemName: ItemName, enchantmentLevel: number): EnchantmentAttributes
189
+ /**
190
+ * Force respawn a player
191
+ * @param playerId
192
+ * @param respawnPos
193
+ */
194
+ forceRespawn(playerId: PlayerId, respawnPos?: number[]): void
195
+ /**
196
+ * Kill a lifeform.
197
+ * @param lifeformId
198
+ * @param whoKilled Optional
199
+ */
200
+ killLifeform(lifeformId: LifeformId, whoKilled?: LifeformId | { lifeformId: LifeformId; withItem: string }): void
201
+ /**
202
+ * Gets the player's current killstreak
203
+ *
204
+ * @param playerId
205
+ * @returns
206
+ */
207
+ getCurrentKillstreak(playerId: PlayerId): number
208
+ /**
209
+ * Clears the player's current killstreak
210
+ *
211
+ * @param playerId
212
+ */
213
+ clearKillstreak(playerId: PlayerId): void
214
+ /**
215
+ * Whether a lifeform is alive or dead (or on the respawn screen, in a player's case).
216
+ *
217
+ * @param lifeformId
218
+ * @returns
219
+ */
220
+ isAlive(lifeformId: LifeformId): boolean
221
+ /**
222
+ * Send a message to everyone
223
+ *
224
+ * @param message The text contained within the message. Can use \`Custom Text Styling\`.
225
+ * @param style An optional style argument. Can contain values for fontWeight and color of the message.
226
+ * style is ignored if message uses custom text styling (i.e. is not a string).
227
+ */
228
+ broadcastMessage(message: string | CustomTextStyling, style?: { fontWeight?: number | string; color?: string; colour?: string }): void
229
+ /**
230
+ * Send a message to a specific player
231
+ *
232
+ * @param playerId Id of the player
233
+ * @param message The text contained within the message. Can use \`Custom Text Styling\`.
234
+ * @param style An optional style argument. Can contain values for fontWeight and color of the message.
235
+ * style is ignored if message uses custom text styling (i.e. is not a string).
236
+ */
237
+ sendMessage(playerId: PlayerId, message: string | CustomTextStyling, style?: { fontWeight?: number | string; color?: string }): void
238
+ /**
239
+ * Send a flying middle message to a specific player
240
+ *
241
+ * @param playerId Id of the player
242
+ * @param message The text contained within the message. Can be either a string or use \`Custom Text Styling\`.
243
+ * @param distanceFromAction The distance from the action that has caused this message to be displayed,
244
+ * this value will be used to determine how the message flies across the screen.
245
+ * @param lifetimeMs How long the message will be visible in milliseconds. Defaults to 1000ms.
246
+ */
247
+ sendFlyingMiddleMessage(playerId: PlayerId, message: string | CustomTextStyling, distanceFromAction: number, lifetimeMs?: number): void
248
+ /**
249
+ * Modify a client option at runtime and send to the client if it changed
250
+ *
251
+ * @param playerId
252
+ * @param option The name of the option
253
+ * @param value The new value of the option
254
+ */
255
+ setClientOption<PassedOption extends ClientOption>(playerId: PlayerId, option: PassedOption, value: ClientOptions[PassedOption]): void
256
+ /**
257
+ * Returns the current value of a client option
258
+ *
259
+ * @param playerId
260
+ * @param option
261
+ */
262
+ getClientOption<PassedOption extends ClientOption>(playerId: PlayerId, option: PassedOption): ClientOptions[PassedOption]
263
+ /**
264
+ * Create a new shop item under the given category.
265
+ * Will create a new category if it does not exist.
266
+ * If the shop item already exists then it will be replaced.
267
+ * If any per-player overrides exist under the same categoryKey and itemKey then they will be deleted.
268
+ *
269
+ * @param categoryKey - The key of the category to create the item in
270
+ * @param itemKey - The unique key for the item
271
+ * @param item - The shop item to create (will be mutated)
272
+ */
273
+ createShopItem(categoryKey: ShopCategoryKey, itemKey: ShopItemKey, item: ShopItem): void
274
+ /**
275
+ * Update selected properties of an existing shop item.
276
+ * For example, { canBuy: true } to allow players to purchase the item.
277
+ * Throws an error if the item does not exist.
278
+ *
279
+ * @param categoryKey - The key of the category containing the item
280
+ * @param itemKey - The unique key for the item
281
+ * @param changes - Partial shop item properties to update
282
+ */
283
+ updateShopItem(categoryKey: ShopCategoryKey, itemKey: ShopItemKey, changes: Partial<ShopItem>): void
284
+ /**
285
+ * Delete an existing shop item.
286
+ * Throws an error if the item does not exist.
287
+ * Will also delete all per-player overrides for the shop item.
288
+ *
289
+ * @param categoryKey - The key of the category containing the item
290
+ * @param itemKey - The unique key for the item
291
+ */
292
+ deleteShopItem(categoryKey: ShopCategoryKey, itemKey: ShopItemKey): void
293
+ /**
294
+ * Set properties of a shop category.
295
+ *
296
+ * @param categoryKey - The key of the category to configure
297
+ * @param config - Category configuration properties
298
+ */
299
+ configureShopCategory(categoryKey: ShopCategoryKey, config: ShopCategoryConfig): void
300
+ /**
301
+ * Create a new shop item for a specific player.
302
+ * Will create a new category if it does not exist.
303
+ * Will replace any overrides this player already has for the same item.
304
+ *
305
+ * @param playerId - The player to create the item for
306
+ * @param categoryKey - The key of the category to create the item in
307
+ * @param itemKey - The unique key for the item
308
+ * @param item - The shop item to create (will be mutated)
309
+ */
310
+ createShopItemForPlayer(playerId: PlayerId, categoryKey: ShopCategoryKey, itemKey: ShopItemKey, item: ShopItem): void
311
+ /**
312
+ * Update selected properties of an existing shop item for a specific player.
313
+ * For example, { canBuy: true } to allow this player to purchase the item.
314
+ * Throws an error if the item does not exist.
315
+ *
316
+ * @param playerId - The player to update the item for
317
+ * @param categoryKey - The key of the category containing the item
318
+ * @param itemKey - The unique key for the item
319
+ * @param changes - Partial shop item properties to update
320
+ */
321
+ updateShopItemForPlayer(playerId: PlayerId, categoryKey: ShopCategoryKey, itemKey: ShopItemKey, changes: Partial<ShopItem>): void
322
+ /**
323
+ * Delete a specific player's overrides for a shop item.
324
+ * Like other methods, it doesn't matter whether the overrides were created
325
+ * using createShopItemForPlayer or by using updateShopItemForPlayer instead.
326
+ * This method does nothing if the overrides don't exist or are defined internally by the engine.
327
+ *
328
+ * @param playerId - The player to reset the item for
329
+ * @param categoryKey - The key of the category containing the item
330
+ * @param itemKey - The unique key for the item
331
+ */
332
+ resetShopItemForPlayer(playerId: PlayerId, categoryKey: ShopCategoryKey, itemKey: ShopItemKey): void
333
+ /**
334
+ * Configure a shop category for a specific player.
335
+ *
336
+ * @param playerId - The player to configure the category for
337
+ * @param categoryKey - The key of the category to configure
338
+ * @param config - Category configuration properties
339
+ */
340
+ configureShopCategoryForPlayer(playerId: PlayerId, categoryKey: ShopCategoryKey, config: ShopCategoryConfig): void
341
+ /**
342
+ * Modify client options at runtime
343
+ *
344
+ * @param playerId
345
+ * @param optionsObj An object which contains key value pairs of new settings. E.g {canChange: true, speedMultiplier: false}
346
+ */
347
+ setClientOptions(playerId: PlayerId, optionsObj: Partial<ClientOptions>): void
348
+ /**
349
+ * Sets a client option to its default value. This will be the value stored in your game's defaultClientOptions, otherwise Bloxd's default.
350
+ *
351
+ * @param playerId
352
+ * @param option
353
+ */
354
+ setClientOptionToDefault(playerId: PlayerId, option: ClientOption): void
355
+ /**
356
+ * Set every player's other-entity setting to a specific value for a particular player.
357
+ * includeNewJoiners=true means that new players joining the game will also have this other player setting applied.
358
+ *
359
+ * @param targetedPlayerId
360
+ * @param settingName
361
+ * @param settingValue
362
+ * @param includeNewJoiners
363
+ */
364
+ setTargetedPlayerSettingForEveryone<Setting extends OtherEntitySetting>(targetedPlayerId: PlayerId, settingName: Setting, settingValue: OtherEntitySettings[Setting], includeNewJoiners?: boolean): void
365
+ /**
366
+ * Set a player's other-entity setting for every lifeform in the game.
367
+ * includeNewJoiners=true means that the player will have the setting applied to new joiners.
368
+ *
369
+ * @param playerId
370
+ * @param settingName
371
+ * @param settingValue
372
+ * @param includeNewJoiners
373
+ */
374
+ setEveryoneSettingForPlayer<Setting extends OtherEntitySetting>(playerId: PlayerId, settingName: Setting, settingValue: OtherEntitySettings[Setting], includeNewJoiners?: boolean): void
375
+ /**
376
+ * Set a player's other-entity setting for a specific entity.
377
+ *
378
+ * @param relevantPlayerId
379
+ * @param targetedEntityId
380
+ * @param settingName
381
+ * @param settingValue
382
+ */
383
+ setOtherEntitySetting<Setting extends OtherEntitySetting>(relevantPlayerId: PlayerId, targetedEntityId: EntityId, settingName: Setting, settingValue: OtherEntitySettings[Setting]): void
384
+ /**
385
+ * Set many of a player's other-entity settings for a specific entity.
386
+ *
387
+ * @param relevantPlayerId
388
+ * @param targetedEntityId
389
+ * @param settingsObject
390
+ */
391
+ setOtherEntitySettings(relevantPlayerId: PlayerId, targetedEntityId: EntityId, settingsObject: Partial<OtherEntitySettings>): void
392
+ /**
393
+ * Get the value of a player's other-entity setting for a specific entity.
394
+ *
395
+ * @param relevantPlayerId
396
+ * @param targetedEntityId
397
+ * @param settingName
398
+ */
399
+ getOtherEntitySetting<Setting extends OtherEntitySetting>(relevantPlayerId: PlayerId, targetedEntityId: EntityId, settingName: Setting): OtherEntitySettings[Setting]
400
+ /**
401
+ * Reset a player's other-entity setting for a specific entity to the game's default value.
402
+ *
403
+ * @param relevantPlayerId
404
+ * @param targetedEntityId
405
+ * @param settingName
406
+ */
407
+ setOtherEntitySettingToDefault<Setting extends OtherEntitySetting>(relevantPlayerId: PlayerId, targetedEntityId: EntityId, settingName: Setting): void
408
+ /**
409
+ * Play particle effect on all clients, or only on some clients if clientPredictedBy is specified
410
+ * @param opts
411
+ * @param clientPredictedBy Play only on clients where client with playerId clientPredictedBy
412
+ * is not invisible, transparent, or themselves
413
+ */
414
+ playParticleEffect(opts: TempParticleSystemOpts | ParticlePresetOpts, clientPredictedBy?: PlayerId): void
415
+ /**
416
+ * Animates the given entity. Pass \`null\` for \`animationSchema\` to stop the entity's current animation (the
417
+ * \`initialTimeFraction\` and \`animationSpeed\` arguments are ignored in that case).
418
+ * @param entityId
419
+ * @param animationSchema
420
+ * @param initialTimeFraction
421
+ * @param animationSpeed
422
+ */
423
+ animateEntity(entityId: EntityId, animationSchema: AnimationSchema | BlockbenchAnimationSchema | null, initialTimeFraction?: number, animationSpeed?: number): void
424
+ /**
425
+ * Get the in game name of an entity.
426
+ * @param entityId
427
+ */
428
+ getEntityName(entityId: EntityId): string
429
+ /**
430
+ * Given the name of a player, get their id
431
+ * @param playerName
432
+ */
433
+ getPlayerId(playerName: string): PNull<PlayerId>
434
+ /**
435
+ * Given a player, get their permanent identifier that doesn't change when leaving and re-entering
436
+ *
437
+ * @param playerId
438
+ */
439
+ getPlayerDbId(playerId: PlayerId): PlayerDbId
440
+ /**
441
+ * Returns null if player not in lobby
442
+ *
443
+ * @param dbId
444
+ */
445
+ getPlayerIdFromDbId(dbId: PlayerDbId): PNull<PlayerId>
446
+ /**
447
+ * Gets the persistent database ID for the given mob.
448
+ * This can be useful for reasoning about mobs that have been loaded from the database, such as owned mobs.
449
+ *
450
+ * @param mobId - The ID of the mob from spawnMob
451
+ * @returns The persistent database ID for the mob, or null if the mob is not persistent
452
+ */
453
+ getMobDbId(mobId: MobId): PNull<MobDbId>
454
+
455
+ kickPlayer(playerId: PlayerId, reason: string): void
456
+ /**
457
+ * Check if the block at a specific position is in a loaded chunk.
458
+ * @param x
459
+ * @param y
460
+ * @param z
461
+ * @return boolean
462
+ */
463
+ isBlockInLoadedChunk(x: number, y: number, z: number): boolean
464
+ /**
465
+ * Get the name of a block.
466
+ * @param x could be an array [x, y, z]. If so, the other params shouldn't be passed.
467
+ * @param y
468
+ * @param z
469
+ * @return blockName - any block name, including 'Air'
470
+ */
471
+ getBlock(x: number | number[], y?: number, z?: number): BlockName
472
+ /**
473
+ * Used to get the block id at a specific position.
474
+ * Intended only for use in hot code paths - default to getBlock for most use cases
475
+ *
476
+ * @param x
477
+ * @param y
478
+ * @param z
479
+ */
480
+ getBlockId(x: number, y: number, z: number): BlockId
481
+ /**
482
+ * Set a block. Valid names are any block name, including 'Air'
483
+ *
484
+ * This function is optimised for setting broad swathes of blocks. For example, if you have a 50x50x50 area you need to turn to air, it will run performantly if you call this in double nested loops.
485
+ *
486
+ * IF you're only changing a few blocks, you want this to be super snappy for players, AND you're calling this outside of your _tick function, you can use api.setOptimisations(false).
487
+ *
488
+ * If you want the optimisations for large quantities of blocks later on, then call api.setOptimisations(true) when you're done.
489
+ *
490
+ *
491
+ *
492
+ * @param x Can be an array
493
+ * @param y Should be blockname if first param is array
494
+ * @param z
495
+ * @param blockName
496
+ */
497
+ setBlock(x: number | number[], y: number | BlockName, z?: number, blockName?: BlockName): void
498
+ /**
499
+ * Initiate a block change "by the world".
500
+ * This ends up calling the onWorldChangeBlock and only makes the change if not prevented by game/plugins.
501
+ * initiatorDbId is null if the change was initiated by the game code.
502
+ *
503
+ * @param initiatorDbId
504
+ * @param x
505
+ * @param y
506
+ * @param z
507
+ * @param blockName
508
+ * @param extraInfo
509
+ *
510
+ * @returns "preventChange" if the change was prevented, "preventDrop" if the change was allowed but without dropping any items, and undefined if the change was allowed with an item drop
511
+ */
512
+ attemptWorldChangeBlock(initiatorDbId: PNull<PlayerDbId>, x: number, y: number, z: number, blockName: BlockName, extraInfo?: WorldBlockChangedInfo): "preventChange" | "preventDrop" | void
513
+ /**
514
+ * Returns whether a block is solid or not.
515
+ * E.g. Grass block is solid, while water, ladder and water are not.
516
+ * Will be true if the block is unloaded.
517
+ *
518
+ * @param x
519
+ * @param y
520
+ * @param z
521
+ */
522
+ getBlockSolidity(x: number | number[], y?: number, z?: number): boolean
523
+ /**
524
+ * Helper function that sets all blocks in a rectangle to a specific block.
525
+ *
526
+ * @param pos1 array [x, y, z]
527
+ * @param pos2 array [x, y, z]
528
+ * @param blockName
529
+ */
530
+ setBlockRect(pos1: number[], pos2: number[], blockName: BlockName): void
531
+ /**
532
+ * Create walls by providing two opposite corners of the cuboid
533
+ *
534
+ *
535
+ * @param pos1 array [x, y, z]
536
+ * @param pos2 array [x, y, z]
537
+ * @param blockName
538
+ * @param hasFloor
539
+ * @param hasCeiling
540
+ */
541
+ setBlockWalls(pos1: number[], pos2: number[], blockName: BlockName, hasFloor?: boolean, hasCeiling?: boolean): void
542
+ /**
543
+ * Copies chunk from one position to another.
544
+ * A good use case for this is storing 'template' chunks that can be continuously copied to a new position.
545
+ * In order to reset an area to the template, e.g. resetting a session-based game.
546
+ *
547
+ * NOTE: Does nothing if the source chunk is not loaded.
548
+ *
549
+ * @param fromPos - A block coordinate within the chunk to copy from.
550
+ * @param toPos - A block coordinate within the chunk to copy to.
551
+ */
552
+ copyChunk(fromPos: number[], toPos: number[]): void
553
+ /**
554
+ * Use this to get a chunk ndarray you can edit and set in resetChunk.
555
+ *
556
+ * Only use chunk helpers if you REALLY need the performance (i.e. you are iterating over tens of thousands of blocks)
557
+ * ReturnedObject.blockData is a 32x32x32 ndarray of air.
558
+ * (see https://www.npmjs.com/package/ndarray)
559
+ * Each block id is a 16-bit number
560
+ */
561
+ getEmptyChunk(): GameChunk
562
+ /**
563
+ * Splits the block name by '|'. If no meta info, metaInfo is ''
564
+ *
565
+ * @param blockName
566
+ */
567
+ getMetaInfo(blockName: BlockName | null | undefined): ItemMetaInfo
568
+ /**
569
+ * Get the numeric id of a block used in the ndarrays returned from getChunk
570
+ * I.e. chunk.blockData.set(x, y, z, api.blockNameToBlockId("Dirt"))
571
+ * or chunk.blockData.get(x, y, z) === api.blockNameToBlockId("Dirt")
572
+ *
573
+ * @param blockName
574
+ * @param allowInvalidBlock Don't throw an error if the block name is invalid.
575
+ * Defaults false. If true and name is invalid, returns null.
576
+ * @returns
577
+ */
578
+ blockNameToBlockId(blockName: BlockName, allowInvalidBlock?: boolean): PNull<number>
579
+ /**
580
+ * Goes from block id to block name. The reverse of blockNameToBlockId
581
+ *
582
+ * @param blockId
583
+ */
584
+ blockIdToBlockName(blockId: BlockId): BlockName
585
+ /**
586
+ * Get the unique id of the chunk containing pos in the current map
587
+ *
588
+ * @param pos
589
+ */
590
+ blockCoordToChunkId(pos: number[]): string
591
+ /**
592
+ * Get the co-ordinates of the block in the chunk with the lowest x, y, and z co-ordinates
593
+ *
594
+ * @param chunkId
595
+ */
596
+ chunkIdToBotLeftCoord(chunkId: string): [number, number, number]
597
+ /**
598
+ * @deprecated - prefer using other UI elements
599
+ * (this UI element hasn't been properly thought through in combination with other elements like killfeed, uirequests, etc)
600
+ *
601
+ * Send a player an icon in the top right corner
602
+ *
603
+ * @param playerId
604
+ * @param icon Can be any icon from font-awesome.
605
+ * @param text The text to send.
606
+ * @param opts Can include keys duration, width, height, color, iconSizeMult.
607
+ *
608
+ * Default opts: {
609
+ * duration: 8, // seconds
610
+ * width: 400px,
611
+ * height: 100px,
612
+ * color: 'rgb(102, 102, 102)', // must be rgb in this format (hex not supported),
613
+ * iconSizeMult: 5,
614
+ * textAndIconColor: "white", // can be any colour supported by css (e.g. hex, rgb),
615
+ * fontSize: '17px',
616
+ * }
617
+ */
618
+ sendTopRightHelper(playerId: PlayerId, icon: string, text: string, opts: { duration?: number; width?: number; height?: number; color?: string; iconSizeMult?: number; textAndIconColor?: string; fontSize?: string; }): void
619
+ /**
620
+ * Whether the player is on a mobile device or a computer.
621
+ * @param playerId
622
+ */
623
+ isMobile(playerId: PlayerId): boolean
624
+ /**
625
+ * Get the amount of a given currency a player has.
626
+ * @param playerId
627
+ * @param currencyId
628
+ * @returns The amount of the currency, or null if the currency is not defined.
629
+ */
630
+ getCurrencyAmount(playerId: PlayerId, currencyId: string): PNull<number>
631
+ /**
632
+ * Create a dropped item.
633
+ * @param x
634
+ * @param y
635
+ * @param z
636
+ * @param itemName Name of the item. Any item name, including blocks and 'Air'
637
+ * @param amount The amount of the item in the drop. Defaults to 1 when omitted. Use 0 for a collect-only trigger that does not add to inventory (fires onPlayerPickedUpItem with itemAmount 0).
638
+ * @param mergeItems Whether to merge the item into a nearby item of same type, if one exists. Defaults to false.
639
+ * @param attributes Attributes of the item being dropped
640
+ * @param timeTillDespawn Time till the item automatically despawns in milliseconds. Defaults to 5 mins, max of 1 hour.
641
+ * @param dropperId Who dropped the item.
642
+ * @param options Additional options, such as doPhysics and size.
643
+ * @returns the id you can pass to setCantPickUpItem, or null if the item drop limit was reached
644
+ */
645
+ createItemDrop(x: number, y: number, z: number, itemName: ItemName, amount?: PNull<number>, mergeItems?: boolean, attributes?: ItemAttributes, timeTillDespawn?: number, dropperId?: PNull<LifeformId>, options?: ItemDropOptions): PNull<EntityId>
646
+ /**
647
+ * Prevent a player from picking up an item. itemId returned by createItemDrop
648
+ *
649
+ * @param playerId
650
+ * @param itemId
651
+ */
652
+ setCantPickUpItem(playerId: PlayerId, itemId: EntityId): void
653
+ /**
654
+ * Reset a player's ability to pick up an item. itemId returned by createItemDrop
655
+ *
656
+ * @param playerId
657
+ * @param itemId
658
+ */
659
+ resetCanPickUpItem(playerId: PlayerId, itemId: EntityId): void
660
+ /**
661
+ * Delete an item drop by item drop entity ID
662
+ *
663
+ * @param itemId
664
+ */
665
+ deleteItemDrop(itemId: EntityId): void
666
+ /**
667
+ * Create an invisible audio entity at a world position that loops a sound to
668
+ * nearby players (e.g. a jukebox or fireplace).
669
+ *
670
+ * Audio entities count against the same budget as physics-less mesh entities; returns null
671
+ * if that budget is exhausted.
672
+ *
673
+ * @param x
674
+ * @param y
675
+ * @param z
676
+ * @param soundName The sound to loop.
677
+ * @param volume
678
+ * @param options {refDistance: number, maxHearDist: number, rate: number}
679
+ * refDistance: higher means the sound decreases less in volume with distance. Defaults to 3. Hitting is 4. Guns are 10
680
+ * maxHearDist: sound is not played if player is further than this. Defaults to 30
681
+ * rate: The speed of playback. Also affects pitch. 0.5-4. Lower playback = lower pitch. Good for varying the sound.
682
+ * E.g. item pickup sound has a random rate between 1 and 1.5.
683
+ * @returns the audio entity ID, or null if the entity budget is exhausted
684
+ */
685
+ attemptCreateAudioEntity(x: number, y: number, z: number, soundName: string, volume?: number, options?: { refDistance?: number; maxHearDist?: number; rate?: number; }): PNull<EntityId>
686
+ /**
687
+ * Update an audio entity's config (sound, volume, falloff, rate). Only the provided fields
688
+ * change.
689
+ *
690
+ * @param eId
691
+ * @param opts Any subset of soundName, volume, refDistance, maxHearDist, rate.
692
+ */
693
+ updateAudioEntity(eId: EntityId, opts: Partial<AudioEntityOpts>): void
694
+ /**
695
+ * Delete an audio entity by its entity ID (returned by attemptCreateAudioEntity).
696
+ *
697
+ * @param eId
698
+ */
699
+ deleteAudioEntity(eId: EntityId): void
700
+ /**
701
+ * Returns all items overlapping with the given player
702
+ *
703
+ * @param playerId
704
+ * @returns the overlapping item entity IDs
705
+ */
706
+ getItemIDsOverlappingWithPlayer(playerId: PlayerId): EntityId[]
707
+ /**
708
+ * Get the metadata about a block or item before stats have been modified by any client options
709
+ * (i.e. its entry in the initial metadata object)
710
+ *
711
+ * @param itemName
712
+ */
713
+ getInitialItemMetadata(itemName: string): Partial<BlockMetadataItem & NonBlockMetadataItem>
714
+ /**
715
+ * Get stat info about a block or item
716
+ * Either based on a client option for a player: (e.g. \`DirtTtb\`)
717
+ * or its entry in the initial metadata object if no client option is set.
718
+ *
719
+ * If null is passed for lifeformId, this is simply its entry in blockMetadata etc.
720
+ *
721
+ *
722
+ * @param lifeformId
723
+ * @param itemName
724
+ * @param stat
725
+ */
726
+ getItemStat<K extends keyof AnyMetadataItem>(lifeformId: PNull<LifeformId>, itemName: ItemName, stat: K): AnyMetadataItem[K]
727
+ /**
728
+ * Set a stat attribute for a block or item
729
+ *
730
+ * NOTE: Only a subset of stats are customisable this way.
731
+ *
732
+ * @param playerId
733
+ * @param itemName
734
+ * @param stat
735
+ * @param value
736
+ */
737
+ setItemStat<K extends CustomItemStat>(playerId: PlayerId, itemName: ItemName, stat: K, value: AnyMetadataItem[K]): void
738
+ /**
739
+ * Set the direction the player is looking.
740
+ *
741
+ * @param playerId
742
+ * @param direction a vector of the direction to look, format [x, y, z]
743
+ */
744
+ setCameraDirection(playerId: PlayerId, direction: number[]): void
745
+ /**
746
+ * Shake a player's camera.
747
+ *
748
+ * @param playerId
749
+ * @param intensity Shake "power" (0..1); the client clamps the accumulated power to 1.
750
+ * @param durationMs How long the shake lasts, in milliseconds.
751
+ */
752
+ shakePlayerCamera(playerId: PlayerId, intensity: number, durationMs?: number): void
753
+ /**
754
+ * Set a player's opacity
755
+ * A simple helper that calls setTargetedPlayerSettingForEveryone
756
+ *
757
+ * @param playerId
758
+ * @param opacity
759
+ */
760
+ setPlayerOpacity(playerId: PlayerId, opacity: number): void
761
+ /**
762
+ * Set the level of viewable opacity by one player on another player
763
+ * A simple helper that calls setOtherEntitySetting
764
+ *
765
+ * @param playerIdWhoViewsOpacityPlayer The player who sees that with opacity
766
+ * @param playerIdOfOpacityPlayer The player/player model who is given opacity
767
+ * @param opacity
768
+ */
769
+ setPlayerOpacityForOnePlayer(playerIdWhoViewsOpacityPlayer: PlayerId, playerIdOfOpacityPlayer: PlayerId, opacity: number): void
770
+ /**
771
+ * Obtain Date.now() value saved at start of current game tick
772
+ */
773
+ now(): number
774
+ /**
775
+ * Check your game (and, optionally, a entity) is still valid and executing.
776
+ * Useful if you're using async functions and await within your game.
777
+ * If you use await/async or promises and do not check this, your game could have closed and then the rest of your
778
+ * async code executes.
779
+ *
780
+ * @param entityId
781
+ */
782
+ checkValid(entityId?: PNull<EntityId>): boolean
783
+ /**
784
+ * Let a player change a block at a specific co-ordinate. Useful when client option canChange is false.
785
+ * Overrides blockRect and blockType settings, so also useful when you have disallowed changing of a block type with setCantChangeBlockType.
786
+ * Using this on 1000s of blocks will cause lag - if that is needed, find a way to use setCanChangeBlockType.
787
+ *
788
+ * @param playerId
789
+ * @param x
790
+ * @param y
791
+ * @param z
792
+ */
793
+ setCanChangeBlock(playerId: PlayerId, x: number, y: number, z: number): void
794
+ /**
795
+ * Prevents a player from changing a block at a specific co-ordinate. Useful when client option canChange is true.
796
+ * Overrides blockRect and blockType settings, so also useful when you have allowed changing of a block type with setCantChangeBlockType.
797
+ * Using this on 1000s of blocks will cause lag - if that is needed, find a way to use setCantChangeBlockType.
798
+ *
799
+ * @param playerId
800
+ * @param x
801
+ * @param y
802
+ * @param z
803
+ */
804
+ setCantChangeBlock(playerId: PlayerId, x: number, y: number, z: number): void
805
+ /**
806
+ * Remove any previous can/cant change block settings for a player at a specific co-ordinate
807
+ *
808
+ * @param playerId
809
+ * @param x
810
+ * @param y
811
+ * @param z
812
+ */
813
+ resetCanChangeBlock(playerId: PlayerId, x: number, y: number, z: number): void
814
+ /**
815
+ * Lets a player Change a block type. Valid names are any block name, including 'Air'
816
+ * Less priority than cant change block pos/can change block rect
817
+ *
818
+ * @param playerId
819
+ * @param blockName
820
+ */
821
+ setCanChangeBlockType(playerId: PlayerId, blockName: BlockName): void
822
+ /**
823
+ * Stops a player from changing a block type. Valid names are any block name, including 'Air'
824
+ * Less priority than can change block pos/can change block rect
825
+ *
826
+ * @param playerId
827
+ * @param blockName
828
+ */
829
+ setCantChangeBlockType(playerId: PlayerId, blockName: BlockName): void
830
+ /**
831
+ * Remove any previous can/cant change block type settings for a player
832
+ *
833
+ * @param playerId
834
+ * @param blockName
835
+ */
836
+ resetCanChangeBlockType(playerId: PlayerId, blockName: BlockName): void
837
+ /**
838
+ * Make it so a player can Change blocks within two points. Coordinates are inclusive. E.g. if [0, 0, 0] is pos1
839
+ * and [1, 1, 1] is pos2 then the 8 blocks contained within low and high will be able to be broken.
840
+ * Overrides setCantChangeBlockType
841
+ *
842
+ *
843
+ * @param playerId
844
+ * @param pos1 Arg as [x, y, z]
845
+ * @param pos2 Arg as [x, y, z]
846
+ */
847
+ setCanChangeBlockRect(playerId: PlayerId, pos1: number[], pos2: number[]): void
848
+ /**
849
+ * Make it so a player cant Change blocks within two points. Coordinates are inclusive. E.g. if [0, 0, 0] is pos1
850
+ * and [1, 1, 1] is pos2 then the 8 blocks contained within pos1 and pos2 won't be able to be broken.
851
+ * Overrides setCanChangeBlockType
852
+ *
853
+ *
854
+ * @param playerId
855
+ * @param pos1 Arg as [x, y, z]
856
+ * @param pos2 Arg as [x, y, z]
857
+ */
858
+ setCantChangeBlockRect(playerId: PlayerId, pos1: number[], pos2: number[]): void
859
+ /**
860
+ * Remove any previous can/cant change block rect settings for a player
861
+ *
862
+ * @param playerId
863
+ * @param pos1
864
+ * @param pos2
865
+ */
866
+ resetCanChangeBlockRect(playerId: PlayerId, pos1: number[], pos2: number[]): void
867
+ /**
868
+ * Allow a player to walk through a type of block. For blocks that are normally solid and not seethrough, the player will experience slight visual glitches while inside the block.
869
+ *
870
+ *
871
+ * @param playerId
872
+ * @param blockName
873
+ * @param disable If you've enabled a player to walk through a block and want to make the block solid for them again, pass this with true. Otherwise you only need to pass playerId and blockName
874
+ */
875
+ setWalkThroughType(playerId: PlayerId, blockName: BlockName, disable?: boolean): void
876
+ /**
877
+ * Allow a player to walk through (or not walk through) voxels that are located within a given rectangle.
878
+ * For blocks that are normally solid and not seethrough, the player will experience slight visual glitches while inside the block.
879
+ *
880
+ * You could set both pos1 and pos2 to [0, 0, 0] to make only 0, 0, 0 walkthrough, for example.
881
+ *
882
+ * @param playerId
883
+ * @param pos1 The one corner of the cuboid. Format [x, y, z]
884
+ * @param pos2 The top right corner of the cuboid. Format [x, y, z]
885
+ * @param updateType The type of update. Whether to make a rect solid, or able to be walked through.
886
+ * Pass DEFAULT_WALK_THROUGH with a previously passed rect to disable any walkthrough setting for that rect.
887
+ *
888
+ */
889
+ setWalkThroughRect(playerId: PlayerId, pos1: number[], pos2: number[], updateType: WalkThroughType): void
890
+ /**
891
+ * Give a player an item and a certain amount of that item.
892
+ * Returns the amount of item added to the users inventory.
893
+ *
894
+ * @param playerId
895
+ * @param itemName
896
+ * @param itemAmount
897
+ * @param attributes An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has.
898
+ */
899
+ giveItem(playerId: PlayerId, itemName: ItemName, itemAmount?: number, attributes?: ItemAttributes): number
900
+ /**
901
+ * Whether the player has space in their inventory to get new blocks
902
+ * @param playerId
903
+ */
904
+ inventoryIsFull(playerId: PlayerId): boolean
905
+ /**
906
+ * Put an item in a specific index. Default hotbar is indexes 0-9
907
+ *
908
+ * @param playerId
909
+ * @param itemSlotIndex 0-indexed
910
+ * @param itemName Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared.
911
+ * @param itemAmount -1 for infinity. Should not be set, or null, for items that are not stackable.
912
+ * @param attributes An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has.
913
+ * @param tellClient whether to tell client about it - results in desync between client and server if client doesnt locally perform the same action
914
+ */
915
+ setItemSlot(playerId: PlayerId, itemSlotIndex: number, itemName: ItemName, itemAmount?: PNull<number>, attributes?: ItemAttributes, tellClient?: boolean): void
916
+ /**
917
+ * Remove an amount of item from a player's inventory
918
+ *
919
+ * @param playerId
920
+ * @param itemName
921
+ * @param amount
922
+ */
923
+ removeItemName(playerId: PlayerId, itemName: ItemName, amount: number): void
924
+ /**
925
+ * Get the item at a specific index
926
+ * Returns null if there is no item at that index
927
+ * If there is an item, return an object of the format { name: string; amount: PNull<number>; attributes: ItemAttributes; }
928
+ *
929
+ * @param playerId
930
+ * @param itemSlotIndex
931
+ */
932
+ getItemSlot(playerId: PlayerId, itemSlotIndex: number): PNull<InvenItem>
933
+ /**
934
+ * Finds the index of a particular item in a player's inventory.
935
+ *
936
+ * @param playerId
937
+ * @param itemName
938
+ * @return The index of the item in the player's inventory, or null if the item is not found.
939
+ */
940
+ findItem(playerId: PlayerId, itemName: ItemName): PNull<number>
941
+ /**
942
+ * Whether a player has an item
943
+ *
944
+ * @param playerId
945
+ * @param itemName
946
+ * @returns bool
947
+ */
948
+ hasItem(playerId: PlayerId, itemName: ItemName): boolean
949
+ /**
950
+ * The amount of an itemName a player has.
951
+ * Returns 0 if the player has none, and a negative number if infinite.
952
+ *
953
+ * @param playerId
954
+ * @param itemName
955
+ * @returns number
956
+ */
957
+ getInventoryItemAmount(playerId: PlayerId, itemName: ItemName): number
958
+ /**
959
+ * Clear the players inventory
960
+ *
961
+ * @param playerId
962
+ */
963
+ clearInventory(playerId: PlayerId): void
964
+ /**
965
+ * Force the player to have the ith inventory slot selected. E.g. newI 0 makes the player have the 0th inventory slot selected
966
+ *
967
+ * @param playerId
968
+ * @param newI integer from 0-9
969
+ */
970
+ setSelectedInventorySlotI(playerId: PlayerId, newI: number): void
971
+ /**
972
+ * Get a player's currently selected inventory slot
973
+ * @param playerId
974
+ * @returns
975
+ */
976
+ getSelectedInventorySlotI(playerId: PlayerId): number
977
+ /**
978
+ * Get the currently held item of a player
979
+ * Returns null if no item is being held
980
+ * If an item is held, return an object of the format {name: itemName, amount: amountOfItem}
981
+ *
982
+ * @param playerId
983
+ */
984
+ getHeldItem(playerId: PlayerId): PNull<InvenItem>
985
+ /**
986
+ * Get the amount of free slots in a player's inventory.
987
+ *
988
+ * @param playerId
989
+ * @returns number
990
+ */
991
+ getInventoryFreeSlotCount(playerId: PlayerId): number
992
+ /**
993
+ * Checks if a player is able to open a chest at a given location,
994
+ * as per the rules laid out by the "onPlayerAttemptOpenChest" game callback.
995
+ * Returns true if the player can open the chest, false if they cannot, and void if the chest does not exist.
996
+ *
997
+ * @param playerId
998
+ * @param chestX
999
+ * @param chestY
1000
+ * @param chestZ
1001
+ */
1002
+ canOpenStandardChest(playerId: PlayerId, chestX: number, chestY: number, chestZ: number): PNull<boolean>
1003
+ /**
1004
+ * Open a chest for a player.
1005
+ * If there is no chest, or the player cannot open it, do nothing.
1006
+ * WARNING: This may call "onPlayerAttemptOpenChest" to determine if the player has permission to open it. Using this function inside that callback risks infinite recursion.
1007
+ *
1008
+ * @param playerId
1009
+ * @param x
1010
+ * @param y
1011
+ * @param z
1012
+ */
1013
+ openChestForPlayer(playerId: PlayerId, x: number, y: number, z: number): void
1014
+ /**
1015
+ * Close a chest for a player.
1016
+ * If the player does not have a chest open, do nothing.
1017
+ *
1018
+ * @param playerId
1019
+ */
1020
+ closeChestForPlayer(playerId: PlayerId): void
1021
+ /**
1022
+ * Read a player's current crafting recipe set, keyed by output item name. Includes any
1023
+ * per-player overrides set via \`editItemCraftingRecipes\` / \`removeItemCraftingRecipes\`.
1024
+ *
1025
+ * @param playerId
1026
+ */
1027
+ getCraftingRecipesForPlayer(playerId: PlayerId): Record<string, RecipesForItem>
1028
+ /**
1029
+ * Give a standard chest an item and a certain amount of that item.
1030
+ * Returns the amount of item added to the chest.
1031
+ *
1032
+ * @param chestPos
1033
+ * @param itemName
1034
+ * @param itemAmount
1035
+ * @param playerId The player who is interacting with the chest.
1036
+ * @param attributes An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has.
1037
+ */
1038
+ giveStandardChestItem(chestPos: number[], itemName: ItemName, itemAmount?: number, playerId?: PlayerId, attributes?: ItemAttributes): number
1039
+ /**
1040
+ * Remove an amount of item from a standardChest inventory
1041
+ *
1042
+ * @param chestPos
1043
+ * @param itemName
1044
+ * @param amount
1045
+ * @param playerId The player who is interacting with the chest.
1046
+ */
1047
+ removeItemNameFromStandardChest(chestPos: number[], itemName: ItemName, amount: number, playerId?: PlayerId): void
1048
+ /**
1049
+ * Get the amount of free slots in a standard chest
1050
+ * Returns null for non-chests
1051
+ *
1052
+ * @param chestPos
1053
+ * @returns number
1054
+ */
1055
+ getStandardChestFreeSlotCount(chestPos: number[]): PNull<number>
1056
+ /**
1057
+ * The amount of an itemName a standard chest has.
1058
+ * Returns 0 if the standard chest has none, and a negative number if infinite.
1059
+ *
1060
+ * @param chestPos
1061
+ * @param itemName
1062
+ * @returns number
1063
+ */
1064
+ getStandardChestItemAmount(chestPos: number[], itemName: ItemName): number
1065
+ /**
1066
+ * Get the item at a chest slot. Null if empty otherwise format {name: itemName, amount: amountOfItem}
1067
+ *
1068
+ * @param chestPos
1069
+ * @param idx
1070
+ */
1071
+ getStandardChestItemSlot(chestPos: number[], idx: number): PNull<InvenItem>
1072
+ /**
1073
+ * Get all the items from a standard chest in order. Use this instead of repetitive calls to getStandardChestItemSlot
1074
+ *
1075
+ * @param chestPos
1076
+ */
1077
+ getStandardChestItems(chestPos: number[]): PNull<InvenItem>[]
1078
+ /**
1079
+ * @param chestPos
1080
+ * @param idx 0-indexed
1081
+ * @param itemName Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared.
1082
+ * @param itemAmount -1 for infinity. Should not be set, or null, for items that are not stackable.
1083
+ * @param playerId The player who is interacting with the chest.
1084
+ * @param attributes An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has.
1085
+ */
1086
+ setStandardChestItemSlot(chestPos: number[], idx: number, itemName: ItemName, itemAmount?: number, playerId?: PlayerId, attributes?: ItemAttributes): void
1087
+ /**
1088
+ * Find the index of a particular item in a standard chest
1089
+ * @param chestPos
1090
+ * @param itemName
1091
+ */
1092
+ findStandardChestItem(chestPos: number[], itemName: ItemName): PNull<number>
1093
+ /**
1094
+ * Get the item in a player's moonstone chest slot. Null if empty
1095
+ *
1096
+ * Moonstone chests are a type of chest where a player accesses the same contents no matter the location of the moonstone chest
1097
+ *
1098
+ * @param playerId
1099
+ * @param idx
1100
+ */
1101
+ getMoonstoneChestItemSlot(playerId: PlayerId, idx: number): PNull<InvenItem>
1102
+ /**
1103
+ * Get all the items from a moonstone chest in order. Use this instead of repetitive calls to getMoonstoneChestItemSlot
1104
+ *
1105
+ * Moonstone chests are a type of chest where a player accesses the same contents no matter the location of the moonstone chest
1106
+ *
1107
+ * @param playerId
1108
+ */
1109
+ getMoonstoneChestItems(playerId: PlayerId): PNull<InvenItem>[]
1110
+ /**
1111
+ * Moonstone chests are a type of chest where a player accesses the same contents no matter the location of the moonstone chest
1112
+ *
1113
+ * @param playerId
1114
+ * @param idx 0-indexed
1115
+ * @param itemName Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared.
1116
+ * @param itemAmount -1 for infinity. Should not be set, or null, for items that are not stackable.
1117
+ * @param metadata An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has.
1118
+ */
1119
+ setMoonstoneChestItemSlot(playerId: PlayerId, idx: number, itemName: ItemName, itemAmount?: number, metadata?: ItemAttributes): void
1120
+ /**
1121
+ * Store data about a block in a performant manner. Data is cleared when block changes.
1122
+ * E.g. chest
1123
+ * Works well with blocks marked tickable (e.g. wheat)
1124
+ *
1125
+ * @param x
1126
+ * @param y
1127
+ * @param z
1128
+ * @param data
1129
+ */
1130
+ setBlockData(x: number, y: number, z: number, data: object): void
1131
+ /**
1132
+ * Get stored data about a block in a performant manner. Data is cleared when block changes.
1133
+ * E.g. chest
1134
+ * Works well with blocks marked tickable (e.g. wheat)
1135
+ *
1136
+ * @param x
1137
+ * @param y
1138
+ * @param z
1139
+ */
1140
+ getBlockData(x: number, y: number, z: number): any
1141
+ /**
1142
+ * Get the name of the lobby this game is running in.
1143
+ */
1144
+ getLobbyName(): string
1145
+ /**
1146
+ * Integer lobby names are public
1147
+ * @returns boolean
1148
+ */
1149
+ isPublicLobby(): boolean
1150
+ /**
1151
+ * Returns if the current lobby the game is running in is special - e.g. a discord guild or dm, or simply a standard lobby
1152
+ */
1153
+ getLobbyType(): LobbyType
1154
+ /**
1155
+ * Update the progress bar in the bottom right corner.
1156
+ * Can be queued.
1157
+ *
1158
+ * @param playerId
1159
+ * @param toFraction The fraction of the progress bar you want to be filled up.
1160
+ * @param toDuration The time it takes for the bar to reach the given toFraction in ms.
1161
+ * If this is too low and you queue multiple updates, this toFraction could be skipped. Treat 200ms as a minimum.
1162
+ */
1163
+ progressBarUpdate(playerId: PlayerId, toFraction: number, toDuration?: number): void
1164
+ /**
1165
+ * This will initiate the MiddleScreenBar, starting at empty and filling up to full over the given duration.
1166
+ * Good to represent cooldowns (eg gun reload) or charged items (eg crossbow)
1167
+ *
1168
+ * @param playerId
1169
+ * @param duration ms over which the MiddleScreenBar fills up
1170
+ * @param chargeExpiresAutomatically Defaults to true. If true, the bar will disappear upon reaching full. If false, the bar will remain at full until hidden with removeMiddleScreenBar
1171
+ * @param horizontalBarRemOffset Offset the bar left or right (in css unit - rem)
1172
+ */
1173
+ initiateMiddleScreenBar(playerId: PlayerId, duration: number, chargeExpiresAutomatically?: boolean, horizontalBarRemOffset?: number): void
1174
+ /**
1175
+ * If there is any current middle screen bar running, this will hide it
1176
+ *
1177
+ * @param playerId
1178
+ */
1179
+ removeMiddleScreenBar(playerId: PlayerId): void
1180
+ /**
1181
+ * Show a hitmarker on the player's screen (the X-shaped crosshair flash indicating a successful hit).
1182
+ * Useful for custom weapons or things that need visual hit feedback.
1183
+ *
1184
+ * @param playerId The player to show the hitmarker to
1185
+ * @param isCrit If true, shows an enhanced critical-hit hitmarker with a longer, more dramatic animation
1186
+ * @param directionVector Optional [x, y, z] direction vector. When provided, the hitmarker appears
1187
+ * at the projected screen position of that direction rather than at the centre of the screen.
1188
+ * Same flow as mobile melee attacks where the tap point differs from screen centre.
1189
+ */
1190
+ sendHitmarker(playerId: PlayerId, isCrit?: boolean, directionVector?: PNull<number[]>): void
1191
+ /**
1192
+ * Show a directional arrow indicator on the player's screen pointing toward a world position.
1193
+ * When the position is off-screen the indicator is a rotating chevron at the screen edge.
1194
+ * When the position is on-screen it becomes a small marker dot.
1195
+ *
1196
+ * The arrow persists until explicitly cleared via \`clearDirectionArrow\`.
1197
+ * Calling again with the same \`id\` updates the existing arrow in-place.
1198
+ *
1199
+ * @param playerId The player to show the arrow to
1200
+ * @param id Unique identifier for this arrow (allows multiple concurrent arrows)
1201
+ * @param position [x, y, z] world position the arrow should point toward
1202
+ * @param text Optional label rendered below the indicator. Supports CustomTextStyling for rich text with icons/colours.
1203
+ * @param showDistance If true, displays the distance (in blocks) from the player to the arrow position.
1204
+ * @param style Optional style object (same format as CustomTextStyling's StyledText \`style\`). Controls chevron/marker colour, label typography, and opacity.
1205
+ */
1206
+ setDirectionArrow(playerId: PlayerId, id: string, position: number[], text?: PNull<string | CustomTextStyling>, showDistance?: boolean, style?: PNull<TextStyle>): void
1207
+ /**
1208
+ * Clear a directional arrow from the player's screen.
1209
+ *
1210
+ * @param playerId The player to clear the arrow for
1211
+ * @param id The arrow identifier to clear. If null, clears all arrows for this player.
1212
+ */
1213
+ clearDirectionArrow(playerId: PlayerId, id?: PNull<string>): void
1214
+ /**
1215
+ * Edit the crafting recipes for a player.
1216
+ *
1217
+ * @param playerId
1218
+ * @param itemName
1219
+ * @param recipesForItem
1220
+ */
1221
+ editItemCraftingRecipes(playerId: PlayerId, itemName: ItemName, recipesForItem: RecipesForItem): void
1222
+ /**
1223
+ * Reset the crafting recipes for a given back to its original bloxd state
1224
+ *
1225
+ * @param playerId
1226
+ * @param itemName Resets all crafting recipes for the given player if null, otherwise resets the crafting recipes for the given item.
1227
+ */
1228
+ resetItemCraftingRecipes(playerId: PlayerId, itemName: PNull<string>): void
1229
+ /**
1230
+ * Removes crafting recipes
1231
+ *
1232
+ * @param playerId
1233
+ * @param itemName Removes all crafting recipes for the given player if null, otherwise removes the crafting recipes for the given item.
1234
+ */
1235
+ removeItemCraftingRecipes(playerId: PlayerId, itemName: PNull<string>): void
1236
+ /**
1237
+ * Check if a position is within a cubic rectangle
1238
+ *
1239
+ * @param coordsToCheck
1240
+ * @param pos1 position of one corner
1241
+ * @param pos2 position of opposite corner
1242
+ * @param addOneToMax
1243
+ */
1244
+ isInsideRect(coordsToCheck: number[], pos1: number[], pos2: number[], addOneToMax?: boolean): boolean
1245
+ /**
1246
+ * Get the entities in the rect between [minX, minY, minZ] and [maxX, maxY, maxZ]
1247
+ *
1248
+ * @param minCoords
1249
+ * @param maxCoords
1250
+ * @returns
1251
+ */
1252
+ getEntitiesInRect(minCoords: number[], maxCoords: number[]): EntityId[]
1253
+ /**
1254
+ * @param entityId
1255
+ */
1256
+ getEntityType(entityId: EntityId): EntityType
1257
+ /**
1258
+ * Gets the item name of a dropped item
1259
+ *
1260
+ * @param itemEId - The ID of the dropped item from createItemDrop
1261
+ * @returns
1262
+ */
1263
+ getItemDropName(itemEId: EntityId): PNull<ItemName>
1264
+ /**
1265
+ * Deletes all items dropped in the world
1266
+ */
1267
+ deleteAllItems(): void
1268
+ /**
1269
+ * Create a mob herd. A mob herd represents a collection of mobs that move together.
1270
+ */
1271
+ createMobHerd(): MobHerdId
1272
+ /**
1273
+ * Try to spawn a mob into the world at a given position. Returns null on failure.
1274
+ * WARNING: Either the "onPlayerAttemptSpawnMob" or the "onWorldAttemptSpawnMob" game callback will be called
1275
+ * depending on whether "spawnerId" is provided. Calling this function inside those callbacks risks infinite recursion.
1276
+ * @param mobType
1277
+ * @param x
1278
+ * @param y
1279
+ * @param z
1280
+ * @param opts Includes:
1281
+ * - mobHerdId The ID of this mob's herd. (A mob herd represents a collection of mobs that move together.)
1282
+ * - spawnerId The ID of the player who tried to spawn this mob.
1283
+ * - mobDbId A persistent ID for the mob. This can be useful when loading mob data from the database. If the DB ID is already taken, null will be returned.
1284
+ * - name If set, gives the mob a name that will be displayed as a nametag above their head.
1285
+ * - playSoundOnSpawn
1286
+ * - variation
1287
+ * - physicsOpts { width: number; height: number; collidesEntities: boolean }
1288
+ * @returns null if the mob could not be spawned.
1289
+ * This can happen when there are too many mobs in the world for the current number
1290
+ * of players in the lobby, or if the area is protected e.g. by spawn area protection.
1291
+ */
1292
+ attemptSpawnMob<TMobType extends MobType>(mobType: TMobType, x: number, y: number, z: number, opts?: MobSpawnOpts<TMobType>): PNull<MobId>
1293
+ /**
1294
+ * Dispose of a mob's state and remove them from the world without triggering "on death" flows.
1295
+ * Always succeeds.
1296
+ * @param mobId
1297
+ */
1298
+ despawnMob(mobId: MobId): void
1299
+ /**
1300
+ * Returns the current default value for a mob setting.
1301
+ *
1302
+ * @param mobType
1303
+ * @param setting
1304
+ */
1305
+ getDefaultMobSetting<TMobType extends MobType, TMobSetting extends MobSetting>(mobType: TMobType, setting: TMobSetting): MobSettings<TMobType>[TMobSetting]
1306
+ /**
1307
+ * Set the default value for a mob setting.
1308
+ * @param mobType
1309
+ * @param setting
1310
+ * @param value
1311
+ */
1312
+ setDefaultMobSetting<TMobType extends MobType, TMobSetting extends MobSetting>(mobType: TMobType, setting: TMobSetting, value: MobSettings<TMobType>[TMobSetting]): void
1313
+ /**
1314
+ * Get the current value of a mob setting for a specific mob.
1315
+ * @param mobId
1316
+ * @param setting
1317
+ * @param returnDefaultIfNotOverridden - If true, return the default setting if not overridden.
1318
+ */
1319
+ getMobSetting<TMobSetting extends MobSetting>(mobId: MobId, setting: TMobSetting, returnDefaultIfNotOverridden?: boolean): MobSettings<MobType>[TMobSetting]
1320
+ /**
1321
+ * Set the current value of a mob setting for a specific mob.
1322
+ * @param mobId
1323
+ * @param setting
1324
+ * @param value
1325
+ */
1326
+ setMobSetting<TMobSetting extends MobSetting>(mobId: MobId, setting: TMobSetting, value: MobSettings<MobType>[TMobSetting]): void
1327
+ /**
1328
+ * Get the number of mobs in the world.
1329
+ */
1330
+ getNumMobs(): number
1331
+ /**
1332
+ * Get the mob IDs of all mobs in the world.
1333
+ */
1334
+ getMobIds(): MobId[]
1335
+ /**
1336
+ * Gets the current AI state for the given mob.
1337
+ * @param mobId
1338
+ */
1339
+ getMobAiState(mobId: MobId): { state: MobAiState; params: MobAiStateParams<MobAiState> }
1340
+ /**
1341
+ * Sets the current AI state for the given mob.
1342
+ * Some AI states will require context such as the ID of the lifeform being chased.
1343
+ * @param mobId
1344
+ * @param state
1345
+ * @param params
1346
+ */
1347
+ setMobAiState<TState extends MobAiState>(mobId: MobId, state: TState, params: MobAiStateParams<TState>): void
1348
+ /**
1349
+ * Clears any aggro the mob has towards the given lifeform.
1350
+ * If the mob is currently chasing or running away from it, this also transitions the mob back to idle.
1351
+ * @param mobId
1352
+ * @param targetLifeformId
1353
+ */
1354
+ passifyHostility(mobId: MobId, targetLifeformId: LifeformId): void
1355
+ /**
1356
+ * Try to create a throwable entity.
1357
+ * Similar to creating a mesh entity and uses the same rate limiting.
1358
+ * However, this uses the predefined throwables system and physics used by throwable items with the game
1359
+ * Each throwable item has its own behaviour already, including default velocity, damage and gravity multipliers.
1360
+ *
1361
+ * @param throwerEId
1362
+ * @param itemName Must be an Item that is usually throwable in-engine
1363
+ * @param position Starting position
1364
+ * @param direction
1365
+ * @param velocityMult Multiplier for the default velocity of the throwable item
1366
+ * @param damageMult Multiplier for the default damage of the throwable item
1367
+ * @param gravityMult Multiplier for the default gravity of the throwable item
1368
+ * @param attributes item attributes (currently used only for the "Boomerag" item)
1369
+ * @returns null if throwable creation failed, otherwise the entity ID.
1370
+ */
1371
+ attemptCreateThrowable(throwerEId: EntityId, itemName: ThrowableItem, position: [number, number, number], direction: [number, number, number], velocityMult?: number, damageMult?: number, gravityMult?: number, attributes?: ItemAttributes): string
1372
+ /**
1373
+ * Delete a throwable entity before it automatically removes itself.
1374
+ * @param eId
1375
+ * @returns true if the entity was deleted, false if it was not a throwable entity
1376
+ */
1377
+ deleteThrowable(eId: EntityId): boolean
1378
+ /**
1379
+ * Try to create a mesh entity. This creates an entity whose mesh position is synced with clients.
1380
+ * Set entity position using setPosition
1381
+ * There is a limit to the number of mesh entities and throwables that can be created, with an even smaller limit for mesh entities with physics.
1382
+ * @param type
1383
+ * @param opts
1384
+ * @param name The default name for the nametag
1385
+ * @param physicsOptions Physics Options
1386
+ * @param initiatorId The entity that initiated the creation of the mesh entity.
1387
+ * @returns null if the entity creation failed, otherwise the entity ID.
1388
+ */
1389
+ attemptCreateMeshEntity<MeshType extends MeshEntityType>(type: MeshType, opts: MeshEntityOpts[MeshType], name?: string, physicsOptions?: MeshEntityPhysicsOpts, initiatorId?: EntityId): PNull<EntityId>
1390
+ /**
1391
+ * Update a mesh entity. If used on a non-mesh entity, will do nothing.
1392
+ *
1393
+ * @param eId
1394
+ * @param type
1395
+ * @param opts
1396
+ */
1397
+ updateMeshEntity<MeshType extends MeshEntityType>(eId: EntityId, type: MeshType, opts: MeshEntityOpts[MeshType]): void
1398
+ /**
1399
+ * Delete any non-player entity (mesh entity, mob, audio entity, item drop, throwable, etc.) and dispose of their state.
1400
+ * @param eId
1401
+ * @returns whether the entity's replicated state existed and was deleted
1402
+ */
1403
+ deleteEntity(eId: EntityId): boolean
1404
+ /**
1405
+ * Delete a mesh entity
1406
+ *
1407
+ * @param eId
1408
+ * @returns whether the api successfully deleted the meshEntity
1409
+ */
1410
+ deleteMeshEntity(eId: EntityId): boolean
1411
+ /**
1412
+ * Apply an impulse to an entity
1413
+ *
1414
+ * @param eId
1415
+ * @param xImpulse
1416
+ * @param yImpulse
1417
+ * @param zImpulse
1418
+ */
1419
+ applyImpulse(eId: EntityId, xImpulse: number, yImpulse: number, zImpulse: number): void
1420
+ /**
1421
+ * Get the velocity of an entity
1422
+ * Will return [0, 0, 0] if the entity doesn't have a physics body
1423
+ *
1424
+ * @param eId
1425
+ */
1426
+ getVelocity(eId: EntityId): Pos
1427
+ /**
1428
+ * Set the velocity of an entity
1429
+ *
1430
+ * @param eId
1431
+ * @param x
1432
+ * @param y
1433
+ * @param z
1434
+ */
1435
+ setVelocity(eId: EntityId, x: number, y: number, z: number): void
1436
+ /**
1437
+ * @deprecated use setEntityRotation
1438
+ * Set the heading for a server-auth entity.
1439
+ *
1440
+ * @param entityId
1441
+ * @param newHeading
1442
+ */
1443
+ setEntityHeading(entityId: EntityId, newHeading: number): void
1444
+ /**
1445
+ * @deprecated use getEntityRotation
1446
+ * Get the heading for a server-auth entity.
1447
+ *
1448
+ * @param entityId
1449
+ */
1450
+ getEntityHeading(entityId: EntityId): number
1451
+ /**
1452
+ * Get the rotation for a server-auth entity.
1453
+ *
1454
+ * @param entityId
1455
+ */
1456
+ getEntityRotation(entityId: EntityId): Pos
1457
+ /**
1458
+ * Set the rotation for a server-auth entity.
1459
+ *
1460
+ * @param entityId
1461
+ * @param xRotation
1462
+ * @param yRotation
1463
+ * @param zRotation
1464
+ */
1465
+ setEntityRotation(entityId: EntityId, xRotation: number, yRotation: number, zRotation: number): void
1466
+ /**
1467
+ * Get the amount of an item in an item entity
1468
+ *
1469
+ * @param itemId
1470
+ * @returns number
1471
+ */
1472
+ getItemAmount(itemId: EntityId): number
1473
+ /**
1474
+ * Set the amount of an item in an item entity
1475
+ *
1476
+ * @param itemId
1477
+ * @param newAmount
1478
+ */
1479
+ setItemAmount(itemId: EntityId, newAmount: number): void
1480
+ /**
1481
+ * Update the max players and soft max players matchmaking will use
1482
+ *
1483
+ * softMaxPlayers is the number of players that matchmaking will route to using "Quick Play".
1484
+ * Once the softMaxPlayers limit is reached, this lobby can only be joined by requesting the lobby name or joining a friend.
1485
+ *
1486
+ * maxPlayers is the absolute maximum: a lobby will not have more players than this.
1487
+ * Tip: softMaxPlayers should be around 90% of maxPlayers
1488
+ *
1489
+ * WARNING: This change is not immediate, as it takes a while for matchmaking to find out.
1490
+ * Also, this will not kick players out of the lobby if set to a lower value than the current player count.
1491
+ *
1492
+ * @param softMaxPlayers
1493
+ * @param maxPlayers
1494
+ */
1495
+ setMaxPlayers(softMaxPlayers: number, maxPlayers: number): void
1496
+ /**
1497
+ * Tell a player to disconnect from the current lobby and join a new one.
1498
+ *
1499
+ * To connect to a specific variation, format is \`gamename_variation\`.
1500
+ * For Custom Games, this will be \`classic_playerSchematic|XXXXXXXXXX\` or
1501
+ * \`classic_playerSchematic|XXXXXXXXXX|<varname>\` for a named sub-variation.
1502
+ *
1503
+ * NOTE: Players won't disconnect immediately (they may play an ad before being redirected).
1504
+ *
1505
+ * @param playerId
1506
+ * @param game Defaults to the current game.
1507
+ * @param lobbyName Defaults to "Quick Play"
1508
+ */
1509
+ matchmakePlayer(playerId: PlayerId, game?: string, lobbyName?: string): void
1510
+ /**
1511
+ * Create and register the UI for the requested quicktime event (QTE) to the screen.
1512
+ * Handle the result via the onPlayerFinishQTE engine callback.
1513
+ *
1514
+ * @param playerId
1515
+ * @param qteParameters - includes type and parameters
1516
+ * @returns an id that can be passed to deleteQTE
1517
+ */
1518
+ addQTE<T extends QTEType>(playerId: PlayerId, qteParameters: QTEClientParameters<T>): QTERequestId
1519
+ /**
1520
+ * Delete a quicktime event from the screen
1521
+ *
1522
+ * @param playerId
1523
+ * @param id Returned from the addQTE request you want to cancel
1524
+ */
1525
+ deleteQTE(playerId: PlayerId, id: QTERequestId): void
1526
+ /**
1527
+ * Check whether the player has any qteRequests
1528
+ */
1529
+ hasActiveQTE(playerId: PlayerId): boolean
1530
+ /**
1531
+ * Delete a request for a player.
1532
+ *
1533
+ * @param playerId
1534
+ * @param id Returned from the addUiRequest call you want to cancel
1535
+ */
1536
+ deleteUiRequest(playerId: PlayerId, id: UiRequestId): void
1537
+ /**
1538
+ * Show a message over the shop in the same place that a shop item's onBoughtMessage is shown.
1539
+ * Displays for a couple seconds before disappearing
1540
+ * Use case is to show a dynamic message when player buys an item
1541
+ *
1542
+ * @param playerId
1543
+ * @param info
1544
+ */
1545
+ sendOverShopInfo(playerId: PlayerId, info: string | CustomTextStyling): void
1546
+ /**
1547
+ * Open the shop UI for a player
1548
+ *
1549
+ * @param playerId
1550
+ * @param toggle Whether to close the shop if it's already open. Leave this off when opening from an
1551
+ * interaction: holding the interact button re-fires the alt action every ~50-150ms, so a toggle would
1552
+ * flicker the shop open and closed until release.
1553
+ * @param forceCategoryKey If set, will change the shop to this category
1554
+ * @param onlyIfNonEmpty If true, will only open the shop if the category (or shop, if no category is provided) is non-empty
1555
+ */
1556
+ openShop(playerId: PlayerId, toggle?: boolean, forceCategoryKey?: PNull<ShopCategoryKey>, onlyIfNonEmpty?: boolean): void
1557
+ /**
1558
+ * Apply an effect to a lifeform.
1559
+ * Can be an inbuilt effect E.g. "Speed" (speed boost), "Damage" (damage boost).
1560
+ * For inbuilt just pass the name of the effect and the functionality is handled in-engine.
1561
+ * For custom effect, you pass customEffectInfo. The icon can be an InGameIconName or a bloxd item name.
1562
+ * The custom effect onEndCb is an optional helper within which you can undo the effect you applied.
1563
+ * Note that onEndCb will not work for press to code boards, code blocks or world code.
1564
+ *
1565
+ * @param lifeformId
1566
+ * @param effectName
1567
+ * @param duration
1568
+ * @param customEffectInfo
1569
+ */
1570
+ applyEffect(lifeformId: LifeformId, effectName: string, duration: number | null, customEffectInfo: { icon?: IngameIconName | ItemName; onEndCb?: () => void; displayName?: string | TranslatedText } & Partial<InbuiltEffectInfo>): void
1571
+ /**
1572
+ * Check if a lifeform has an effect.
1573
+ *
1574
+ * @param lifeformId
1575
+ * @param name
1576
+ * @param atOrAboveLevel Checks whether the effect is at or above the given level
1577
+ */
1578
+ hasEffect(lifeformId: LifeformId, name: string, atOrAboveLevel?: number): boolean
1579
+ /**
1580
+ * Get the level of an effect on a lifeform, or 0 if they don't have it.
1581
+ *
1582
+ * @param lifeformId
1583
+ * @param name
1584
+ */
1585
+ getEffectLevel(lifeformId: LifeformId, name: string): number
1586
+ /**
1587
+ * Get all the effects currently applied to a lifeform.
1588
+ *
1589
+ * @param lifeformId
1590
+ */
1591
+ getEffects(lifeformId: LifeformId): string[]
1592
+ /**
1593
+ * Remove an effect from a lifeform.
1594
+ *
1595
+ * @param lifeformId
1596
+ * @param name
1597
+ */
1598
+ removeEffect(lifeformId: LifeformId, name: string): void
1599
+ /**
1600
+ * Change a part of a player's skin.
1601
+ * UGC code is restricted to cosmetics from packs with ugcSelectable; internal code can use any cosmetics.
1602
+ * @param playerId Player to change
1603
+ * @param cosmeticType Type of cosmetic
1604
+ * @param cosmeticName Chosen cosmetic, will be made lowercase automatically
1605
+ */
1606
+ changePlayerIntoSkin(playerId: PlayerId, cosmeticType: CosmeticType, cosmeticName: CosmeticName): void
1607
+ /**
1608
+ * Remove gamemode-applied skin from a player
1609
+ * @param playerId
1610
+ */
1611
+ removeAppliedSkin(playerId: PlayerId): void
1612
+ /**
1613
+ * Get a single equipped cosmetic for a player.
1614
+ * @param playerId
1615
+ * @param cosmeticType Type of cosmetic
1616
+ */
1617
+ getPlayerCosmetic(playerId: PlayerId, cosmeticType: CosmeticType): CosmeticName
1618
+ /**
1619
+ * Scale node of a player's mesh by 3d vector.
1620
+ * State from prior calls to this api is lost so if you want to have multiple nodes scaled, pass in all the scales at once.
1621
+ *
1622
+ * @param playerId
1623
+ * @param nodeScales
1624
+ */
1625
+ scalePlayerMeshNodes(playerId: PlayerId, nodeScales: EntityMeshScalingMap): void
1626
+ /**
1627
+ * Attach/detach mesh instances to/from an entity
1628
+ * @param eId
1629
+ * @param node node to attach to
1630
+ * @param type if null, detaches mesh from this node
1631
+ * @param opts
1632
+ * @param offset
1633
+ * @param rotation
1634
+ */
1635
+ updateEntityNodeMeshAttachment<MeshType extends MeshEntityType>(eId: EntityId, node: EntityNamedNode, type: PNull<MeshType>, opts?: MeshEntityOpts[MeshType], offset?: Pos, rotation?: Pos): void
1636
+ /**
1637
+ * Set the pose of the player
1638
+ * @param playerId
1639
+ * @param pose
1640
+ * @param poseOffset
1641
+ */
1642
+ setPlayerPose(playerId: PlayerId, pose: PlayerPose, poseOffset?: Pos): void
1643
+ /**
1644
+ * Set physics state of player (vehicle type and tier).
1645
+ *
1646
+ * For types that have tiers (e.g. BOAT, GLIDER, CAR), a \`tier\` of \`null\` defaults to the first
1647
+ * tier (0). Types without tiers (e.g. DEFAULT) must be given a \`null\` tier.
1648
+ * @param playerId
1649
+ * @param physicsState
1650
+ * @param positionOffset - Optional offset to adjust the player's collision box
1651
+ */
1652
+ setPlayerPhysicsState(playerId: PlayerId, physicsState: PlayerPhysicsState<PhysicsType>, positionOffset?: Pos): void
1653
+ /**
1654
+ * Get physics state for player
1655
+ * @param playerId
1656
+ */
1657
+ getPlayerPhysicsState(playerId: PlayerId): PlayerPhysicsState<PhysicsType>
1658
+ /**
1659
+ * Put a player in a vehicle: teleport them to it, seat them at its \`riderOffset\` and give them the
1660
+ * physics it confers. The vehicle's own physics state and rider offset are read from it, so a spawned
1661
+ * vehicle and a rideable mob are entered the same way.
1662
+ *
1663
+ * Anyone already riding the vehicle is thrown off, and the player leaves whatever they were riding.
1664
+ * @param playerId
1665
+ * @param vehicleEId A spawned vehicle or a rideable mob.
1666
+ */
1667
+ setPlayerVehicle(playerId: PlayerId, vehicleEId: EntityId): void
1668
+ /**
1669
+ * Take a player off whatever they are riding, dropping them where it is. Does nothing if they are
1670
+ * not riding anything.
1671
+ * @param playerId
1672
+ */
1673
+ exitPlayerVehicle(playerId: PlayerId): void
1674
+ /**
1675
+ * The current value of a physics setting for a specific vehicle entity: the value set via
1676
+ * \`setVehicleSetting\` if overridden, otherwise (when \`returnDefaultIfNotOverridden\`) the type/tier
1677
+ * default from the vehicle's physics state. Mirrors \`getMobSetting\`.
1678
+ *
1679
+ * The one default not read from the type/tier is a mob's \`riderOffset\`, which comes from its ride height.
1680
+ *
1681
+ * A per-block setting (e.g. \`"IceCanAutoStep"\`) is \`undefined\` when that block is unlisted, which means
1682
+ * the block does not change the setting rather than that the setting is off.
1683
+ */
1684
+ getVehicleSetting<TSetting extends SettableVehicleSetting>(vehicleEId: EntityId, setting: TSetting, returnDefaultIfNotOverridden?: boolean): SettableVehicleSettingValue<TSetting>
1685
+ /**
1686
+ * Override a physics setting for a specific vehicle entity, replacing the type/tier default for that
1687
+ * vehicle's rider. The override is stored on the shared Bloxd and, when the vehicle currently has a
1688
+ * rider, replicated to that rider's client. Mirrors \`setMobSetting\`.
1689
+ *
1690
+ * A setting can also be overridden for one block by naming the block first, e.g.
1691
+ * \`setVehicleSetting(boatId, "IceCanAutoStep", true)\`. That is stored as an entry of the matching
1692
+ * \`<setting>ByBlock\` record, which the physics tick reads as a precomputed block lookup.
1693
+ */
1694
+ setVehicleSetting<TSetting extends SettableVehicleSetting>(vehicleEId: EntityId, setting: TSetting, value: SettableVehicleSettingValue<TSetting>): void
1695
+ /**
1696
+ * Try to spawn a rideable vehicle, which players can mount with an alt action.
1697
+ * There is a limit to the number of mesh entities with physics that can be created.
1698
+ * WARNING: Either the "onPlayerAttemptSpawnVehicle" or the "onWorldAttemptSpawnVehicle" game callback will be called
1699
+ * depending on whether "spawnerId" is provided. Calling this function inside those callbacks risks infinite recursion.
1700
+ * @param vehicleType
1701
+ * @param x
1702
+ * @param y
1703
+ * @param z
1704
+ * @param opts Includes:
1705
+ * - spawnerId The ID of the player who spawned the vehicle. The vehicle faces away from them.
1706
+ * @returns null if the vehicle could not be spawned, otherwise the entity ID of the vehicle.
1707
+ */
1708
+ attemptSpawnVehicle(vehicleType: MeshEntityVehicleType, x: number, y: number, z: number, opts?: VehicleSpawnOpts): PNull<EntityId>
1709
+ /**
1710
+ * Dispose of a vehicle's state and remove them from the world.
1711
+ * Always succeeds.
1712
+ * @param vehicleId
1713
+ */
1714
+ despawnVehicle(vehicleId: EntityId): void
1715
+ /**
1716
+ * Add following entity to player
1717
+ * @param playerId
1718
+ * @param eId
1719
+ * @param offset
1720
+ * @param followsPlayerRotation
1721
+ */
1722
+ addFollowingEntityToPlayer(playerId: PlayerId, eId: EntityId, offset?: number[], followsPlayerRotation?: boolean): void
1723
+ /**
1724
+ * Remove following entity from player
1725
+ * @param playerId
1726
+ * @param entityEId
1727
+ */
1728
+ removeFollowingEntityFromPlayer(playerId: PlayerId, entityEId: EntityId): void
1729
+ /**
1730
+ * Set camera zoom for a player
1731
+ * @param playerId
1732
+ * @param zoom
1733
+ */
1734
+ setCameraZoom(playerId: PlayerId, zoom: number): void
1735
+ /**
1736
+ * @param playerId hears the sound
1737
+ * @param soundName Can also be a prefix. If so, a random sound with that prefix will be played
1738
+ * @param volume 0-1. If it's too quiet and volume is 1, normalise your sound in audacity
1739
+ * @param rate The speed of playback. Also affects pitch. 0.5-4. Lower playback = lower pitch
1740
+ * Good for varying the sound. E.g. item pickup sound has a random rate between 1 and 1.5.
1741
+ * @param posSettings
1742
+ * {playerIdOrPos: PlayerId | number[], maxHearDist: number, refDistance: number}
1743
+ * playerIdOrPos: The player the sound originates from, or the position of the sound
1744
+ * maxHearDist: sound is not played if player is further than this. Default 15
1745
+ * refDistance: higher means the sound decreases less in volume with distance. Default 3. Hitting is 4. Guns are 10
1746
+ *
1747
+ */
1748
+ playSound(playerId: PlayerId, soundName: string, volume: number, rate: number, posSettings?: { playerIdOrPos: PlayerId | number[]; maxHearDist?: number; refDistance?: number; }): void
1749
+ /**
1750
+ * See documentation for api.playSound
1751
+ */
1752
+ broadcastSound(soundName: string, volume: number, rate: number, posSettings?: { playerIdOrPos: PlayerId | number[]; maxHearDist?: number; refDistance?: number; }, exceptPlayerId?: PlayerId): void
1753
+ /**
1754
+ * See documentation for api.playSound
1755
+ */
1756
+ playClientPredictedSound(soundName: string, volume: number, rate: number, posSettings?: { playerIdOrPos: PlayerId | number[]; maxHearDist?: number; refDistance?: number; }, predictedBy?: PlayerId): void
1757
+
1758
+ calcExplosionForce(eId: EntityId, explosionType: ExplosionType, knockbackFactor: number, explosionRadius: number, explosionPos: number[], ignoreProjectiles: boolean): { force: Pos; forceFrac: number; }
1759
+ /**
1760
+ * Add a custom killfeed message to the killfeed
1761
+ * @param killer - The entity ID or a custom name and colour for the killer
1762
+ * @param victim - The entity ID or a custom name and colour for the victim
1763
+ * @param withItem - The item used
1764
+ */
1765
+ addCustomKillfeedMessage(killer: { eId: EntityId } | { name: string; colour: string }, victim: { eId: EntityId } | { name: string; colour: string }, withItem: string): void
1766
+ /**
1767
+ * Get the position of a player's target block and the block adjacent to it (e.g. where a block would be placed)
1768
+ *
1769
+ *
1770
+ * Note: This position is a tick ahead of the client's block target info (noa.targetedBlock),
1771
+ * since the client updates the blocktarget before the entities tick (and since it uses the renderposition of the camera)
1772
+ *
1773
+ * This normally doesn't matter but if you are client predicting something based on noa.targetedBlock
1774
+ * (currently only applicable to in-engine code), you should not verify using this
1775
+ *
1776
+ * @param playerId
1777
+ */
1778
+ getPlayerTargetInfo(playerId: PlayerId): { position: Pos; normal: Pos; adjacent: Pos }
1779
+ /**
1780
+ * Get the position of a player's camera and the direction (both in Euclidean and spherical coordinates) they are attempting to use an item.
1781
+ * The camPos has the same limitations described in getPlayerTargetInfo
1782
+ *
1783
+ * @param playerId
1784
+ */
1785
+ getPlayerFacingInfo(playerId: PlayerId): { camPos: Pos; dir: Pos; angleDir: AngleDir; moveHeading: number }
1786
+ /**
1787
+ * Raycast for a block in the world.
1788
+ * Given a position and a direction, find the first block that the "ray" hits.
1789
+ *
1790
+ * @param fromPos
1791
+ * @param dirVec
1792
+ */
1793
+ raycastForBlock(fromPos: number[], dirVec: number[]): BlockRaycastResult
1794
+ /**
1795
+ * Prevents the player from taking fall damage next time they land on the ground
1796
+ * @param playerId
1797
+ */
1798
+ preventFallDamageNextGrounding(playerId: PlayerId): void
1799
+ /**
1800
+ * Check whether a player is crouching
1801
+ *
1802
+ * @param playerId
1803
+ */
1804
+ isPlayerCrouching(playerId: PlayerId): boolean
1805
+ /**
1806
+ * Get the aura info for a player
1807
+ * @param playerId
1808
+ */
1809
+ getAuraInfo(playerId: PlayerId): { level: number; totalAura: number; auraPerLevel: number }
1810
+ /**
1811
+ * Sets the total aura for a player. Will not go over max level or under 0
1812
+ * @param playerId
1813
+ * @param totalAura
1814
+ */
1815
+ setTotalAura(playerId: PlayerId, totalAura: number): void
1816
+ /**
1817
+ * Set the aura level for a player - shortcut for setTotalAura(level * auraPerLevel)
1818
+ * @param playerId
1819
+ * @param level
1820
+ */
1821
+ setAuraLevel(playerId: PlayerId, level: number): void
1822
+ /**
1823
+ * Add (or remove if negative) aura to a player. Will not go over max level or under 0
1824
+ * @param playerId
1825
+ * @param auraDiff
1826
+ * @returns The actual change in aura
1827
+ */
1828
+ applyAuraChange(playerId: PlayerId, auraDiff: number): number
1829
+ /**
1830
+ * Updates the particle systems of multiple mesh entities at specified nodes
1831
+ * @param updates
1832
+ */
1833
+ updateMeshParticleSystems(updates: MeshParticleSystemUpdates): void
1834
+ /**
1835
+ * Gets a database value that is saved per lobby.
1836
+ * @param key
1837
+ */
1838
+ getLobbyDbValue(key: string): PNull<string | number>
1839
+ /**
1840
+ * Sets a database value that is saved per lobby. This persists between sessions.
1841
+ * @param key
1842
+ * @param value
1843
+ */
1844
+ setLobbyDbValue(key: string, value: string | number): void
1845
+ /**
1846
+ * Deletes a database value that is saved per lobby.
1847
+ * @param key
1848
+ */
1849
+ deleteLobbyDbValue(key: string): void
1850
+ /**
1851
+ * Deletes all database values that are saved per lobby.
1852
+ */
1853
+ deleteAllLobbyDbValues(): void
1854
+ /**
1855
+ * Gets a database value that is saved per player.
1856
+ * @param playerId
1857
+ * @param key
1858
+ */
1859
+ getPlayerDbValue(playerId: PlayerId, key: string): PNull<string | number>
1860
+ /**
1861
+ * Sets a database value that is saved per player. For custom games this persists between sessions and
1862
+ * between lobbies, and is shared across all of the game's variations (e.g. a hub and its sub-modes).
1863
+ * @param playerId
1864
+ * @param key
1865
+ * @param value
1866
+ */
1867
+ setPlayerDbValue(playerId: PlayerId, key: string, value: string | number): void
1868
+ /**
1869
+ * Deletes a database value that is saved per player.
1870
+ * @param playerId
1871
+ * @param key
1872
+ */
1873
+ deletePlayerDbValue(playerId: PlayerId, key: string): void
1874
+ /**
1875
+ * Deletes all database values that are saved per player, including persisted currencies.
1876
+ * @param playerId
1877
+ */
1878
+ deleteAllPlayerDbValues(playerId: PlayerId): void
1879
+ /**
1880
+ * Dynamically define a currency for a player and show it on the HUD.
1881
+ * Amounts will persist between sessions if \`persistent\` is set to true.
1882
+ * Persistent currencies count towards db length limits.
1883
+ *
1884
+ * Example usage:
1885
+ * \`\`\`js
1886
+ * api.setCurrency(myId, "myCurrency", { amount: 100, icon: "coins", iconColour: "blue", persistent: true })
1887
+ * \`\`\`
1888
+ *
1889
+ * @param playerId
1890
+ * @param currencyId
1891
+ * @param info
1892
+ */
1893
+ setCurrency(playerId: PlayerId, currencyId: string, info: UgcCurrencyInfo): void
1894
+ /**
1895
+ * Delete a currency from a player. This will make the currency unknown to the player.
1896
+ * @param playerId
1897
+ * @param currencyId
1898
+ */
1899
+ deleteCurrency(playerId: PlayerId, currencyId: string): void
1900
+ /**
1901
+ * Set the amount of a currency a player has. For persistent currencies, amount/subtext count towards db length limits.
1902
+ * @param playerId
1903
+ * @param currencyId
1904
+ * @param amount
1905
+ * @param subtext
1906
+ */
1907
+ setCurrencyAmount(playerId: PlayerId, currencyId: string, amount: number, subtext?: string | CustomTextStyling): void
1908
+ /**
1909
+ * Give a player an amount of currency. Can be negative to remove money.
1910
+ * @param playerId
1911
+ * @param currencyId
1912
+ * @param amount
1913
+ */
1914
+ giveCurrencyAmount(playerId: PlayerId, currencyId: string, amount: number): void
1915
+ /**
1916
+ * Set a default value to be returned by your callback code if it throws an error.
1917
+ *
1918
+ * @param cbName The name of the callback to set the default value for.
1919
+ * @param value The default value to return.
1920
+ */
1921
+ setCallbackValueFallback(cbName: UserCallbacks, value: any): void
1922
+ /**
1923
+ * Set the gamemode of a player. This is persistent across lobbies for custom games.
1924
+ *
1925
+ * @param playerId The ID of the player to set the gamemode of.
1926
+ * @param gamemode The gamemode to set the player to.
1927
+ */
1928
+ setPlayerGamemode(playerId: PlayerId, gamemode: WorldGamemode): void
1929
+ /**
1930
+ * Get the gamemode of a player.
1931
+ *
1932
+ * @param playerId The ID of the player to get the gamemode of.
1933
+ * @returns The gamemode of the player.
1934
+ */
1935
+ getPlayerGamemode(playerId: PlayerId): WorldGamemode
1936
+ /**
1937
+ * Returns true if your code is about to be interrupted for exceeding its time budget.
1938
+ * Use this to break up long-running code into smaller chunks.
1939
+ *
1940
+ *
1941
+ * ### Example:
1942
+ * \`\`\`js
1943
+ * // Resume from where we stopped last time (or 0 on the first run)
1944
+ * let savedLoopCounter = 0
1945
+ *
1946
+ * // ...
1947
+ *
1948
+ * for (let i = savedLoopCounter; i < 1000; i++) {
1949
+ * if (api.isNearInterrupt()) {
1950
+ * // Out of time - remember our progress and stop before getting killed
1951
+ * savedLoopCounter = i
1952
+ * break
1953
+ * }
1954
+ *
1955
+ * someExpensiveFunction()
1956
+ * }
1957
+ * \`\`\`
1958
+ */
1959
+ isNearInterrupt(): boolean
1960
+ /**
1961
+ * Schedule small text to be displayed in the middle of the screen (middleTextLower).
1962
+ * This text will be removed after the duration.
1963
+ * Stacking queued texts will schedule them to be displayed one after the other.
1964
+ * NOTE: Overriding the middleTextLower client option may cause queued texts to be displayed incorrectly.
1965
+ *
1966
+ * @param playerId The ID of the player to display the text to.
1967
+ * @param text The text to display.
1968
+ * @param duration The duration of the text in milliseconds.
1969
+ * @returns The ID of the queued command.
1970
+ */
1971
+ queueMiddleTextLower(playerId: PlayerId, text: string | CustomTextStyling, duration: number): QueuedCommandId
1972
+ /**
1973
+ * Schedule large text to be displayed in the middle of the screen (middleTextUpper).
1974
+ * This text will be removed after the duration.
1975
+ * Stacking queued texts will schedule them to be displayed one after the other.
1976
+ * NOTE: Overriding the middleTextUpper client option may cause queued texts to be displayed incorrectly.
1977
+ *
1978
+ * @param playerId The ID of the player to display the text to.
1979
+ * @param text The text to display.
1980
+ * @param duration The duration of the text in milliseconds.
1981
+ * @returns The ID of the queued command.
1982
+ */
1983
+ queueMiddleTextUpper(playerId: PlayerId, text: string | CustomTextStyling, duration: number): QueuedCommandId
1984
+ /**
1985
+ * Schedule text to be displayed in the crosshair.
1986
+ * This text will be removed after the duration.
1987
+ * Stacking queued texts will schedule them to be displayed one after the other.
1988
+ * NOTE: Overriding the crosshairText client option may cause queued texts to be displayed incorrectly.
1989
+ *
1990
+ * @param playerId The ID of the player to display the text to.
1991
+ * @param text The text to display.
1992
+ * @param duration The duration of the text in milliseconds.
1993
+ * @returns The ID of the queued command.
1994
+ */
1995
+ queueCrosshairText(playerId: PlayerId, text: string | CustomTextStyling, duration: number): QueuedCommandId
1996
+ /**
1997
+ * Get the status of a queued command.
1998
+ *
1999
+ * @param id The ID of the queued command to get the status of.
2000
+ * @returns NOT_IN_QUEUE, WAITING_TO_RUN, or CURRENTLY_RUNNING.
2001
+ */
2002
+ getQueuedStatus(id: QueuedCommandId): QueuedStatusString
2003
+ /**
2004
+ * Remove a queued command from the queue.
2005
+ *
2006
+ * @param id The ID of the queued command to remove.
2007
+ */
2008
+ removeFromQueue(id: QueuedCommandId): void
2009
+ /**
2010
+ * Add a request for the player to answer in the top right corner. E.g. accepting or denying a tprequest.
2011
+ *
2012
+ * Use onUiRequestResponded to handle the response.
2013
+ *
2014
+ * Example Usage:
2015
+ * \`\`\`js
2016
+ * const myRequestId = api.addUiRequest(playerId, {
2017
+ * type: "standard",
2018
+ * title: "Do you want to join the game?",
2019
+ * }, 5000)
2020
+ *
2021
+ * onUiRequestResponded = (playerId, uiRequestId, response) => {
2022
+ * if (uiRequestId === myRequestId) {
2023
+ * api.log(response)
2024
+ * }
2025
+ * }
2026
+ * \`\`\`
2027
+ *
2028
+ *
2029
+ * @param playerId The ID of the player to add the request to.
2030
+ * @param parameters The parameters of the request.
2031
+ * @param timeoutAfterMs The timeout after which the request will be automatically deleted. A response will not be given and onUiRequestResponded will not be called.
2032
+ * @returns The ID of the request. Pass into deleteUiRequest or cross-reference with onUiRequestResponded.
2033
+ */
2034
+ addUiRequest(playerId: PlayerId, parameters: UiRequestClientParameters, timeoutAfterMs?: number): UiRequestId
2035
+ /**
2036
+ * Add a request for the player to answer in the form of a popup. This blocks the player from doing anything else until they respond.
2037
+ *
2038
+ * Use onUiRequestResponded to handle the response.
2039
+ *
2040
+ * Example Usage:
2041
+ * \`\`\`js
2042
+ * const myRequestId = api.addUiRequestPopup(playerId, "Do you want to join the game?")
2043
+ *
2044
+ * onUiRequestResponded = (playerId, uiRequestId, response) => {
2045
+ * if (uiRequestId === myRequestId) {
2046
+ * api.log(response)
2047
+ * }
2048
+ * }
2049
+ * \`\`\`
2050
+ *
2051
+ * @param playerId The ID of the player to add the request to.
2052
+ * @param requestText The text of the request.
2053
+ * @returns The ID of the request, or null if the request was rate limited. Pass into deleteUiRequest or cross-reference with onUiRequestResponded.
2054
+ */
2055
+ addUiRequestPopup(playerId: PlayerId, requestText: string): PNull<UiRequestId>
2056
+ /**
2057
+ * Matchmake a player into a sub-variation of the current custom game.
2058
+ * Pass \`"default"\` for the default variation.
2059
+ *
2060
+ * @param playerId The player to matchmake
2061
+ * @param varname Sub-variation name (\`[A-Za-z0-9_-]\`, 1-32 chars), or \`"default"\`
2062
+ */
2063
+ matchmakeToVariation(playerId: PlayerId, varname: string): void
2064
+ /**
2065
+ * Get the current sub-variation name.
2066
+ * Returns \`"default"\` when there is no named sub-variation.
2067
+ */
2068
+ getVariation(): string
2069
+ /**
2070
+ * Log a message to chat.
2071
+ */
2072
+ log(message: any): void
2073
+
2074
+ }
2075
+
2076
+ export interface Console {
2077
+ /** Log a message to chat. */
2078
+ log(message: any): void
2079
+ }
2080
+
2081
+ export type EntityId = string
2082
+
2083
+ export type Pos = [number, number, number]
2084
+
2085
+ export type LifeformId = EntityId
2086
+
2087
+ export type PlayerId = LifeformId
2088
+
2089
+ export type PNull<T> = T | null
2090
+
2091
+ export type PlayerDbId = string
2092
+
2093
+ export type LifeformBodyPart = (_TypeOf["lifeformBodyParts"])[number]
2094
+
2095
+ export interface PlayerAttemptDamageOtherPlayerOpts {
2096
+ eId: PlayerId
2097
+ hitEId: PlayerId
2098
+ attemptedDmgAmt: number
2099
+ withItem: string
2100
+ bodyPartHit?: LifeformBodyPart
2101
+ attackDir?: number[]
2102
+ showCritParticles?: boolean
2103
+ reduceVerticalKbVelocity?: boolean
2104
+ horizontalKbMultiplier?: number
2105
+ verticalKbMultiplier?: number
2106
+ broadcastEntityHurt?: boolean
2107
+ attackCooldownSettings?: PNull<{ type: string; cooldownMs: number }>
2108
+ hittingSoundOverride?: HittingSoundOverride
2109
+ ignoreOtherEntitySettingCanAttack?: boolean
2110
+ isTrueDamage?: boolean
2111
+ // The damaging playerDbId. If null, will default to the dbId of \`eId\`
2112
+ damagerDbId?: PNull<PlayerId>
2113
+ }
2114
+
2115
+ export type HittingSoundOverride = { sound: string; volume: number; pitch: number }
2116
+
2117
+ export type ItemName = string
2118
+
2119
+ export type EnchantmentAttributes = {
2120
+ enchantments: Partial<Record<EnchantmentPerk, number>>
2121
+ enchantmentTier: EnchantmentTier
2122
+ id: string
2123
+ }
2124
+
2125
+ export type EnchantmentPerk = (_TypeOf["enchantmentPerks"])[number]
2126
+
2127
+ export type EnchantmentTier = (_TypeOf["enchantmentTiers"])[number]
2128
+
2129
+ export type CustomTextStyling = (string | EntityName | TranslatedText | StyledIcon | StyledText | ProgressBar | StyledKeyBinding)[]
2130
+
2131
+ export type TranslatedText = {
2132
+ translationKey: string
2133
+ params?: Record<string, string | number | boolean | EntityName>
2134
+ }
2135
+
2136
+ export type EntityName = {
2137
+ entityName: string
2138
+ ranks?: Readonly<Rank[]>
2139
+ style?: {
2140
+ color?: string
2141
+ colour?: string
2142
+ }
2143
+ }
2144
+
2145
+ export type Rank = (_TypeOf["ranks"])[number]
2146
+
2147
+ export type StyledIcon = {
2148
+ icon: string
2149
+ style?: {
2150
+ color?: string
2151
+ colour?: string
2152
+ fontSize?: FontSize
2153
+ opacity?: number
2154
+ }
2155
+ }
2156
+
2157
+ export type FontSize = string
2158
+
2159
+ export type StyledText = {
2160
+ str: string | EntityName | TranslatedText
2161
+ style?: TextStyle
2162
+ }
2163
+
2164
+ export type TextStyle = {
2165
+ color?: string
2166
+ colour?: string
2167
+ fontWeight?: string
2168
+ fontSize?: FontSize
2169
+ fontStyle?: string
2170
+ opacity?: number
2171
+ }
2172
+
2173
+ export type ProgressBar = {
2174
+ // Mandatory discriminator: marks this CustomTextStyling item as a progress bar.
2175
+ type: "ProgressBar"
2176
+ progress: number
2177
+ width?: FontSize
2178
+ height?: FontSize
2179
+ colours?: string[]
2180
+ backgroundColour?: string
2181
+ }
2182
+
2183
+ export type StyledKeyBinding = {
2184
+ type: "StyledKeyBinding"
2185
+ action: NoaAction
2186
+ style?: TextStyle
2187
+ }
2188
+
2189
+ export type NoaAction = (_TypeOf["noaActions"])[number]
2190
+
2191
+ export type ClientOption = keyof ClientOptions
2192
+
2193
+ export type EarthSkyBox = {
2194
+ type: "earth"
2195
+ inclination?: number
2196
+ turbidity?: number
2197
+ infiniteDistance?: boolean
2198
+ luminance?: number
2199
+ // Sky appearance (light intensity); higher = more saturated sky.
2200
+ rayleigh?: number
2201
+ // Mie scattering coefficient in [0, 0.1]; affects mieDirectionalG impact.
2202
+ mieCoefficient?: number
2203
+ // Amount of haze particles per Mie scattering theory.
2204
+ mieDirectionalG?: number
2205
+ // Distance of the sun from the active scene camera.
2206
+ distance?: number
2207
+ // When \`useSunPosition\` is true, this overrides \`inclination\` + \`azimuth\`.
2208
+ sunPosition?: Vec3
2209
+ useSunPosition?: boolean
2210
+ xCameraOffset?: number
2211
+ yCameraOffset?: number
2212
+ zCameraOffset?: number
2213
+ // Direction the sky considers "up"; defaults to [0, 1, 0].
2214
+ up?: Vec3
2215
+ // Dither the sky to reduce visible banding.
2216
+ dithering?: boolean
2217
+ azimuth?: number
2218
+ // Not part of sky model by default; heavily tint to a vertex color
2219
+ vertexTint?: Vec3
2220
+ }
2221
+
2222
+ export type Vec3 = [number, number, number]
2223
+
2224
+ export type LobbyLeaderboardInfo = Record<
2225
+ string,
2226
+ {
2227
+ displayName?: string | CustomTextStyling
2228
+ hidden?: boolean
2229
+ sortOrder?: "ascending" | "descending" // No value means descending
2230
+ sortPriority?: number
2231
+ }
2232
+ >
2233
+
2234
+ export type TextWithDisplayOptions = {
2235
+ showBackground?: boolean // Defaults to true. When false, the option's background panel is hidden.
2236
+ content: string | CustomTextStyling
2237
+ }
2238
+
2239
+ export type HeaderChip = string | CustomTextStyling | TextWithDisplayOptions
2240
+
2241
+ export type GunshotOrigin = "default" | "head"
2242
+
2243
+ export type ShopCategoryKey = string
2244
+
2245
+ export type ShopItemKey = string
2246
+
2247
+ export type ShopItem = {
2248
+ image: string
2249
+ schematicId?: SchematicId
2250
+ cost?: number
2251
+ currency?: string
2252
+ amount?: number // Display amount shown on the shop tile image (0 and 1 are not displayed)
2253
+ imageColour?: string
2254
+ canBuy?: boolean
2255
+ isSelected?: boolean
2256
+ buyButtonText?: string | CustomTextStyling
2257
+ customTitle?: string | CustomTextStyling
2258
+ description?: string | CustomTextStyling
2259
+ onBoughtMessage?: string | CustomTextStyling
2260
+ redDot?: boolean
2261
+ forceRemoveRedDot?: boolean
2262
+ isRewardedAd?: boolean
2263
+ badge?: { text: string | CustomTextStyling; type: ShopItemBadgeType }
2264
+ userInput?: ShopItemUserInput
2265
+ enchant?: {
2266
+ tier: EnchantmentTier
2267
+ enchantments: Partial<Record<EnchantmentPerk, number>>
2268
+ enchantmentData?: Record<string, { icon?: string; description?: string }>
2269
+ }
2270
+
2271
+ // Not defined on client, must be defined on server
2272
+ boughtCallback?: (
2273
+ playerId: PlayerId,
2274
+ cost: number,
2275
+ currency: string,
2276
+ categoryKey: ShopCategoryKey,
2277
+ itemKey: ShopItemKey,
2278
+ userInput: string,
2279
+ amount: number | undefined,
2280
+ ) => void
2281
+ sell?: boolean // Optional, defaults to false. If true, the sign of "cost" is flipped. So a "cost" of -25 would give the player 25 currency AND be displayed as "25" (instead of -25)
2282
+ sortPriority?: number // Descending, bigger number means closer to the top
2283
+ hidden?: boolean
2284
+ }
2285
+
2286
+ export type ShopItemUserInput =
2287
+ | { type: "text"; placeholderText?: string; wordCharsOnly?: boolean; initialValue?: string } // wordCharsOnly defaults to false. If true, only allows \w character (alphanumeric and _). initialValue always takes precedence as the text input value when set.
2288
+ | { type: "number"; placeholderText?: string; initialValue?: string }
2289
+ | {
2290
+ type: "dropdown"
2291
+ dropdownOptions: readonly (string | { option: string; cost: number })[]
2292
+ shouldResetSelectionOnOptionsChange?: boolean // Defaults to false. If true, the selection will reset to the first option when dropdownOptions changes.
2293
+ initialValue?: string
2294
+ autoSubmit?: boolean // Defaults to false. If true, the dropdown will automatically submit when the user selects an option.
2295
+ }
2296
+ | { type: "player"; excludedPlayers?: PlayerId[] } // Defaults to excluding the current player
2297
+ | { type: "color"; initialValue?: string }
2298
+
2299
+ export type SchematicId = string
2300
+
2301
+ export type ShopItemBadgeType = (_TypeOf["shopItemBadgeTypes"])[number]
2302
+
2303
+ export type ShopCategoryConfig = Partial<{
2304
+ autoSelectCategory: boolean
2305
+ customTitle: string // Supports translation keys and ordinary text
2306
+ redDot: boolean
2307
+ forceRemoveRedDot: boolean
2308
+ sortPriority: number
2309
+ description: string | CustomTextStyling
2310
+ }>
2311
+
2312
+ export type OtherEntitySetting = keyof OtherEntitySettings
2313
+
2314
+ export type EntityMeshScalingMap = {
2315
+ [key in EntityNamedNode]?: number[]
2316
+ }
2317
+
2318
+ export type EntityNamedNode = PlayerMeshNamedNode
2319
+
2320
+ export type PlayerMeshNamedNode = (_TypeOf["playerMeshNamedNodes"])[number]
2321
+
2322
+ export type LobbyLeaderboardValues = Record<string, string | number | CustomTextStyling>
2323
+
2324
+ export type ChatTags = CustomTextStyling[]
2325
+
2326
+ export type NameTagInfo = {
2327
+ backgroundColor?: string
2328
+ content?: (CustomTextStyling[number] | RankInfo)[]
2329
+ subtitle?: (CustomTextStyling[number] | RankInfo)[]
2330
+ subtitleBackgroundColor?: string
2331
+ minLighting?: number
2332
+ healthbar?: HealthbarInfo
2333
+ border?: NameTagBorder
2334
+ }
2335
+
2336
+ export type RankInfo = {
2337
+ // Font Awesome icon name
2338
+ icon: string
2339
+ mainRGB: string
2340
+ // Defaults to mainRGB
2341
+ bracketRGB?: string
2342
+ chatTag: {
2343
+ str: string
2344
+ // Defaults to mainRGB
2345
+ strRGB?: string
2346
+ }[]
2347
+ // Defaults to none
2348
+ nameTag: {
2349
+ // Defaults to normal name colour (white)
2350
+ iconRGB?: string
2351
+ // Defaults to none
2352
+ iconShadowRGB?: string
2353
+ }
2354
+ visible: boolean // If false, this rank will not be shown in the player list or in the chat
2355
+ }
2356
+
2357
+ export type HealthbarInfo = Readonly<{
2358
+ // Controls when the healthbar is shown.
2359
+ // "onDamage" (default) shows it for a few seconds after the entity takes damage.
2360
+ display?: HealthbarDisplay
2361
+ height?: FontSize
2362
+ // Track colour behind the depleting bar. Undefined leaves the background transparent.
2363
+ backgroundColour?: string
2364
+ // Fill colour of the bar. Either a flat colour, or a gradient keyed on health fraction.
2365
+ // Undefined uses the default green -> orange -> red depleting gradient.
2366
+ foregroundColour?: string | readonly HealthbarColourGradient[]
2367
+ }>
2368
+
2369
+ export type NameTagBorder = Readonly<{
2370
+ colour: string
2371
+ // Visual preset:
2372
+ // - "solid": a flat outline.
2373
+ // - "glow": an outline with an outer glow - reads as powerful/elite, ideal for bosses.
2374
+ // - "double": two concentric outlines for an ornate, high-stakes look.
2375
+ style?: NameTagBorderStyle
2376
+ width?: FontSize
2377
+ applyTo?: NameTagBorderTarget
2378
+ }>
2379
+
2380
+ export type HealthbarDisplay = (_TypeOf["healthbarDisplays"])[number]
2381
+
2382
+ export type HealthbarColourGradient = Readonly<{ healthFraction: number; colour: string }>
2383
+
2384
+ export type NameTagBorderStyle = (_TypeOf["nameTagBorderStyles"])[number]
2385
+
2386
+ export type NameTagBorderTarget = (_TypeOf["nameTagBorderTargets"])[number]
2387
+
2388
+ export type MultilineTextBox = {
2389
+ content: (CustomTextStyling[number] | RankInfo)[]
2390
+ backgroundColor?: string
2391
+ animateIn?: boolean
2392
+ }
2393
+
2394
+ export type TempParticleSystemOpts = ParticleSystemOpts & {
2395
+ dir1: number[]
2396
+ dir2: number[]
2397
+ pos1: number[]
2398
+ pos2: number[]
2399
+ manualEmitCount: number
2400
+ hideDist: number
2401
+ }
2402
+
2403
+ export type ParticlePresetOpts = {
2404
+ presetId: ParticlePresetId
2405
+ pos1: number[]
2406
+ pos2: number[]
2407
+ }
2408
+
2409
+ export type ParticleSystemOpts = {
2410
+ texture: string
2411
+ minLifeTime: number
2412
+ maxLifeTime: number
2413
+ minEmitPower: number
2414
+ maxEmitPower: number
2415
+ minSize: number
2416
+ maxSize: number
2417
+ gravity: number[]
2418
+ velocityGradients: VelocityGradient[]
2419
+ colorGradients: TimeColorGradient[] | RandomColorGradient[]
2420
+ blendMode: ParticleSystemBlendMode
2421
+ }
2422
+
2423
+ export type VelocityGradient = {
2424
+ timeFraction: number
2425
+ factor: number
2426
+ factor2: number
2427
+ }
2428
+
2429
+ export type TimeColorGradient = {
2430
+ timeFraction: number
2431
+ minColor: [number, number, number, number]
2432
+ maxColor?: [number, number, number, number]
2433
+ }
2434
+
2435
+ export type RandomColorGradient = {
2436
+ color: [number, number, number]
2437
+ }
2438
+
2439
+ export type ParticlePresetId = keyof _TypeOf["particlePresets"]
2440
+
2441
+ export type AnimationSchema = Readonly<{
2442
+ animationDurationMs: number
2443
+ loop?: LoopModeSchema
2444
+ nodeAnimations?: NodeSkeletonAnimationSchema
2445
+ }>
2446
+
2447
+ export type BlockbenchAnimationSchema = Readonly<{
2448
+ animation_length: number // The duration of the animation in seconds.
2449
+ loop?: BlockbenchLoopModeSchema
2450
+ bones?: BlockbenchBonesAnimationSchema
2451
+ }>
2452
+
2453
+ export type LoopModeSchema = boolean | "hold-on-last-frame"
2454
+
2455
+ export type AnimationTimelineSchema = readonly KeyframeSchema[]
2456
+
2457
+ export type KeyframeSchema = Readonly<{
2458
+ timeFraction: number
2459
+ rotation?: LerpPointSchema // Rotations are assumed to be in radians.
2460
+ position?: LerpPointSchema // Position offsets in mesh-local units; (0, 0, 0) means the node's rest pose.
2461
+ }>
2462
+
2463
+ export type LerpPointSchema =
2464
+ | Point
2465
+ | Readonly<{
2466
+ lerpMode?: LerpModeSchema
2467
+ point: Point
2468
+ }>
2469
+ | Readonly<{
2470
+ lerpMode?: LerpModeSchema
2471
+ pre: Point // When lerping towards a point, we lerp towards its pre.
2472
+ post: Point // When lerping away from a point, we lerp away from its post.
2473
+ }>
2474
+
2475
+ export type Point = Readonly<Vec3>
2476
+
2477
+ export type LerpModeSchema = "linear" | "catmull-rom-spline"
2478
+
2479
+ export type BlockbenchLoopModeSchema = boolean | "hold_on_last_frame"
2480
+
2481
+ export type BlockbenchAnimationTimelineSchema = Point | Readonly<Record<TimestampString, BlockbenchAnimationFrameSchema>>
2482
+
2483
+ export type TimestampString = string
2484
+
2485
+ export type BlockbenchAnimationFrameSchema =
2486
+ | Point
2487
+ | Readonly<{
2488
+ lerp_mode?: BlockbenchLerpModeSchema
2489
+ pre?: Point // When lerping towards a point, we lerp towards its pre.
2490
+ post: Point // When lerping away from a point, we lerp away from its post.
2491
+ }>
2492
+
2493
+ export type BlockbenchLerpModeSchema = "linear" | "catmullrom"
2494
+
2495
+ export type NodeSkeletonAnimationSchema = Readonly<Record<NodeName, NodeAnimationSchema>>
2496
+
2497
+ export type NodeName = string
2498
+
2499
+ export type NodeAnimationSchema = Readonly<{
2500
+ timeline: AnimationTimelineSchema
2501
+ }>
2502
+
2503
+ export type BlockbenchBonesAnimationSchema = Readonly<Record<NodeName, BlockbenchBoneAnimationSchema>>
2504
+
2505
+ export type BlockbenchBoneAnimationSchema = Readonly<{
2506
+ rotation?: BlockbenchAnimationTimelineSchema // Blockbench rotations are in degrees.
2507
+ position?: BlockbenchAnimationTimelineSchema // Blockbench position offsets in mesh-local units; rest pose is (0, 0, 0).
2508
+ }>
2509
+
2510
+ export type MobId = LifeformId
2511
+
2512
+ export type MobDbId = string
2513
+
2514
+ export type BlockName = string
2515
+
2516
+ export type BlockId = number
2517
+
2518
+ export type WorldBlockChangedInfo = {
2519
+ cause: PNull<WorldBlockChangedCause>
2520
+ }
2521
+
2522
+ export type WorldBlockChangedCause = "Paintball" | "FloorCreator" | "Sapling" | "StemFruit" | "MeltingIce" | "Explosion"
2523
+
2524
+ export type GameChunk = {
2525
+ blockData: any
2526
+ extraInfo: PersistedExtraInfo
2527
+ }
2528
+
2529
+ export type PersistedExtraInfo = {
2530
+ specialBlocks: any[]
2531
+ entities: any[]
2532
+ // We allow games and plugins to store custom metadata in the chunk,
2533
+ // but that metadata should be:
2534
+ // - minimal, to avoid issues where the chunk is too large to store;
2535
+ // - updated infrequently, to avoid excessive writes to the DB.
2536
+ customMetadata: any
2537
+ }
2538
+
2539
+ export type ItemAttributes = { customDisplayName?: string; customDescription?: string; customAttributes?: Record<string, any> }
2540
+
2541
+ export type ItemDropOptions = Readonly<
2542
+ Partial<{
2543
+ doPhysics: boolean
2544
+ size: number
2545
+ }>
2546
+ >
2547
+
2548
+ export type AudioEntityOpts = {
2549
+ soundName: string
2550
+ // Base relative volume in [0, 1], before distance attenuation.
2551
+ volume: number
2552
+ // Inverse-distance reference distance in blocks; larger = gentler falloff.
2553
+ refDistance: number
2554
+ // Hard cutoff distance in blocks; beyond this the entity is silent.
2555
+ maxHearDist: number
2556
+ // Playback rate multiplier (1 = normal pitch/speed).
2557
+ rate: number
2558
+ }
2559
+
2560
+ export type AnimParams = { animTextures: string[]; animationInterval: number }
2561
+
2562
+ export type HarvestType = "granule" | "wood" | "rock" | "cuttable"
2563
+
2564
+ export type BlockMetadataModelType =
2565
+ | "CentreCross"
2566
+ | "SquareSided"
2567
+ | "CustomPlanes"
2568
+ | "CustomModel"
2569
+ | "Slab"
2570
+ | "door"
2571
+ | "trapdoor"
2572
+ | "rotatableOffset"
2573
+ | "rotatable"
2574
+
2575
+ export type SpecialToolDrop = { tool: ItemName | ItemName[]; drops: ItemName | BlockName }
2576
+
2577
+ export type RecursiveReadonly<T> = T extends Primitive
2578
+ ? T
2579
+ : T extends (...args: never[]) => unknown
2580
+ ? T
2581
+ : T extends readonly unknown[]
2582
+ ? number extends T["length"]
2583
+ ? ReadonlyArray<RecursiveReadonly<T[number]>> // T[]
2584
+ : { readonly [K in keyof T]: RecursiveReadonly<T[K]> } // Tuple
2585
+ : Readonly<{ [K in keyof T]: RecursiveReadonly<T[K]> }>
2586
+
2587
+ export type Primitive = string | number | boolean | bigint | symbol | undefined | null
2588
+
2589
+ export type SoundType = "stone" | "wood" | "gravel" | "grass" | "glass" | "sand" | "snow" | "cloth"
2590
+
2591
+ export type GunStatsOverride = Partial<Omit<GunMetadata, NonOverridableStats>>
2592
+
2593
+ export type GunMetadata = {
2594
+ gunType: GunCategory // Used for sounds
2595
+ scopeType: "none" | "sniper"
2596
+ muzzleFlashOffsetFromGun: Vec3
2597
+ muzzleFlashScale?: number
2598
+ autoFireWithMouse: boolean
2599
+ fireRate: number
2600
+ fireRateWithHeldTouch?: number
2601
+ burstCount?: number
2602
+ burstDelay?: number
2603
+ damage: number
2604
+ shotPelletCount?: number
2605
+ reloadTime?: number
2606
+ clipSize: number
2607
+ reloadBulletsIndividually?: boolean
2608
+ bulletReloadTime?: number
2609
+ cockTime?: number
2610
+ tagSpeedMult: number
2611
+ subsequentTagSpeedReductionScalar: number
2612
+ inaccuracyStanding: number
2613
+ inaccuracyFromShot: number
2614
+ inaccuracyMovement: number
2615
+ yVelocityInaccuracy: number
2616
+ inaccuracyFromJump: number
2617
+ altInaccuracyStanding: number
2618
+ altInaccuracyFromShot: number
2619
+ altInaccuracyMovement: number
2620
+ recoveryRate: number
2621
+
2622
+ msPerRound?: number // computed from fireRate
2623
+ msPerRoundTouchScreen?: number // computed from fireRateWithHeldTouch
2624
+
2625
+ altYVelocityInaccuracy?: number
2626
+ altInaccuracyFromJump?: number
2627
+
2628
+ hasVerticalInaccuracy?: boolean
2629
+
2630
+ keepScopeOnShot?: boolean
2631
+
2632
+ aimZoomFactor?: number
2633
+
2634
+ // Kickback
2635
+ kickbackDecreaseRate: number
2636
+ minKickback?: number
2637
+ maxKickback?: number
2638
+ kickbackRate?: number
2639
+ }
2640
+
2641
+ export type NonOverridableStats =
2642
+ // Precomputed values
2643
+ | "msPerRound"
2644
+ | "msPerRoundTouchScreen"
2645
+
2646
+ // These two don't even work lol
2647
+ // TODO: Fix them
2648
+ | "tagSpeedMult"
2649
+ | "subsequentTagSpeedReductionScalar"
2650
+
2651
+ export type GunCategory = (_TypeOf["gunCategories"])[number]
2652
+
2653
+ export type WeaponComboInfo = Readonly<{
2654
+ comboWindowMs: number
2655
+ comboMultipliers: readonly number[]
2656
+ backstabAngle?: number // If present, hitting an enemy from behind within this angle (radians) skip to end of combo
2657
+ }>
2658
+
2659
+ export type AnyMetadataItem = Partial<BlockMetadataItem & NonBlockMetadataItem>
2660
+
2661
+ export type CustomItemStat = (_TypeOf["customItemStats"])[number]
2662
+
2663
+ export type InvenItem = { name: string; amount: PNull<number>; attributes: ItemAttributes; typeObj: any }
2664
+
2665
+ export type RecipesForItem = RecursiveReadonly<
2666
+ {
2667
+ requires: { items: ItemName[]; amt: number }[]
2668
+ produces: number
2669
+ station?: string | string[]
2670
+ onCraftedAura?: number
2671
+ isStarterRecipe?: boolean
2672
+ attributes?: ItemAttributes
2673
+ }[]
2674
+ >
2675
+
2676
+ export type EntityType = PNull<NetworkedEntityType | "Mesh" | "Item">
2677
+
2678
+ export type NetworkedEntityType =
2679
+ | LifeformType
2680
+ | ThrowableItem
2681
+ | string
2682
+ | string
2683
+ | "AudioEntity"
2684
+
2685
+ export type LifeformType = (_TypeOf["lifeformTypes"])[number]
2686
+
2687
+ export type ThrowableItem = string
2688
+
2689
+ export type MeshEntityType = keyof MeshEntityOpts
2690
+
2691
+ export type MeshEntityOptsStringified = string
2692
+
2693
+ export type MeshEntityOpts = {
2694
+ Box: CommonMeshEntityOpts & {
2695
+ width: number
2696
+ height: number
2697
+ depth: number
2698
+ diffuseColor?: number[]
2699
+ emissiveColor?: number[]
2700
+ backFaceCulling?: boolean // Default true
2701
+ texture?: string // Can be a blockname. Wraps every one block
2702
+ faceUV?: number[][]
2703
+ animateTexture?: boolean // If true, \`texture\` must be an animated block name (e.g. "Lava", "Red Portal") and the Box cycles through its frames.
2704
+ }
2705
+ BloxdBlock: CommonMeshEntityOpts & {
2706
+ blockName: BlockNameOrId
2707
+ size: number | [number, number, number]
2708
+ }
2709
+ Person: CommonMeshEntityOpts & {
2710
+ size?: number
2711
+ textures?: Partial<Cosmetics>
2712
+ pose?: PlayerPose
2713
+ }
2714
+ ParticleEmitter: MeshParticleSystemOpts
2715
+ }
2716
+
2717
+ export type CommonMeshEntityOpts = {
2718
+ hideDist?: number
2719
+ meshOffset?: number[]
2720
+ autoRotate?: boolean
2721
+ lineToEId?: EntityId // EntityId to connect to using a line
2722
+ }
2723
+
2724
+ export type BlockNameOrId = BlockName | BlockId
2725
+
2726
+ export type Cosmetics = Record<CosmeticType, CosmeticName>
2727
+
2728
+ export type PlayerPose = (_TypeOf["playerPoses"])[number]
2729
+
2730
+ export type MeshParticleSystemOpts = ParticleSystemOpts &
2731
+ CommonMeshEntityOpts & {
2732
+ height: number
2733
+ width: number
2734
+ depth: number
2735
+ emitRate: number
2736
+ dir1?: number[]
2737
+ dir2?: number[]
2738
+ }
2739
+
2740
+ export type CosmeticType = (_TypeOf["cosmeticTypes"])[number]
2741
+
2742
+ export type CosmeticName = string
2743
+
2744
+ export type MobHerdId = number
2745
+
2746
+ export type MobType = (_TypeOf["mobTypes"])[number]
2747
+
2748
+ export type MobSpawnOpts<TMobType extends MobType> = Partial<{
2749
+ mobHerdId: MobHerdId
2750
+ spawnerId: PlayerId
2751
+ mobDbId: MobDbId
2752
+ name: string
2753
+ playSoundOnSpawn: boolean
2754
+ variation: MobVariation<TMobType>
2755
+ physicsOpts: Partial<{
2756
+ width: number
2757
+ height: number
2758
+ collidesEntities: boolean
2759
+ }>
2760
+ }>
2761
+
2762
+ export type MobVariation<TMobType extends MobType> = (_TypeOf["mobVariations"])[TMobType][number]
2763
+
2764
+ export type MobSetting = (_TypeOf["mobSettings"])[number]
2765
+
2766
+ export type MobSettings<TMobType extends MobType> = {
2767
+ variation: MobVariation<TMobType>
2768
+ name: string
2769
+ maxHealth: number
2770
+ initialHealth: number
2771
+ idleSound: PNull<string>
2772
+ attackSound: PNull<string>
2773
+ secondaryAttackSound: PNull<string>
2774
+ hurtSound: PNull<string>
2775
+ onDeathItemDrops: readonly MobItemDrop[]
2776
+ onDeathParticleTexture: string
2777
+ onDeathAura: number
2778
+ baseWalkingSpeed: number
2779
+ baseRunningSpeed: number
2780
+ walkingSpeedMultiplier: number
2781
+ runningSpeedMultiplier: number
2782
+ jumpCount: number
2783
+ baseJumpImpulseXZ: number
2784
+ baseJumpImpulseY: number
2785
+ jumpMultiplier: number
2786
+ runAwayRadius: number
2787
+ chaseRadius: number
2788
+ territoryRadius: number
2789
+ hostilityRadius: number
2790
+ stoppingRadius: number
2791
+ attackInterval: number
2792
+ attackRadius: number
2793
+ secondaryAttackRadius: number
2794
+ attackDamage: number
2795
+ secondaryAttackDamage: number
2796
+ isReceivingDamageCooldownGlobal: boolean // When the mob is attacked, a short cooldown prevents further damage from the same attack type. If true, all attackers share that cooldown. If false, each attacker has their own.
2797
+ knockbackReceivedMultiplier: number // Scales incoming knockback when the mob is hit: 0 = immune (no knockback), 1 = normal, 2 = double. Applied on top of any worn-armour/effect knockback resistance.
2798
+ attackImpulse: number
2799
+ secondaryAttackImpulse: number
2800
+ rangedAttackInaccuracy: number // Total angular width of the random cone (in radians), 0 = perfectly accurate (laser-aim). Only affects throwable/projectile attacks
2801
+ burstAttackInfo: PNull<MobBurstAttackInfo>
2802
+ secondaryBurstAttackInfo: PNull<MobBurstAttackInfo>
2803
+ heldItemName: PNull<ItemName>
2804
+ heldItemEnchantmentTier: PNull<EnchantmentTier>
2805
+ armour: MobArmour
2806
+ attackItemName: PNull<ItemName>
2807
+ secondaryAttackItemName: PNull<ItemName>
2808
+ swingArmOnAttack: boolean
2809
+ swingArmOnSecondaryAttack: boolean
2810
+ attackEffectName: PNull<string>
2811
+ attackEffectDuration: number
2812
+ warpTargetSpecialAttackInfo: PNull<MobWarpTargetSpecialAttackInfo>
2813
+ combatTetherInfo: PNull<MobCombatTetherCombatInfo>
2814
+ evadeInfo: PNull<MobEvadeInfo>
2815
+ chargeSpecialAttackInfo: PNull<MobChargeSpecialAttackInfo>
2816
+ tameInfo: PNull<Readonly<MobTameInfo>>
2817
+ onTamedHealthMultiplier: number
2818
+ petInfo: Readonly<MobPetInfo> // Instance-specific information related to mob feeding
2819
+ ownerDbId: PNull<PlayerDbId>
2820
+ minFollowingRadius: number
2821
+ maxFollowingRadius: number
2822
+ isRideable: boolean
2823
+ healthRegen: PNull<MobHealthRegenSettings>
2824
+ ridingSpeedMult: number
2825
+ bridgeInfo: PNull<MobBridgeInfo>
2826
+ // Impulse-driven movement (independent slide / jump / random-facing capabilities). \`walking*\` apply while
2827
+ // moving at walking speed (idle wander + walkToPosition), \`running*\` at running speed (chase/flee/follow/
2828
+ // runToPosition). Null = ordinary speed-driven movement.
2829
+ walkingSlideInfo: PNull<MobSlideInfo>
2830
+ runningSlideInfo: PNull<MobSlideInfo>
2831
+ walkingJumpInfo: PNull<MobJumpInfo>
2832
+ runningJumpInfo: PNull<MobJumpInfo>
2833
+ walkingRandomFacingInfo: PNull<MobRandomFacingInfo>
2834
+ runningRandomFacingInfo: PNull<MobRandomFacingInfo>
2835
+ metaInfo: string
2836
+ }
2837
+
2838
+ export type MobItemDrop = Readonly<{
2839
+ itemName: ItemName
2840
+ probabilityOfDrop?: number
2841
+
2842
+ // If a mob drops an item, then we choose a random amount within these bounds.
2843
+ dropMinAmount?: number
2844
+ dropMaxAmount?: number
2845
+
2846
+ // If true, the item will "burst" out of the mob rather than just dropping.
2847
+ applyBurstImpulseToDrop?: boolean
2848
+ }>
2849
+
2850
+ export type MobBurstAttackInfo = Readonly<{
2851
+ burstAttackIntervals: readonly number[]
2852
+ }>
2853
+
2854
+ export type MobArmour = Partial<Readonly<Record<ArmourPart, MobArmourPiece>>>
2855
+
2856
+ export type MobWarpTargetSpecialAttackInfo = Readonly<{
2857
+ cooldown: number
2858
+ range: number
2859
+ sound: PNull<string>
2860
+ delay: number
2861
+ minDestinationRadius: number
2862
+ maxDestinationRadius: number
2863
+ swingArm: boolean
2864
+ particleOpts: PNull<TempMobParticleOpts>
2865
+ }>
2866
+
2867
+ export type MobCombatTetherCombatInfo = Readonly<{
2868
+ range: number
2869
+ particleOpts: MobParticleOpts
2870
+ }>
2871
+
2872
+ export type MobEvadeInfo = Readonly<{
2873
+ probability: number
2874
+ impulse: number
2875
+ minAngle: number
2876
+ maxAngle: number
2877
+ }>
2878
+
2879
+ export type MobChargeSpecialAttackInfo = Readonly<{
2880
+ // Multiplier applied to the running speed during the straight dash. Defaults to 1.
2881
+ chargeSpeedMult?: number
2882
+ // Max heading error (radians) at which the mob is considered "facing" its target and may dash. Defaults to a small tolerance.
2883
+ faceTolerance?: number
2884
+ // Pose shown while dashing, reverted to the resting pose when the charge ends. Defaults to "zombie".
2885
+ chargePose?: PlayerPose
2886
+ }>
2887
+
2888
+ export type MobTameInfo = {
2889
+ tameItemName: ItemName | readonly ItemName[]
2890
+ probabilityOfTame: number
2891
+ isSaddleable?: boolean
2892
+ saddleItemName?: ItemName
2893
+ foodItemNames?: readonly ItemName[]
2894
+ foodItemsWithEffects?: readonly Readonly<ItemNameWithEffects>[]
2895
+ supportsFriendship?: boolean
2896
+ likedFoods?: readonly ItemName[]
2897
+ neutralFoods?: readonly ItemName[]
2898
+ dislikedFoods?: readonly ItemName[]
2899
+ guaranteedDrop?: ItemName
2900
+ commonDrops?: ItemName[]
2901
+ levelUpBonuses?: LevelUpBonuses
2902
+ }
2903
+
2904
+ export type MobPetInfo = {
2905
+ friendshipPoints: number
2906
+ lastFedAt: number
2907
+ highestFriendshipLevelReached: MobFeedLevel
2908
+ superlikedFood: PNull<ItemName>
2909
+ superlikedFoodKnown: boolean
2910
+ bonusesGained: readonly MobLevelUpBonus[]
2911
+ }
2912
+
2913
+ export type MobHealthRegenSettings = Readonly<{
2914
+ amount: number
2915
+ interval: number
2916
+ startAfter: number
2917
+ }>
2918
+
2919
+ export type MobBridgeInfo = Readonly<{
2920
+ // The block to place.
2921
+ blockToPlace: BlockName
2922
+ // If true, only place while stood on solid ground (decorates the surface walked over); if false, place
2923
+ // even while airborne (lets the mob bridge a gap beneath itself).
2924
+ mustBeGrounded: boolean
2925
+ // Only overwrite a cell currently holding one of these blocks, so real terrain is never destroyed.
2926
+ // Omitted means \`["Air"]\` (fill empty space only); an empty array replaces nothing at all, not even
2927
+ // air. A cell already holding \`blockToPlace\` is skipped (would be a no-op).
2928
+ blocksToReplace?: readonly BlockName[]
2929
+ // Vertical offset from the cell the mob occupies. Defaults to 0 (a surface trail); -1 places beneath the
2930
+ // mob's feet (bridging). Non-negative offsets intersect the mob, so \`blockToPlace\` must be non-solid there.
2931
+ yOffset?: number
2932
+ // If a |Decaying variant exists for \`blockToPlace\`, use it to turn blocks into air after \`msToDecay\` ms.
2933
+ msToDecay?: number
2934
+ }>
2935
+
2936
+ export type MobSlideInfo = Readonly<{
2937
+ // Horizontal impulse at the start of a slide (initial speed = impulse / mass).
2938
+ impulse: number
2939
+ // Lowered friction the burst coasts on (below the mob's normal friction so it carries far), restored on end.
2940
+ friction: number
2941
+ // How long (ms) the low-friction coast lasts.
2942
+ durationBounds: Bounds
2943
+ // Rest (ms) after the coast ends before the next slide. Larger = fewer slides.
2944
+ intervalBounds: Bounds
2945
+ }>
2946
+
2947
+ export type MobJumpInfo = Readonly<{
2948
+ // Rest (ms) between hops (a hop only fires once grounded). Larger = fewer hops.
2949
+ intervalBounds: Bounds
2950
+ }>
2951
+
2952
+ export type MobRandomFacingInfo = Readonly<{
2953
+ // Weighted offsets to pick from (via getWeightedRandom); \`weight\`s are non-negative,
2954
+ // and at least one must be greater than 0. E.g. \`[{ offset: Math.PI, weight: 2 },
2955
+ // { offset: 0, weight: 1 }]\` faces backwards twice as often as forwards.
2956
+ offsets: readonly Readonly<{ offset: number; weight: number }>[]
2957
+ // Bounds (ms) between re-rolls.
2958
+ intervalBounds: Bounds
2959
+ }>
2960
+
2961
+ export type ArmourPart = (_TypeOf["armourPieces"])[number]
2962
+
2963
+ export type MobArmourPiece = Readonly<{
2964
+ itemName: ItemName
2965
+ enchantmentTier?: EnchantmentTier
2966
+ }>
2967
+
2968
+ export type TempMobParticleOpts = Readonly<{
2969
+ duration: number
2970
+ }> &
2971
+ MobParticleOpts
2972
+
2973
+ export type MobParticleOpts = Readonly<Pick<MeshParticleSystemOpts, "texture" | "colorGradients">>
2974
+
2975
+ export type ItemNameWithEffects = { itemName: ItemName; effects: readonly Readonly<EffectOpts>[]; healAmt?: number }
2976
+
2977
+ export type LevelUpBonuses = RecursiveReadonly<Record<MobFeedLevelUpLevels, MobLevelUpBonus>>
2978
+
2979
+ export type EffectOpts = { name: PotionEffect; duration: number; level: number }
2980
+
2981
+ export type PotionEffect = (_TypeOf["potionEffects"])[number]
2982
+
2983
+ export type MobFeedLevelUpLevels = Exclude<MobFeedLevel, 0>
2984
+
2985
+ export type MobLevelUpBonus = (_TypeOf["mobLevelUpBonuses"])[number]
2986
+
2987
+ export type MobFeedLevel = InclusiveRange<_TypeOf["MAX_MOB_FEED_LEVEL"]>
2988
+
2989
+ export type InclusiveRange<N extends number, Arr extends number[] = []> = Arr["length"] extends N
2990
+ ? Arr[number] | Arr["length"]
2991
+ : InclusiveRange<N, [...Arr, Arr["length"]]>
2992
+
2993
+ export type Bounds = Readonly<MutableBounds>
2994
+
2995
+ export type MutableBounds = {
2996
+ min: number
2997
+ max: number
2998
+ }
2999
+
3000
+ export type MobAiState = (_TypeOf["mobAiStates"])[number]
3001
+
3002
+ export type MobAiStateParams<TState extends MobAiState> = MobWorldView[TState]
3003
+
3004
+ export type MobWorldView = {
3005
+ // The mob is stood still, but it still has awareness of its environment.
3006
+ // For example: if the mob is hostile, it will still chase and attack nearby players.
3007
+ idle: null
3008
+ // The mob is stood still, and it has no awareness of its environment.
3009
+ // It will not even react if provoked.
3010
+ disabled: null
3011
+ // The mob is stood still (idle) and is about to turn.
3012
+ idleBeforeTurning: null
3013
+ // The mob has chosen a new direction at random and is turning to face it.
3014
+ turning: null
3015
+ // The mob is stood still (idle) and is about to walk.
3016
+ idleBeforeWalking: null
3017
+ // The mob is walking in the direction it is facing.
3018
+ walking: null
3019
+ // The mob is running away from the target lifeform.
3020
+ runningAway: { targetId: LifeformId }
3021
+ // The mob is chasing the target lifeform.
3022
+ chasing: { targetId: LifeformId }
3023
+ // A charge-attack mob is stood still, rotating at its \`turnRate\` until it faces the target,
3024
+ // at which point it captures the target's current position and transitions to \`charging\`.
3025
+ turningBeforeCharging: { targetId: LifeformId }
3026
+ // A charge-attack mob is dashing straight at the position of the target captured when it
3027
+ // entered the state, ignoring the target's live position mid-dash (so the charge is dodgeable).
3028
+ charging: { targetId: LifeformId }
3029
+ // The mob is following the target lifeform.
3030
+ // It will stop if it is within the \`minFollowingDistance\` (mob setting) of the target,
3031
+ // and teleport to the target if it is outside the \`maxFollowingDistance\` (mob setting) of the target.
3032
+ following: { targetId: LifeformId }
3033
+ // The mob is stood still looking at the target.
3034
+ watching: { targetId: LifeformId }
3035
+ // The mob is walking towards the position.
3036
+ // It will stop if it is within the \`stoppingRadius\` (mob setting) of the position.
3037
+ walkingToPosition: { pos: Pos }
3038
+ // The mob is running towards the position.
3039
+ // It will stop if it is within the \`stoppingRadius\` (mob setting) of the position.
3040
+ runningToPosition: { pos: Pos }
3041
+ }
3042
+
3043
+ export type MeshEntityPhysicsOpts = {
3044
+ doPhysics: boolean
3045
+ onCollideTerrain?: () => void // Unsupported for custom code
3046
+ collidesEntities?: boolean
3047
+ collideBits?: number // bitmask category of this entity
3048
+ collideMask?: number // bitmask category of entities this entity collides with
3049
+ heightExpandAmt?: number // expand hitbox height by this amount
3050
+ widthExpandAmt?: number // expand hitbox width by this amount
3051
+ }
3052
+
3053
+ export type QTEType = keyof QTEDefinitions
3054
+
3055
+ export type QTEClientParameters<T extends QTEType = QTEType> = {
3056
+ type: T
3057
+ parameters: QTEParametersForType<T>
3058
+ }
3059
+
3060
+ export type QTEParametersForType<T extends QTEType> = QTEDefinitions[T]["params"]
3061
+
3062
+ export interface QTEDefinitions {
3063
+ progressBar: { params: ProgressBarQteParams; state: ProgressBarQteState }
3064
+ timedClick: { params: TimedClickQteParams; state: TimedClickQteState }
3065
+ gravityBar: { params: GravityBarQteParams; state: GravityBarQteState }
3066
+ precisionBar: { params: PrecisionBarQteParams; state: PrecisionBarQteState }
3067
+ rhythmClick: { params: RhythmClickQteParams; state: RhythmClickQteState }
3068
+ }
3069
+
3070
+ export type ProgressBarQteParams = Readonly<{
3071
+ /** Starting progress value (0-100) @default 30 */
3072
+ progressStartValue?: number
3073
+ /** How much progress drains each tick while the player isn't clicking @default 0.075 */
3074
+ progressDecreasePerTick: number
3075
+ /** How much progress is gained per click @default 5 */
3076
+ progressPerClick: number
3077
+ /** If true, the QTE fails when progress reaches 0; otherwise progress clamps at 0 @default false */
3078
+ canFail: boolean
3079
+ /** Rich text shown as the QTE prompt @default [{ str: "Click repeatedly to complete!" }] */
3080
+ description: CustomTextStyling
3081
+ /** Icon displayed on the click target @default "fa-solid fa-computer-mouse" */
3082
+ clickIcon: string
3083
+ /** Scale multiplier for the click icon (must be > 0) @default 1 */
3084
+ scale?: number
3085
+ /** Rotation in degrees for the click icon (must be ≥ 0) @default 15 */
3086
+ rotation?: number
3087
+ }>
3088
+
3089
+ export type ProgressBarQteState = {
3090
+ progress: number
3091
+ clickCount: number
3092
+ }
3093
+
3094
+ export type TimedClickQteParams = Readonly<{
3095
+ /** Duration in milliseconds the player has to click @default 3000 */
3096
+ timeWindow: number
3097
+ /** Icon displayed on the click target @default "fa-solid fa-computer-mouse" */
3098
+ icon: string
3099
+ /** Rich text shown as the QTE prompt @default [{ str: "Click to complete the QTE!" }] */
3100
+ label: CustomTextStyling
3101
+ /** Whether to display a countdown timer @default true */
3102
+ showTimer: boolean
3103
+ /** Scale multiplier for the icon (must be > 0) @default 1 */
3104
+ scale?: number
3105
+ /** Rotation in degrees for the icon (must be ≥ 0) @default 15 */
3106
+ rotation?: number
3107
+ /** If true, the icon pulses with a breathing animation anchored to the centre @default false */
3108
+ breatheCenter?: boolean
3109
+ }>
3110
+
3111
+ export type TimedClickQteState = {
3112
+ timeRemaining: number
3113
+ timeWindow: number
3114
+ }
3115
+
3116
+ export type GravityBarQteParams = Readonly<{
3117
+ /** Starting progress value (0-100) @default 30 */
3118
+ progressStartValue?: number
3119
+ /** Size of the player's catch zone as a fraction of the bar (must be > 0, 0-1) @default 0.25 */
3120
+ catchZoneSize: number
3121
+ /** Speed at which the mover travels along the bar (must be > 0) @default 3 */
3122
+ moverSpeed: number
3123
+ /** How erratically the mover changes direction (higher = more unpredictable) @default 0.8 */
3124
+ moverErraticness: number
3125
+ /** Downward pull on the catch zone when the player isn't holding click @default 1 */
3126
+ gravity: number
3127
+ /** Upward force on the catch zone while the player holds click @default 1.5 */
3128
+ riseSpeed: number
3129
+ /** Progress gained per second while the mover is inside the catch zone @default 8 */
3130
+ progressGainPerSecond: number
3131
+ /** Progress lost per second while the mover is outside the catch zone @default 4 */
3132
+ progressDrainPerSecond: number
3133
+ /** If true, the QTE fails when progress reaches 0; otherwise progress clamps at 0 @default false */
3134
+ canFail: boolean
3135
+ /** Rich text shown as the QTE prompt @default [{ str: "Hold to catch!" }] */
3136
+ description: CustomTextStyling
3137
+ /** Icon displayed on the mover @default "Moonfish" */
3138
+ icon?: string
3139
+ }>
3140
+
3141
+ export type GravityBarQteState = {
3142
+ catchZonePosition: number
3143
+ catchZoneSize: number
3144
+ moverPosition: number
3145
+ progress: number
3146
+ isCatching: boolean
3147
+ }
3148
+
3149
+ export type PrecisionBarQteParams = Readonly<{
3150
+ /** Speed of the marker in full bar-widths per second (must be > 0, e.g. 1.0 = one full sweep per second) @default 0.5 */
3151
+ speed: number
3152
+ /** Fraction of the bar that counts as the success zone, centred in the middle (must be > 0, 0-1, e.g. 0.15 = 15%) @default 0.15 */
3153
+ successZoneSize: number
3154
+ /** Rich text shown as the QTE prompt @default [{ str: "Click when the marker is within the green zone." }] */
3155
+ label: CustomTextStyling
3156
+ /** Icon displayed on the marker @default "" */
3157
+ icon?: string
3158
+ /** Scale multiplier for the icon (must be > 0) @default 1 */
3159
+ scale?: number
3160
+ /** Rotation in degrees for the icon (must be ≥ 0) @default 0 */
3161
+ rotation?: number
3162
+ }>
3163
+
3164
+ export type PrecisionBarQteState = {
3165
+ /** Marker position as 0–1 where 0.5 is the centre */
3166
+ markerPosition: number
3167
+ }
3168
+
3169
+ export type RhythmClickQteParams = Readonly<{
3170
+ /** Number of successful clicks needed to complete the QTE (must be a positive integer) @default 5 */
3171
+ requiredSuccesses: number
3172
+ /** Duration in milliseconds for the outer circle to shrink from max size to centre (must be > 0) @default 1200 */
3173
+ shrinkDurationMs: number
3174
+ /** Fraction of the inner circle radius that counts as a successful overlap (must be > 0, 0-1, e.g. 0.15 = ±15%) @default 0.15 */
3175
+ toleranceFraction: number
3176
+ /** Max misses allowed before failing. If omitted, unlimited misses are permitted (must be a non-negative integer) @default 3 */
3177
+ maxMisses?: number
3178
+ /** Rich text shown as the QTE prompt @default [{ str: "Click when the circles align!" }] */
3179
+ label: CustomTextStyling
3180
+ /** Icon displayed in the centre of the circles @default "" */
3181
+ icon?: string
3182
+ }>
3183
+
3184
+ export type RhythmClickQteState = {
3185
+ /** Current outer circle radius as a fraction of the max radius (1 = fully expanded, 0 = at centre) */
3186
+ outerCircleProgress: number
3187
+ /** Number of successful clicks so far */
3188
+ successes: number
3189
+ /** Number of required successes to complete */
3190
+ requiredSuccesses: number
3191
+ /** Number of misses so far */
3192
+ misses: number
3193
+ /** Result of the most recent click: null if no click yet, true if hit, false if miss */
3194
+ lastClickResult: boolean | null
3195
+ }
3196
+
3197
+ export type QTERequestId = number
3198
+
3199
+ export type UiRequestId = number
3200
+
3201
+ export type IngameIconName = (_TypeOf["ingameIconNames"])[number]
3202
+
3203
+ export type InbuiltEffectInfo = { inbuiltLevel: number; initiatorId?: PlayerId }
3204
+
3205
+ export type PlayerPhysicsState<TPhysicsType extends PhysicsType> = Readonly<{ type: TPhysicsType; tier: PhysicsTier<TPhysicsType> }>
3206
+
3207
+ export type PhysicsTier<TPhysicsType extends PhysicsType> = PNull<PhysicsTiers[TPhysicsType]>
3208
+
3209
+ export type PhysicsTiers = {
3210
+ [0]: null
3211
+ [1]: BoatTier
3212
+ [2]: GliderTier
3213
+ [3]: BalloonTier
3214
+ [4]: SleepingTier
3215
+ [5]: null
3216
+ [6]: CarTier
3217
+ [7]: null
3218
+ }
3219
+
3220
+ export type SettableVehicleSetting = VehicleSetting | BlockVehicleSetting
3221
+
3222
+ export type SettableVehicleSettingValue<TSetting extends SettableVehicleSetting> = TSetting extends VehicleSetting
3223
+ ? VehicleSettingValue<TSetting>
3224
+ : BlockVehicleSettingValue<TSetting>
3225
+
3226
+ export type VehicleSetting = Exclude<keyof ResolvedPhysicsSettings<PhysicsType>, ByBlockRecordKey | "upwardImpulseOnUse">
3227
+
3228
+ export type BlockVehicleSetting = string
3229
+
3230
+ export type ResolvedPhysicsSettings<TPhysicsType extends PhysicsType> = DefaultPhysicsTypeSettings & AllPhysicsSettings[TPhysicsType]
3231
+
3232
+ export type ByBlockRecordKey = string
3233
+
3234
+ export type DefaultPhysicsTypeSettings = Readonly<{
3235
+ /** How heavy it is. Heavier things resist being pushed around, and sink rather than float. */
3236
+ mass: number
3237
+ /** How much water and lava slow it down. \`-1\` uses the world's normal drag. */
3238
+ fluidDrag: number
3239
+ /** \`fluidDrag\` for sideways movement only. \`-1\` falls back to \`fluidDrag\`. */
3240
+ fluidDragHorizontal: number
3241
+ /** \`fluidDrag\` for up-and-down movement only. \`-1\` falls back to \`fluidDrag\`. */
3242
+ fluidDragVertical: number
3243
+ /** How hard gravity pulls it down, compared to a normal player. \`0\` = it never falls. */
3244
+ gravityMultiplier: number
3245
+ /** How wide it is, in blocks. */
3246
+ width: number
3247
+ /** How tall it is, in blocks. */
3248
+ height: number
3249
+ /** Whether the rider is allowed to sprint. */
3250
+ canRun: boolean
3251
+ /**
3252
+ * How hard the rider pushes off the ground when jumping, compared to a normal jump. \`0\` = cannot jump.
3253
+ * Multiplies the \`jumpAmount\` client option rather than replacing it, and heavier types need a bigger
3254
+ * value to reach the same height.
3255
+ */
3256
+ jumpMultiplier: number
3257
+ /** An upward shove the moment the rider uses the vehicle, like a balloon lifting off. \`0\` = none. */
3258
+ upwardImpulseOnUse: number
3259
+ /** Whether it climbs one-block steps by itself, rather than the rider jumping them. */
3260
+ canAutoStep: boolean
3261
+ /** Overrides \`canAutoStep\` for particular blocks, by block name. Unlisted blocks use \`canAutoStep\`. */
3262
+ canAutoStepByBlock: Readonly<Record<BlockName, boolean>>
3263
+ /**
3264
+ * Where the rider sits, as \`[x, y, z]\` blocks from the middle of the vehicle. A rideable mob defaults
3265
+ * to its own ride height rather than to this type's value.
3266
+ */
3267
+ riderOffset: Pos
3268
+ /** How the rider's body is posed while riding. */
3269
+ pose: PlayerPose
3270
+ /**
3271
+ * A badge shown to the rider for as long as they ride. \`null\` = none. \`icon\` is an ingame icon or an
3272
+ * item name. \`name\` must be one that a physics type already uses, such as \`"Driving"\` or \`"Boating"\`,
3273
+ * because only those are cleared again when the rider gets off.
3274
+ */
3275
+ effect: PNull<{ name: string; icon: string; duration?: number }>
3276
+ /** How quickly it slows to a stop once the rider stops steering. Bigger = stops sooner. */
3277
+ standingFriction: number
3278
+ /** Its top speed, as a multiplier on normal walking speed. \`0\` = it cannot move. */
3279
+ speedMultiplier: number
3280
+ /** An extra speed multiplier used while on solid ground. */
3281
+ landSpeedMultiplier: number
3282
+ /** An extra speed multiplier used while in water or lava. */
3283
+ fluidSpeedMultiplier: number
3284
+ /** An extra speed multiplier used while in the air. */
3285
+ airSpeedMultiplier: number
3286
+ /**
3287
+ * Extra speed multipliers for the block underfoot, by block name. Solid ground only, and stacks with
3288
+ * \`speedMultiplier\` and the land/fluid/air multiplier. When several listed blocks are underfoot, the
3289
+ * value furthest from \`1\` wins.
3290
+ */
3291
+ speedMultiplierByBlock: Readonly<Record<BlockName, number>>
3292
+ /** Caps how hard it is pushed while far below the speed it is aiming for, so it takes longer to get going. \`0\` = no cap. */
3293
+ maxPushDistance: number
3294
+ /** How hard steering pushes it. Bigger = it speeds up and changes direction more sharply. */
3295
+ movementForceMultiplier: number
3296
+ /** Turns off the usual steering-driven movement, as for a sleeping player. */
3297
+ disableBaseMovement: boolean
3298
+ /** Whether footstep sounds are silenced. */
3299
+ disableFootstepSounds: boolean
3300
+ /**
3301
+ * How bouncy walls are: \`0\` stops dead, \`1\` keeps all its speed. Stacks with the \`bounciness\` client
3302
+ * option. Rebounds have a floor speed, so slow bumps come back faster than they arrived.
3303
+ */
3304
+ horizontalBounciness: number
3305
+ /**
3306
+ * How bouncy the floor is: \`0\` lands flat, \`1\` bounces back as fast as it fell. Stacks with the
3307
+ * \`bounciness\` client option, and has the same rebound floor as \`horizontalBounciness\`.
3308
+ */
3309
+ verticalBounciness: number
3310
+ /** How fast it must hit a wall, in blocks per second, before \`horizontalBounciness\` applies. \`0\` = any contact. */
3311
+ minHorizontalSpeedToBounce: number
3312
+ /**
3313
+ * How fast it must be falling, in blocks per second, before \`verticalBounciness\` applies. \`0\` bounces
3314
+ * off any contact, leaving a bouncy vehicle jiggling in place.
3315
+ */
3316
+ minVerticalSpeedToBounce: number
3317
+ /** Shakes the camera when it hits a wall hard enough; it need not bounce. \`null\` = no shake. See \`ImpactCameraShakeOpts\`. */
3318
+ horizontalImpactCameraShake: PNull<ImpactCameraShakeOpts>
3319
+ /** Shakes the camera when it hits a floor or ceiling hard enough; it need not bounce. \`null\` = no shake. See \`ImpactCameraShakeOpts\`. */
3320
+ verticalImpactCameraShake: PNull<ImpactCameraShakeOpts>
3321
+ /**
3322
+ * Makes it steer like a car: left and right turn it rather than sliding it sideways. \`null\` moves
3323
+ * freely in any direction, like a walking player. See \`SteeringOpts\`.
3324
+ */
3325
+ steering: PNull<SteeringOpts>
3326
+ /** Locks the direction it faces, in radians, ignoring the camera. \`null\` = it faces wherever the camera or steering points. */
3327
+ fixedHeading: PNull<number>
3328
+ /** Makes it skip across water like a stone once it is fast enough. \`null\` = it floats normally. See \`FluidSkipOpts\`. */
3329
+ fluidSkip: PNull<FluidSkipOpts>
3330
+ /**
3331
+ * Lets it fly once mid-air and descending. Supported movement types: \`GLIDING\` and \`FLOATING\`.
3332
+ * \`null\` = it cannot fly. See \`AirborneModeOpts\`.
3333
+ */
3334
+ airborneMode: PNull<AirborneModeOpts>
3335
+ /** How it moves while flying. \`null\` = it steers the same way it does on the ground. See \`AirborneMovementOpts\`. */
3336
+ airborneMovement: PNull<AirborneMovementOpts>
3337
+ /**
3338
+ * Caps how fast it falls while flying. Only used when \`airborneMovement\` is \`"heading"\`.
3339
+ * \`null\` = it falls at full speed. See \`FallSpeedLimitOpts\`.
3340
+ */
3341
+ airborneFallSpeedLimit: PNull<FallSpeedLimitOpts>
3342
+ }>
3343
+
3344
+ export type AllPhysicsSettings = {
3345
+ [0]: {}
3346
+ [1]: {}
3347
+ [2]: {}
3348
+ [3]: {}
3349
+ [4]: {}
3350
+ [5]: {}
3351
+ [6]: {}
3352
+ [7]: {}
3353
+ }
3354
+
3355
+ export type ImpactCameraShakeOpts = Readonly<{
3356
+ /** The crash speed, in blocks per second, needed to shake at all, so small bumps are ignored. */
3357
+ minSpeed: number
3358
+ /** How much shake each extra block per second adds. Shake runs from \`0\` (still) to \`1\` (violent). */
3359
+ intensityPerSpeed: number
3360
+ /** The most shake one crash can cause. */
3361
+ maxIntensity: number
3362
+ /** How long the shake lasts, in milliseconds. */
3363
+ durationMs: number
3364
+ }>
3365
+
3366
+ export type SteeringOpts = Readonly<{
3367
+ /** How fast it turns, in radians per second. Bigger = snappier steering and tighter corners. */
3368
+ turnRate: number
3369
+ /** How much speed a hard corner costs, from \`0\` (none) to \`1\` (all of it). */
3370
+ corneringSpeedDamping: number
3371
+ /**
3372
+ * How much it grips the ground. \`0\` slides sideways like a hovercraft on ice; bigger values make it
3373
+ * follow its nose round corners. Solid ground only, unless \`gripInFluid\` is on.
3374
+ */
3375
+ gripStrength: number
3376
+ /** Whether it also grips while floating in water, so a boat can corner like a kart. */
3377
+ gripInFluid: boolean
3378
+ }>
3379
+
3380
+ export type FluidSkipOpts = Readonly<{
3381
+ /** How fast it must be going, in blocks per second, to start skipping. */
3382
+ minSpeed: number
3383
+ /** How much of its speed above \`minSpeed\` becomes upward launch speed. Bigger = higher skips. */
3384
+ launchSpeedFraction: number
3385
+ /** How snappily it leaves the water. Bigger = a sharp pop; smaller = a slow heave. */
3386
+ launchApproachRate: number
3387
+ }>
3388
+
3389
+ export type AirborneModeOpts = Readonly<{
3390
+ /** Which movement type to switch to: \`GLIDING\` for gliders, \`FLOATING\` for balloons. */
3391
+ activeMovementType: MovementType
3392
+ /** How long the flying lasts, in milliseconds, before it drops the rider. \`null\` = no limit. */
3393
+ durationMs: PNull<number>
3394
+ /** Whether the flying ending also throws the rider off, as a popping balloon does. */
3395
+ exitsVehicleOnEnd: boolean
3396
+ }>
3397
+
3398
+ export type AirborneMovementOpts = HeadingAirborneMovement | CameraDirectionAirborneMovement
3399
+
3400
+ export type FallSpeedLimitOpts = Readonly<{
3401
+ /** The fastest it may fall, in blocks per second. */
3402
+ maxFallSpeed: number
3403
+ /** Roughly how long, in seconds, it takes to slow back to the limit. Smaller = a firmer catch. */
3404
+ slowDownSeconds: number
3405
+ /** Whether to also cancel gravity while holding it back, so the limit is not slowly overpowered. */
3406
+ compensateGravity: boolean
3407
+ }>
3408
+
3409
+ export type HeadingAirborneMovement = Readonly<{ model: "heading" }>
3410
+
3411
+ export type CameraDirectionAirborneMovement = Readonly<{
3412
+ model: "cameraDirection"
3413
+ /** The fastest it can fly. Better gliders get a bigger value, and dive and climb more sharply. */
3414
+ maxSpeed: number
3415
+ /** The slowest it can fly. It never stalls below this, however steeply it climbs. */
3416
+ minSpeed: number
3417
+ /** How much looking up or down changes its speed. Bigger = dives gain speed quickly. */
3418
+ pitchAcceleration: number
3419
+ /** How much drag slows it each tick. \`0\` = none. */
3420
+ friction: number
3421
+ /** How many ticks an outside shove - a fuel boost, or knockback - keeps its momentum before flight takes over again. */
3422
+ impulseDecayTicks: number
3423
+ /** How strongly it is nudged forwards, then gently downwards, so a level glider sinks slowly. */
3424
+ biasMagnitude: number
3425
+ /** How much leftover speed from a shove is shed each tick. */
3426
+ excessVelocityBleedPerTick: number
3427
+ }>
3428
+
3429
+ export type PerBlockVehicleSetting = (_TypeOf["perBlockVehicleSettings"])[number]
3430
+ //@ts-ignore
3431
+ export type VehicleSettingValue<TVehicleSetting extends StoredVehicleSetting> = ResolvedPhysicsSettings<PhysicsType>[TVehicleSetting]
3432
+
3433
+ export type BlockVehicleSettingValue<TSetting extends string> = {
3434
+ [TPerBlockSetting in PerBlockVehicleSetting]: TSetting extends string
3435
+ ? PerBlockVehicleSettingValue<TPerBlockSetting>
3436
+ : never
3437
+ }[PerBlockVehicleSetting]
3438
+ //@ts-ignore
3439
+ export type PerBlockVehicleSettingValue<TSetting extends PerBlockVehicleSetting> = VehicleSettingValue<string>[BlockName]
3440
+
3441
+ export type MeshEntityVehicleType = (_TypeOf["meshEntityVehiclesTypes"])[number]
3442
+
3443
+ export type VehicleSpawnOpts = Partial<{
3444
+ spawnerId: PlayerId
3445
+ }>
3446
+
3447
+ export type AngleDir = {
3448
+ theta: number
3449
+ phi: number
3450
+ }
3451
+
3452
+ export type BlockRaycastResult = PNull<{
3453
+ blockID: BlockId // The block ID of the block that was hit
3454
+ position: Pos // The position of the block that was hit
3455
+ normal: Pos // The normal of the face that was hit
3456
+ adjacent: Pos // The position of the block adjacent to the hit face
3457
+ }>
3458
+
3459
+ export type MeshParticleSystemUpdates = Record<EntityId, Record<NodeName, MeshParticleSystemUpdate>>
3460
+
3461
+ export type MeshParticleSystemUpdate = {
3462
+ particleSystemDir1?: number[]
3463
+ particleSystemDir2?: number[]
3464
+ particleSystemMinSize?: number
3465
+ particleSystemMaxSize?: number
3466
+ particleSystemPlayingState?: boolean
3467
+ particleSystemColorGradients?: TimeColorGradient[]
3468
+ }
3469
+
3470
+ export type UgcCurrencyInfo = {
3471
+ amount: number
3472
+ icon: string
3473
+ iconColour?: string
3474
+ persistent?: boolean
3475
+ hidden?: boolean
3476
+ subtext?: string | CustomTextStyling
3477
+ }
3478
+
3479
+ export type UserCallbacks = "tick" | "onClose" | "onPlayerJoin" | "onPlayerLeave" | "onPlayerJump" | "onRespawnRequest" | "playerCommand" | "onPlayerChat" | "onPlayerChangeBlock" | "onBlockStand" | "onBlockStandStart" | "onBlockStandStop" | "onPlayerAttemptCraft" | "onPlayerCraft" | "onPlayerAttemptOpenChest" | "onPlayerOpenedChest" | "onPlayerMoveItemOutOfInventory" | "onPlayerDropItem" | "onPlayerPickedUpItem" | "onPlayerSelectInventorySlot" | "onPlayerAttack" | "onPlayerDamagingOtherPlayer" | "onPlayerDamagingMob" | "onMobDamagingPlayer" | "onMobDamagingOtherMob" | "onAttemptKillPlayer" | "onPlayerKilledOtherPlayer" | "onMobKilledPlayer" | "onPlayerKilledMob" | "onMobKilledOtherMob" | "onPlayerPotionEffect" | "onPlayerDamagingMeshEntity" | "onPlayerBreakMeshEntity" | "onPlayerUsedThrowable" | "onPlayerThrowableHitTerrain" | "onTouchscreenActionButton" | "onPlayerMoveInvenItem" | "onPlayerMoveItemIntoIdxs" | "onPlayerSwapInvenSlots" | "onPlayerMoveInvenItemWithAmt" | "onPlayerAttemptAltAction" | "onPlayerAltAction" | "onPlayerClick" | "onPlayerClickUp" | "onClientOptionUpdated" | "onMobSettingUpdated" | "onInventoryUpdated" | "onChestUpdated" | "onWorldChangeBlock" | "onCreateBloxdMeshEntity" | "onEntityCollision" | "onPlayerAttemptSpawnMob" | "onWorldAttemptSpawnMob" | "onPlayerSpawnMob" | "onWorldSpawnMob" | "onWorldAttemptDespawnMob" | "onMobDespawned" | "onPlayerAttemptSpawnVehicle" | "onWorldAttemptSpawnVehicle" | "onPlayerSpawnVehicle" | "onWorldSpawnVehicle" | "onVehicleDespawned" | "onEntityDeleted" | "onChunkLoaded" | "onPlayerRequestChunk" | "onItemDropCreated" | "onPlayerStartChargingItem" | "onPlayerFinishChargingItem" | "onPlayerAttemptFish" | "onPlayerSucceededFishCatch" | "onPlayerFailedFishCatch" | "onPlayerFinishQTE" | "onPlayerToggledShopMenu" | "onPlayerBoughtShopItem" | "onPlayerPlayedEmote" | "onPlayerEnteredVehicle" | "onPlayerExitedVehicle" | "onUiRequestResponded" | "doPeriodicSave"
3480
+
3481
+ export type WorldGamemode = (_TypeOf["worldGamemodes"])[number]
3482
+
3483
+ export type QueuedCommandId = string
3484
+
3485
+ export type QueuedStatusString = (_TypeOf["QUEUED_COMMAND_STATUS_STRINGS"])[keyof _TypeOf["QUEUED_COMMAND_STATUS_STRINGS"]]
3486
+
3487
+ export type UiRequestClientParameters = {
3488
+ type: "standard" | "rewardedAd"
3489
+ title: string | CustomTextStyling
3490
+ icons?: string[]
3491
+ acceptText?: string | CustomTextStyling
3492
+ denyText?: string | CustomTextStyling
3493
+ successText?: string | CustomTextStyling
3494
+ autoDismissAfterMs?: number
3495
+ }
3496
+
3497
+ export type MultiBlockInfo = {
3498
+ positions: { block: string; id: number; x: number; y: number; z: number }[]
3499
+ }
3500
+
3501
+ export type BoughtShopItem = Omit<ShopItem, "boughtCallback" | "schematicId" | "isRewardedAd">
3502
+
3503
+ export type OnPlayerChatObjectResponse = Record<PlayerId, false | ChatMessageObject>
3504
+
3505
+ export type ChatMessageObject = {
3506
+ prefixContent?: ChatTags
3507
+ chatContent?: CustomTextStyling
3508
+ }
3509
+
3510
+ export type FishingAttemptOptions = {
3511
+ /** Item selected for this attempt's reward. Defaults to an engine-selected fish. */
3512
+ caughtItemName?: ItemName
3513
+ /** Delay after entering water, in milliseconds. Defaults to the rod's metadata config. */
3514
+ biteDelayMs?: number
3515
+ /** Defaults to a timed-click QTE with a nine-second window. */
3516
+ qte?: { [T in QTEType]: QTEClientParameters<T> }[QTEType]
3517
+ }
3518
+
3519
+ export interface _TypeOf {
3520
+ lifeformBodyParts: readonly ["Torso", "Head", "ArmRight", "ArmLeft", "LegLeft", "LegRight"]
3521
+ enchantmentPerks: readonly ["Damage", "Attack Speed", "Critical Damage", "Protection", "Health", "Health Regen", "Stomp Damage", "Knockback Resist", "Arrow Speed", "Arrow Damage", "Quick Charge", "Break Speed", "Momentum", "Mining Yield", "Farming Yield", "Mining Aura", "Digging Aura", "Lumber Aura", "Farming Aura", "Horizontal Knockback", "Vertical Knockback"]
3522
+ enchantmentTiers: readonly ["Tier 1", "Tier 2", "Tier 3", "Tier 4", "Tier 5"]
3523
+ ranks: readonly ["developer", "admin", "super", "youtuber", "creatorLevel1", "creatorLevel2", "creatorLevel3"]
3524
+ noaActions: readonly ["forward", "backward", "left", "right", "sprint", "jump", "crouch", "primary-fire", "alt-fire", "SpecialAction1", "SpecialAction2", "ReloadGun", "DropItem", "mid-fire", "Zoom", "SwapCameraZoom", "OpenInventory", "OpenLobbyLeaderboard", "OpenShop", "OpenCharacterCustomization", "OpenSettings", "OpenInviteLink", "OpenTasksAndLeaderboard", "OpenCodeEditor", "OpenEmoteWheel", "HideUi", "ShowDebugOverlay", "HotBarSlot1", "HotBarSlot2", "HotBarSlot3", "HotBarSlot4", "HotBarSlot5", "HotBarSlot6", "HotBarSlot7", "HotBarSlot8", "HotBarSlot9", "HotBarSlot10", "toggleFreeCam", "freeCamForward", "freeCamBackward", "freeCamLeft", "freeCamRight", "freeCamUp", "freeCamDown", "recordGame", "recordClip", "replayViewerOpen", "replayPlayPause", "replaySkipBack", "replaySkipForward", "replayChangeCameraMode", "replayLoad", "replaySave", "replaySaveAs", "replayExit", "replaySpeedUp", "replaySpeedDown", "replayTimelineZoomIn", "replayTimelineZoomOut", "replayRecordKeyframe", "replayExportVideo"]
3525
+ shopItemBadgeTypes: readonly ["new", "lucky"]
3526
+ playerMeshNamedNodes: readonly ["TorsoNode", "HeadMesh", "ArmRightMesh", "ArmLeftMesh", "LegLeftMesh", "LegRightMesh"]
3527
+ healthbarDisplays: readonly ["always", "never", "onDamage"]
3528
+ nameTagBorderStyles: readonly ["solid", "glow", "double"]
3529
+ nameTagBorderTargets: readonly ["both", "nametag", "healthbar"]
3530
+ particlePresets: { readonly damageInner: unknown; readonly damageOuter: unknown; readonly bouncinessInner: unknown; readonly bouncinessOuter: unknown; readonly healthRegenInner: unknown; readonly healthRegenOuter: unknown; readonly speedInner: unknown; readonly speedOuter: unknown; readonly damageReductionInner: unknown; readonly damageReductionOuter: unknown; readonly invisibleInner: unknown; readonly invisibleOuter: unknown; readonly jumpBoostInner: unknown; readonly jumpBoostOuter: unknown; readonly knockbackInner: unknown; readonly knockbackOuter: unknown; readonly poisonedInner: unknown; readonly poisonedOuter: unknown; readonly slownessInner: unknown; readonly slownessOuter: unknown; readonly weaknessInner: unknown; readonly weaknessOuter: unknown; readonly cleansedInner: unknown; readonly cleansedOuter: unknown; readonly instantDamageInner: unknown; readonly instantDamageOuter: unknown; readonly instantHealthInner: unknown; readonly instantHealthOuter: unknown; readonly hasteInner: unknown; readonly hasteOuter: unknown; readonly shieldInner: unknown; readonly shieldOuter: unknown; readonly doubleJumpInner: unknown; readonly doubleJumpOuter: unknown; readonly heatResistanceInner: unknown; readonly heatResistanceOuter: unknown; readonly thiefInner: unknown; readonly thiefOuter: unknown; readonly miningYieldInner: unknown; readonly miningYieldOuter: unknown; readonly brainRotInner: unknown; readonly brainRotOuter: unknown; readonly auraInner: unknown; readonly auraOuter: unknown; readonly wallClimbingInner: unknown; readonly wallClimbingOuter: unknown; readonly airWalkInner: unknown; readonly airWalkOuter: unknown; readonly pickpocketerInner: unknown; readonly pickpocketerOuter: unknown; readonly lifestealInner: unknown; readonly lifestealOuter: unknown; readonly blindnessInner: unknown; readonly blindnessOuter: unknown; readonly poopyInner: unknown; readonly poopyOuter: unknown; readonly glowingInner: unknown; readonly glowingOuter: unknown; readonly nightVisionInner: unknown; readonly nightVisionOuter: unknown; readonly xRayVisionInner: unknown; readonly xRayVisionOuter: unknown; readonly defaultFirecrackerSmall: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly defaultFirecrackerLarge: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mango: unknown; readonly yellowFirecrackerSmall: unknown; readonly yellowFirecrackerLarge: unknown; readonly limeFirecrackerSmall: unknown; readonly limeFirecrackerLarge: unknown; readonly greenFirecrackerSmall: unknown; readonly greenFirecrackerLarge: unknown; readonly cyanFirecrackerSmall: unknown; readonly cyanFirecrackerLarge: unknown; readonly blueFirecrackerSmall: unknown; readonly blueFirecrackerLarge: unknown; readonly purpleFirecrackerSmall: unknown; readonly purpleFirecrackerLarge: unknown; readonly pinkFirecrackerSmall: unknown; readonly pinkFirecrackerLarge: unknown; readonly redFirecrackerSmall: unknown; readonly redFirecrackerLarge: unknown; readonly orangeFirecrackerSmall: unknown; readonly orangeFirecrackerLarge: unknown; readonly blackFirecrackerSmall: unknown; readonly blackFirecrackerLarge: unknown; readonly brownFirecrackerSmall: unknown; readonly brownFirecrackerLarge: unknown; readonly grayFirecrackerSmall: unknown; readonly grayFirecrackerLarge: unknown; readonly lightBlueFirecrackerSmall: unknown; readonly lightBlueFirecrackerLarge: unknown; readonly lightGrayFirecrackerSmall: unknown; readonly lightGrayFirecrackerLarge: unknown; readonly magentaFirecrackerSmall: unknown; readonly magentaFirecrackerLarge: unknown; readonly whiteFirecrackerSmall: unknown; readonly whiteFirecrackerLarge: unknown; readonly brainRot: unknown; readonly stomp: unknown; readonly fertiliser: unknown; readonly bonemeal: unknown; readonly mobTameSuccess: unknown; readonly mobTameFailure: unknown; readonly mobCatch: unknown; readonly spawnCaughtMob: unknown; readonly mobFeedDefault: unknown; readonly mobFeedSuperliked: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobFeedLike: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobFeedNeutral: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobFeedDisliked: { readonly colorGradients: TimeColorGradient[]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobDeath: unknown; readonly mobDeathSoul: unknown; readonly boardShopSuccess: unknown; readonly mobSpawnerBlockFail: { readonly colorGradients: [{ readonly timeFraction: 0; readonly minColor: [80, 80, 80, 1]; readonly maxColor: [160, 160, 160, 1]; }]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobSpawnerBlockPassive: { readonly colorGradients: [{ readonly timeFraction: 0; readonly minColor: [0, 200, 50, 1]; readonly maxColor: [0, 255, 100, 1]; }]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobSpawnerBlockNeutral: { readonly colorGradients: [{ readonly timeFraction: 0; readonly minColor: [200, 200, 0, 1]; readonly maxColor: [255, 255, 0, 1]; }]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobSpawnerBlockHostile: { readonly colorGradients: [{ readonly timeFraction: 0; readonly minColor: [200, 10, 0, 1]; readonly maxColor: [255, 20, 0, 1]; }]; readonly texture: string; readonly minLifeTime: number; readonly maxLifeTime: number; readonly minEmitPower: number; readonly maxEmitPower: number; readonly minSize: number; readonly maxSize: number; readonly gravity: number[]; readonly velocityGradients: VelocityGradient[]; readonly blendMode: ParticleSystemBlendMode; readonly dir1: number[]; readonly dir2: number[]; readonly manualEmitCount: number; readonly hideDist: number; }; readonly mobSpawnOrb: unknown; readonly aura: unknown; }
3531
+ gunCategories: readonly ["semi_automatic", "submachine", "rifle", "pistol", "shotgun"]
3532
+ customItemStats: readonly ["ttb", "displayName", "harvestLevel", "stoodOnSpeedMultiplier", "specialToolDrop", "specialToolBonusDrops", "description", "altActionable", "eatHealAmt", "eatShieldAmt", "damage", "attackRange", "attackCooldownMs", "secondaryDamage", "absorbThrowable", "armourReduction", "CrosshairText", "gunStats", "showInCreativeInven"]
3533
+ lifeformTypes: readonly ["Player", "Pig", "Cow", "Sheep", "Horse", "Deer", "Slime", "Wolf", "Wildcat", "Spirit Golem", "Spirit Wolf", "Spirit Bear", "Spirit Stag", "Spirit Gorilla", "Bear", "Stag", "Gold Watermelon Stag", "Gorilla", "Cave Golem", "Draugr Zombie", "Draugr Skeleton", "Frost Golem", "Frost Zombie", "Frost Skeleton", "Draugr Knight", "Draugr Huntress", "Magma Golem", "Draugr Warper", "Frost Wraith", "Draugr Reaver", "Stalker", "Crone", "Iron Guardian", "Gold Guardian", "Diamond Guardian", "Moonstone Guardian", "NPC", "67", "Bobino Musculino", "Capitano Explovissimo"]
3534
+ cosmeticTypes: readonly ["skin", "hat", "head", "eyebrows", "eyes", "back", "body", "legs", "shoes", "cape", "nameColour", "profileEffect", "emote"]
3535
+ playerPoses: readonly ["standing", "sitting", "zombie", "gliding", "driving", "sleeping", "riding"]
3536
+ mobVariations: { readonly Pig: readonly ["default"]; readonly Cow: readonly ["default", "cream"]; readonly Sheep: readonly ["default", "black", "red", "orange", "pink", "purple", "yellow", "blue", "brown", "cyan", "gray", "green", "lightBlue", "lightGray", "lime", "magenta"]; readonly Horse: readonly ["default", "black", "brown", "cream"]; readonly Slime: readonly ["default"]; readonly "Cave Golem": readonly ["default", "iron", "corrupted"]; readonly "Draugr Zombie": readonly ["default", "longHairChestplate", "longHairClothed", "shortHairClothed", "flower", "flower2", "mushroom", "vine", "vine2", "corrupted", "corrupted2"]; readonly "Draugr Skeleton": readonly ["default"]; readonly "Frost Golem": readonly ["default"]; readonly "Frost Zombie": readonly ["default", "longHairChestplate", "shortHairClothed"]; readonly "Frost Skeleton": readonly ["default"]; readonly "Draugr Knight": readonly ["default"]; readonly Wolf: readonly ["default", "white", "brown", "grey", "spectral"]; readonly Bear: readonly ["default"]; readonly Deer: readonly ["default"]; readonly Stag: readonly ["default"]; readonly "Gold Watermelon Stag": readonly ["default"]; readonly Gorilla: readonly ["default"]; readonly Wildcat: readonly ["default", "tabby", "grey", "black", "calico", "siamese", "leopard"]; readonly "Magma Golem": readonly ["default"]; readonly "Draugr Huntress": readonly ["default", "chainmail"]; readonly "Spirit Golem": readonly ["default"]; readonly "Spirit Wolf": readonly ["default"]; readonly "Spirit Bear": readonly ["default"]; readonly "Spirit Stag": readonly ["default"]; readonly "Spirit Gorilla": readonly ["default"]; readonly "Draugr Warper": readonly ["default"]; readonly "Frost Wraith": readonly ["default"]; readonly "Draugr Reaver": readonly ["default"]; readonly Stalker: readonly ["default", "crimson", "frost", "void"]; readonly Crone: readonly ["default"]; readonly "Iron Guardian": readonly ["default"]; readonly "Gold Guardian": readonly ["default"]; readonly "Diamond Guardian": readonly ["default"]; readonly "Moonstone Guardian": readonly ["default"]; readonly NPC: readonly ["default", "emma", "leo", "isabel", "sanjay", "imara", "enoch", "sara", "carmen"]; readonly "67": readonly ["default"]; readonly "Bobino Musculino": readonly ["default"]; readonly "Capitano Explovissimo": readonly ["default"]; }
3537
+ mobTypes: readonly ["Pig", "Cow", "Sheep", "Horse", "Deer", "Slime", "Wolf", "Wildcat", "Spirit Golem", "Spirit Wolf", "Spirit Bear", "Spirit Stag", "Spirit Gorilla", "Bear", "Stag", "Gold Watermelon Stag", "Gorilla", "Cave Golem", "Draugr Zombie", "Draugr Skeleton", "Frost Golem", "Frost Zombie", "Frost Skeleton", "Draugr Knight", "Draugr Huntress", "Magma Golem", "Draugr Warper", "Frost Wraith", "Draugr Reaver", "Stalker", "Crone", "Iron Guardian", "Gold Guardian", "Diamond Guardian", "Moonstone Guardian", "NPC", "67", "Bobino Musculino", "Capitano Explovissimo"]
3538
+ mobSettings: readonly ["variation", "name", "maxHealth", "initialHealth", "idleSound", "attackSound", "secondaryAttackSound", "hurtSound", "onDeathItemDrops", "onDeathParticleTexture", "onDeathAura", "baseWalkingSpeed", "baseRunningSpeed", "walkingSpeedMultiplier", "runningSpeedMultiplier", "jumpCount", "baseJumpImpulseXZ", "baseJumpImpulseY", "jumpMultiplier", "runAwayRadius", "chaseRadius", "territoryRadius", "hostilityRadius", "stoppingRadius", "attackInterval", "attackRadius", "secondaryAttackRadius", "attackDamage", "secondaryAttackDamage", "isReceivingDamageCooldownGlobal", "knockbackReceivedMultiplier", "attackImpulse", "secondaryAttackImpulse", "rangedAttackInaccuracy", "burstAttackInfo", "secondaryBurstAttackInfo", "heldItemName", "heldItemEnchantmentTier", "armour", "attackItemName", "secondaryAttackItemName", "swingArmOnAttack", "swingArmOnSecondaryAttack", "attackEffectName", "attackEffectDuration", "warpTargetSpecialAttackInfo", "combatTetherInfo", "evadeInfo", "chargeSpecialAttackInfo", "tameInfo", "onTamedHealthMultiplier", "petInfo", "ownerDbId", "minFollowingRadius", "maxFollowingRadius", "isRideable", "healthRegen", "ridingSpeedMult", "bridgeInfo", "walkingSlideInfo", "runningSlideInfo", "walkingJumpInfo", "runningJumpInfo", "walkingRandomFacingInfo", "runningRandomFacingInfo", "metaInfo"]
3539
+ armourPieces: readonly ["Helmet", "Chestplate", "Gauntlets", "Leggings", "Boots"]
3540
+ potionEffects: readonly ["Speed", "Damage Reduction", "Damage", "Invisible", "Jump Boost", "Knockback", "Poisoned", "Slowness", "Weakness", "Cleansed", "Instant Damage", "Health Regen", "Instant Health", "Haste", "Shield", "Double Jump", "Heat Resistance", "Thief", "X-Ray Vision", "Mining Yield", "Brain Rot", "Aura", "Wall Climbing", "Air Walk", "Pickpocketer", "Lifesteal", "Bounciness", "Blindness", "Poopy", "Glowing", "Night Vision"]
3541
+ MAX_MOB_FEED_LEVEL: 5
3542
+ mobLevelUpBonuses: readonly ["Renaming", "Special Drops", "Thorns", "Rainbow Wool", "Max Health +", "Damage +", "Riding Speed +", "Double Poop", "Self Yield", "Painting", "Friends", "Pack Leader", "Poison Claws", "Mob Power", "Mob Yield", "Feed Aura", "Antlers"]
3543
+ mobAiStates: readonly ["idle", "disabled", "idleBeforeTurning", "turning", "idleBeforeWalking", "walking", "runningAway", "chasing", "turningBeforeCharging", "charging", "following", "watching", "walkingToPosition", "runningToPosition"]
3544
+ ingameIconNames: readonly ["Damage", "Damage Reduction", "Speed", "VoidJump", "Fist", "Frozen", "Hydrated", "Invisible", "Jump Boost", "Poisoned", "Slowness", "Weakness", "Health Regen", "Haste", "Double Jump", "Heat Resistance", "Gliding", "Boating", "Obsidian Boating", "Riding", "Bunny Hop", "FallDamage", "Feather Falling", "Thief", "X-Ray Vision", "Mining Yield", "Brain Rot", "Rested Damage", "Rested Haste", "Rested Speed", "Rested Farming Yield", "Rested Aura", "Blindness", "Pickpocketer", "Lifesteal", "Bounciness", "Air Walk", "Wall Climbing", "Thorns", "Poopy", "Glowing", "Night Vision", "Draugr Knight Head", "Draugr Warper Head", "Magma Golem Head", "Mystery Fish", "Damage Enchantment", "Critical Damage Enchantment", "Attack Speed Enchantment", "Protection Enchantment", "Health Enchantment", "Health Regen Enchantment", "Stomp Damage Enchantment", "Knockback Resist Enchantment", "Arrow Speed Enchantment", "Arrow Damage Enchantment", "Quick Charge Enchantment", "Break Speed Enchantment", "Momentum Enchantment", "Mining Yield Enchantment", "Farming Yield Enchantment", "Mining Aura Enchantment", "Digging Aura Enchantment", "Lumber Aura Enchantment", "Farming Aura Enchantment", "Vertical Knockback Enchantment", "Horizontal Knockback Enchantment", "Self Yield", "Friends", "Riding Speed", "Feed Aura", "Double Poop", "Mob Slayer", "Rainbow Wool", "Pack Leader", "Max Health", "Poison Claws", "Mob Yield", "Antlers Bonus", "Health", "HealthShield", "Cross", "Friendship", "Dotted Friendship", "Hunger", "Empty Hunger", "Pixelated Heart", "Question Mark", "Trader Black", "Trader Blue", "Trader Piggy"]
3545
+ perBlockVehicleSettings: readonly ["canAutoStep", "speedMultiplier"]
3546
+ meshEntityVehiclesTypes: readonly ["Boat", "Obsidian Boat", "Hovercraft", "Yellow Kart", "White Kart", "Red Kart", "Purple Kart", "Pink Kart", "Orange Kart", "Magenta Kart", "Lime Kart", "Light Gray Kart", "Light Blue Kart", "Green Kart", "Gray Kart", "Cyan Kart", "Brown Kart", "Blue Kart", "Black Kart", "Off Roader", "Light Blue Car", "Speedboat"]
3547
+ worldGamemodes: readonly ["survival", "peaceful", "creative", "survivaladventure", "peacefuladventure", "spectator"]
3548
+ QUEUED_COMMAND_STATUS_STRINGS: { readonly 0: "NOT_IN_QUEUE"; readonly 1: "WAITING_TO_RUN"; readonly 2: "CURRENTLY_RUNNING"; }
3549
+ ItemMetaInfo: {
3550
+ readonly rootName: string
3551
+ readonly rootId: number
3552
+ readonly metaStr: string
3553
+ readonly rot: number | null
3554
+ readonly open: boolean | null
3555
+ readonly halfblockPlacement: HalfblockPlacement | null
3556
+ readonly growing: true | null
3557
+ readonly treeBase: true | null
3558
+ readonly treeCanopy: true | null
3559
+ readonly books: number | null
3560
+ readonly freshlyGrown: true | null
3561
+ readonly roots: true | null
3562
+ readonly lava: true | null
3563
+ readonly top: true | null
3564
+ readonly grassRoots: true | null
3565
+ readonly breaking: true | null
3566
+ readonly flashing: true | null
3567
+ readonly charging: number | null
3568
+ readonly direction: number | null
3569
+ readonly requiresAmmo: true | null
3570
+ readonly woodType: string | null
3571
+ readonly caughtMobType: MobType | null
3572
+ }
3573
+ BlockMetadataItem: {
3574
+ displayName: string | TranslatedText | CustomTextStyling
3575
+ ttb?: number
3576
+ textureInfo: | string
3577
+ | (string | AnimParams)[]
3578
+ | [number, number, number, number?]
3579
+ | ({
3580
+ colour?: [number, number, number, number?]
3581
+ } & AnimParams)
3582
+ texturePerSide: number[]
3583
+ harvestType: HarvestType
3584
+ transTex: boolean
3585
+ model: BlockMetadataModelType | string
3586
+ itemTexture: string
3587
+ drops: string
3588
+ solid: boolean
3589
+ heldItemScale: number
3590
+ modelScale: number
3591
+ meta: ItemMetaInfo
3592
+ rootMetaDesc: string
3593
+ particlesIgnoreBlack: boolean
3594
+ harvestLevel: number
3595
+ fluid: boolean
3596
+ specialToolDrop: SpecialToolDrop
3597
+ specialToolBonusDrops: RecursiveReadonly<Record<string, { bonusDrop: string; probabilityOfDrop: number }[]>>
3598
+ damage: number
3599
+ stoodOnSpeedMultiplier: number
3600
+ description: string | TranslatedText | CustomTextStyling
3601
+ altActionable: boolean
3602
+ soundType: { break: SoundType; place: SoundType }
3603
+ unlitStandaloneMesh: boolean
3604
+ customPlanesInfo: { textureIdx: number; yRot: number }[]
3605
+ customModelInfo: {
3606
+ yOffset?: number
3607
+ /** Only honoured by onRotatableCreate. */
3608
+ yRotOffset?: number
3609
+ /** Only honoured by onRotatableCreate. */
3610
+ xRotOffset?: number
3611
+ unlit?: boolean
3612
+ emissiveColor?: Vec3
3613
+ backFaceCulling?: boolean
3614
+ }
3615
+ absorbThrowable?: boolean
3616
+ CrosshairText?: string | CustomTextStyling
3617
+ /** Light emission as [R, G, B], each 0-15. Omit for no emission. */
3618
+ lightEmission?: Vec3
3619
+ /** Sky light emission level: null or 0-15. 0 is equivalent to null (no emission). */
3620
+ skyLightEmission?: number
3621
+ /** Light attenuation when light passes through this block. Default: 1 for air/transparent, 3 for fluid, 15 for opaque. */
3622
+ lightFilter?: number
3623
+ name: string
3624
+ id: number
3625
+ atlasIdx: number | number[]
3626
+ stackable: boolean
3627
+ heldItemGlb?: string
3628
+ blockModel: string
3629
+ blockModelItem: boolean
3630
+ twoDBlockItem: boolean
3631
+ rotatableOffsetAmt: number
3632
+ canBePlacedOver: boolean
3633
+ onMinedAura: number
3634
+ showInCreativeInven?: boolean
3635
+ gunStats?: GunStatsOverride
3636
+ }
3637
+ NonBlockMetadataItem: {
3638
+ displayName?: string | TranslatedText | CustomTextStyling
3639
+ type: "Item" | "Tool" | "Gun" | "FullAuto" | "Armour" | "GrayscaleArmour" | "Chargeable"
3640
+ textureInfo: string | string[] | [number, number, number, number?]
3641
+ weight: number
3642
+ heldItemScale: number
3643
+ heldItemGlb?: string
3644
+ /** Extra Euler rotation (radians) applied only to the first-person held mesh, on top of the default hand pose. */
3645
+ firstPersonHeldRotationOffset?: Vec3
3646
+ /** Extra Euler rotation (radians) applied only to the third-person held mesh, on top of the default pose. */
3647
+ thirdPersonHeldRotationOffset?: Vec3
3648
+ description?: string | TranslatedText | CustomTextStyling
3649
+ stackable: boolean
3650
+ eatable?: boolean
3651
+ chargeSound?: string
3652
+ afterEatenItem?: ItemName
3653
+ eatShieldAmt?: number
3654
+ eatHealAmt?: number
3655
+ chargeStages?: number
3656
+ chargeTime?: number
3657
+ minChargeStateToUse?: number
3658
+ damage?: number
3659
+ attackRange?: number
3660
+ secondaryDamage?: number
3661
+ holdAsAiming?: boolean
3662
+ hideAimingUI?: boolean
3663
+ requiresArrow?: boolean
3664
+ knockbackHorizontalScalar?: number
3665
+ knockbackVerticalScalar?: number
3666
+ attackCooldownMs?: number
3667
+ abilityCooldownMs?: number
3668
+ dashImpulse?: number
3669
+ comboInfo?: WeaponComboInfo
3670
+ velocityMultiplier?: number
3671
+ fishingRodInfo?: {
3672
+ /** Minimum and maximum engine fishing bite delay, in milliseconds. */
3673
+ biteDelayMs: readonly [number, number]
3674
+ }
3675
+ harvests?: HarvestType
3676
+ multiplier?: number
3677
+ level?: number
3678
+ lumberjackHeight?: number
3679
+ armourReduction?: number
3680
+ knockbackReduction?: number
3681
+ id?: number
3682
+ name?: string
3683
+ isCustom?: boolean
3684
+ /** Light emission as [R, G, B], each 0-15. Omit for no emission. */
3685
+ lightEmission?: Vec3
3686
+ /** Spotlight reach in blocks. When set, the local player emits a directional beam (instead of the default omnidirectional held light) while holding this item, or wearing it if a helmet. */
3687
+ spotlightRange?: number
3688
+ /** Full cone apex angle in degrees (smaller = tighter beam). Only used with \`spotlightRange\`; omit for the default width. */
3689
+ spotlightConeAngle?: number
3690
+ meta?: ItemMetaInfo
3691
+ rootMetaDesc?: string
3692
+ keepMetaInChest?: boolean
3693
+ gunType?: GunCategory
3694
+ scopeType?: "none" | "sniper"
3695
+ muzzleFlashOffsetFromGun?: Vec3
3696
+ muzzleFlashScale?: number
3697
+ autoFireWithMouse?: boolean
3698
+ fireRate?: number
3699
+ fireRateWithHeldTouch?: number
3700
+ burstCount?: number
3701
+ burstDelay?: number
3702
+ shotPelletCount?: number
3703
+ reloadTime?: number
3704
+ clipSize?: number
3705
+ reloadBulletsIndividually?: boolean
3706
+ bulletReloadTime?: number
3707
+ cockTime?: number
3708
+ tagSpeedMult?: number
3709
+ subsequentTagSpeedReductionScalar?: number
3710
+ inaccuracyStanding?: number
3711
+ inaccuracyFromShot?: number
3712
+ inaccuracyMovement?: number
3713
+ yVelocityInaccuracy?: number
3714
+ inaccuracyFromJump?: number
3715
+ altInaccuracyStanding?: number
3716
+ altInaccuracyFromShot?: number
3717
+ altInaccuracyMovement?: number
3718
+ recoveryRate?: number
3719
+ aimZoomFactor?: number
3720
+ kickbackDecreaseRate?: number
3721
+ minKickback?: number
3722
+ maxKickback?: number
3723
+ kickbackRate?: number
3724
+ hasVerticalInaccuracy?: boolean
3725
+ keepScopeOnShot?: boolean
3726
+ msPerRound?: number
3727
+ msPerRoundTouchScreen?: number
3728
+ altYVelocityInaccuracy?: number
3729
+ altInaccuracyFromJump?: number
3730
+ fireInterval?: number
3731
+ gunStats?: GunStatsOverride
3732
+ showInCreativeInven?: boolean
3733
+ }
3734
+ LoadedChunk: {
3735
+ anySetsRan: boolean
3736
+ readonly lastUpdated: number
3737
+ set(x: number, y: number, z: number, id: BlockId): void
3738
+ get(x: number, y: number, z: number): number
3739
+ /**
3740
+ * Returns the underlying array of the chunk
3741
+ * This exists for performance reasons only
3742
+ * Be careful using this - updating the data directly without calling set or setUnderlying will result in inconsistent state
3743
+ */
3744
+ getUnderlyingData(): Uint16Array<ArrayBufferLike>
3745
+ setUnderlying(idx: number, id: BlockId): void
3746
+ }
3747
+ }
3748
+
3749
+ export type ItemMetaInfo = _TypeOf["ItemMetaInfo"]
3750
+
3751
+ export type BlockMetadataItem = _TypeOf["BlockMetadataItem"]
3752
+
3753
+ export type NonBlockMetadataItem = _TypeOf["NonBlockMetadataItem"]
3754
+
3755
+ export type LoadedChunk = _TypeOf["LoadedChunk"]
3756
+
3757
+ export type Song = "Adigold - A Place To Be Free" | "Adigold - Butterfly Effect" | "Adigold - Dreamless Sleep" | "Adigold - Frozen Pulse" | "Adigold - Frozen Skies" | "Adigold - Healing Thoughts" | "Adigold - Here Forever" | "Adigold - Just a Little Hope" | "Adigold - Just Like Heaven" | "Adigold - Memories Remain" | "Adigold - Place To Be" | "Adigold - The Riverside" | "Adigold - The Wonder" | "Adigold - Vetrar (Cut B)" | "Awkward Comedy Quirky" | "battle-ship-111902" | "cdk-Silence-Await" | "corsairs-studiokolomna-main-version-23542-02-33" | "ghost-Reverie-small-theme" | "happy" | "Heroic-Demise-New" | "I-am-the-Sea-The-Room-4" | "Juhani Junkala [Retro Game Music Pack] Ending" | "Juhani Junkala [Retro Game Music Pack] Level 1" | "Juhani Junkala [Retro Game Music Pack] Level 2" | "Juhani Junkala [Retro Game Music Pack] Level 3" | "Juhani Junkala [Retro Game Music Pack] Title Screen" | "LonePeakMusic-Highway-1" | "Mojo Productions - Pirates" | "Mojo Productions - Sneaky Jazz" | "Mojo Productions - The Sneaky" | "Mojo Productions - The Sneaky Jazz" | "progress" | "raise-the-sails-152124" | "ramblinglibrarian-I-Have-Often-T" | "Slow-Motion-Bensound" | "snowflake-Ethereal-Space" | "the-epic-adventure-131399" | "TownTheme" | "The Suspense Ambient" | "Epic1" | "Epic2" | "Emotional Epic" | "Enemy Marked"
3758
+
3759
+ export type ParticleSystemBlendMode = 0 | 1 | 2 | 3 | 4
3760
+
3761
+ export type HalfblockPlacement = 0 | 1 | 2
3762
+
3763
+ export type WalkThroughType = 0 | 1 | 2
3764
+
3765
+ export type LobbyType = 0 | 1 | 2
3766
+
3767
+ export type PhysicsType = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7
3768
+
3769
+ export type BoatTier = 0 | 1 | 2
3770
+
3771
+ export type GliderTier = 0 | 1 | 2 | 3
3772
+
3773
+ export type BalloonTier = 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15
3774
+
3775
+ export type SleepingTier = 0 | 1 | 2 | 3
3776
+
3777
+ export type CarTier = 0 | 1 | 2
3778
+
3779
+ export type MovementType = 0 | 1 | 2
3780
+
3781
+ export type ExplosionType = 0 | 1 | 2
3782
+
3783
+ export type ClientOptions = {
3784
+ canChange: boolean
3785
+ ezBridging: boolean
3786
+ speedMultiplier: number
3787
+ crouchingSpeed: number
3788
+ /** you should probably use speed multiplier - this doesn't make much sense on phone */
3789
+ walkingSpeed: number
3790
+ /** you should probably use speed multiplier - this doesn't make much sense on phone */
3791
+ runningSpeed: number
3792
+ jumpAmount: number
3793
+ airJumpCount: number
3794
+ bunnyhopMaxMultiplier: number
3795
+ music: Song
3796
+ musicVolumeLevel: number
3797
+ /** Not recommended to use as it lags when being loaded. */
3798
+ skyBox: string | EarthSkyBox
3799
+ minChunkAddDist: [number, number]
3800
+ showPlayersInUnloadedChunks: boolean
3801
+ useInventory: boolean
3802
+ /** For now just enables the full inventory UI */
3803
+ useFullInventory: boolean
3804
+ canCraft: boolean
3805
+ canFish: boolean
3806
+ canPickUpItems: boolean
3807
+ playerZoom: number
3808
+ zoomOutDistance: number
3809
+ maxPlayerZoom: number
3810
+ lobbyLeaderboardInfo: LobbyLeaderboardInfo
3811
+ canCustomiseChar: boolean
3812
+ /** used if canChange is true but useInventory is false */
3813
+ defaultBlock: string
3814
+ cantChangeError: string | CustomTextStyling
3815
+ cantBreakError: string | CustomTextStyling
3816
+ cantBuildError: string | CustomTextStyling
3817
+ /** The contents of the action button. Supports custom text styling. onTouchscreenActionButton will be called when button pressed. */
3818
+ touchscreenActionButton: string | CustomTextStyling
3819
+ strictFluidBuckets: boolean
3820
+ canUseZoomKey: boolean
3821
+ canAltAction: boolean
3822
+ canSeeNametagsThroughWalls: boolean
3823
+ showBasicMovementControls: boolean
3824
+ /** Centred text at the very top of the screen, level with the FPS counter / coordinates / room name. Drops below that strip when a centred placement would overlap it. */
3825
+ middleTextTop: string | CustomTextStyling | TextWithDisplayOptions
3826
+ middleTextUpper: string | CustomTextStyling | TextWithDisplayOptions
3827
+ middleTextLower: string | CustomTextStyling | TextWithDisplayOptions
3828
+ /** A row of compact chips rendered in the top-left HUD strip, concatenated immediately after the FPS counter / coordinates / room name. */
3829
+ headerChips: HeaderChip[]
3830
+ /** Lobby-only subtitle shown after the custom game name in the top-left header */
3831
+ customVariationTitle: string
3832
+ RightInfoText: string | CustomTextStyling | TextWithDisplayOptions
3833
+ crosshairText: string | CustomTextStyling
3834
+ /** If set, clients will only be able to see the closest x players (good for client perf in games with many players) */
3835
+ numClosestPlayersVisible: number
3836
+ showProgressBar: boolean
3837
+ showKillfeed: boolean
3838
+ /** Whether the viewer renders speech bubbles above other players when they send chat messages. Off by default. */
3839
+ showChatBubbles: boolean
3840
+ /** Allows player to select a channel that is passed as argument to onPlayerChat. See engineGameplayTypes.ts for expected format */
3841
+ chatChannels: { channelName: string; elementContent: string | CustomTextStyling; elementBgColor: string; }[]
3842
+ creative: boolean
3843
+ /** while in creative */
3844
+ flySpeedMultiplier: number
3845
+ /** Ignored if creative is false */
3846
+ canPickBlocks: boolean
3847
+ /** Position of the compass target. If string, will be parsed as a player id */
3848
+ compassTarget: string | number | number[]
3849
+ ttbMultiplier: number
3850
+ /** only applicable if useInventory is true */
3851
+ inventoryItemsMoveable: boolean
3852
+ invincible: boolean
3853
+ maxShield: number
3854
+ /** Shield upon joining and respawn. */
3855
+ initialShield: number
3856
+ maxHealth: number
3857
+ /** Health upon joining and respawn. Can be null for the player to not have health. */
3858
+ initialHealth: number
3859
+ /** Fraction of max health that regens each regen tick */
3860
+ healthRegenAmount: number
3861
+ /** How often health regen is ticked */
3862
+ healthRegenInterval: number
3863
+ /** How long after a player receives damage to start regen again */
3864
+ healthRegenStartAfter: number
3865
+ /** Duration of the +damage effect from plum */
3866
+ effectDamageDuration: number
3867
+ /** Duration of +speed effect from cracked coconut */
3868
+ effectSpeedDuration: number
3869
+ /** Duration of +damage reduction effect from pear */
3870
+ effectDamageReductionDuration: number
3871
+ /** Duration of +health regen effect from cherry */
3872
+ effectHealthRegenDuration: number
3873
+ /** Duration of potion effects */
3874
+ potionEffectDuration: number
3875
+ /** Duration of splash potion effects */
3876
+ splashPotionEffectDuration: number
3877
+ /** Duration of arrow potion effects */
3878
+ arrowPotionEffectDuration: number
3879
+ /** RGBA array [r, g, b, a] for camera screen tint effect. Values fall between 0 and 1. */
3880
+ cameraTint: [number, number, number, number]
3881
+ /** Fog distance which overrides graphic settings. Uses graphic settings if null. */
3882
+ fogChunkDistanceOverride: number
3883
+ /** Fog colour override - as a hex string e.g. #ffffff */
3884
+ fogColourOverride: string
3885
+ /** Applies fog to the skybox, which is otherwise unaffected by fog */
3886
+ fogOnSkybox: boolean
3887
+ /** After dying, the player can respawn after this many seconds */
3888
+ secsToRespawn: number
3889
+ /** When player is dead, also shows a play again button matchmakes player into a new lobby. Mostly useful for sessionBased games */
3890
+ usePlayAgainButton: boolean
3891
+ /** If true, player will respawn automatically after secsToRespawn seconds. Won't show an ad so autoRespawn needs to be false some of the time */
3892
+ autoRespawn: boolean
3893
+ /** Text to show on respawn button. (E.g. "Spectate") */
3894
+ respawnButtonText: string
3895
+ /** Whether the player can use the respawn button. Otherwise forces either play again or exit */
3896
+ useRespawnButton: boolean
3897
+ /** MS before a killstreak expires. (defaults to never expiring) */
3898
+ killstreakDuration: number
3899
+ /** Damage multiplier for all types of damage */
3900
+ dealingDamageMultiplier: number
3901
+ /** Mult for when the player hits a head. Only applies to guns */
3902
+ dealingDamageHeadMultiplier: number
3903
+ /** Mult for when the player hits a leg. Only applies to guns */
3904
+ dealingDamageLegMultiplier: number
3905
+ /** Mult for when the player hits neither a leg or a head. Only applies to guns */
3906
+ dealingDamageDefaultMultiplier: number
3907
+ /** Where gunshots originate from. "default" preserves camera-assisted behavior. */
3908
+ gunshotOrigin: GunshotOrigin
3909
+ /** Mult for all types of incoming damage */
3910
+ receivingDamageMultiplier: number
3911
+ /** When the player is attacked, a short cooldown prevents further damage from the same attack type. If true, all attackers share that cooldown. If false, each attacker has their own. */
3912
+ isReceivingDamageCooldownGlobal: boolean
3913
+ /** Mult for horizontal knockback when dealing damage */
3914
+ horizontalKnockbackMultiplier: number
3915
+ /** Mult for vertical knockback when dealing damage */
3916
+ verticalKnockbackMultiplier: number
3917
+ /** Mult for the damage done by "stomping" on a lifeform, i.e.: falling on them wearing Spiked Boots. */
3918
+ stompDamageMultiplier: number
3919
+ /** Radius around the player that will be affected by the stomp damage. */
3920
+ stompDamageRadius: number
3921
+ /** Mult for the radius within which mobs can detect the player when crouching. If a player's mult is 2, then mobs will think they are twice as far away. */
3922
+ crouchMobDetectionRadiusMultiplier: number
3923
+ /** Scale factor to use for dropped item meshes */
3924
+ droppedItemScale: number
3925
+ /** Amount that player camera is affected by movement based fov */
3926
+ movementBasedFovScale: number
3927
+ /** Amount of friction to apply to airborne players - only change if absolutely necessary */
3928
+ airFrictionScale: number
3929
+ /** Amount of friction to apply to grounded players - only change if absolutely necessary */
3930
+ groundFrictionScale: number
3931
+ /** Amount of acceleration to apply to airborne players - only change if absolutely necessary */
3932
+ airAccScale: number
3933
+ /** Whether to allow players to strafe and conserve momentum while airborne */
3934
+ airMomentumConservation: boolean
3935
+ /** Multiplier applied to gravity during normal movement */
3936
+ gravityMultiplier: number
3937
+ /** How much the player bounces off of solid blocks */
3938
+ bounciness: number
3939
+ /** Whether the player can climb walls */
3940
+ canClimbWalls: boolean
3941
+ /** Whether the player can crouch */
3942
+ canCrouch: boolean
3943
+ /** Whether players take fall damage */
3944
+ fallDamage: boolean
3945
+ /** How much aura levels up the player */
3946
+ auraPerLevel: number
3947
+ /** Max aura the player can have */
3948
+ maxAuraLevel: number
3949
+ /** Distance in blocks over which we reduce the opacity of entities as they approach the camera */
3950
+ proximityFadeDistance: number
3951
+ /** Minimum opacity multiplier reachable when fading entities based on camera proximity */
3952
+ proximityFadeMinOpacity: number
3953
+ /** Force the camera to look in a specific direction [x, y, z]. Set to null to allow free camera movement. */
3954
+ forcedCameraDirection: [number, number, number]
3955
+ /** Duration in ms to animate/transition to the forced camera direction. 0 = instant. */
3956
+ forcedCameraDirectionTransitionMs: number
3957
+ /** Roll angle of the camera in radians */
3958
+ cameraRoll: number
3959
+ /** Duration in ms to animate/transition to the camera roll angle. 0 = instant. */
3960
+ cameraRollTransitionMs: number
3961
+ /** Third-person camera origin rotation offset [x, y, z] in radians. */
3962
+ cameraRotationOffset: [number, number, number]
3963
+ /** Third-person camera origin translation offset [x, y, z] in blocks. */
3964
+ cameraPositionOffset: [number, number, number]
3965
+ /** When null, just use the player's graphics setting. When set, forces lighting on (true) or off (false). */
3966
+ lightingOverride: boolean
3967
+ /** Sky light colour override - hex string e.g. #ffffff. */
3968
+ skyLightColourOverride: string
3969
+ /** Ambient (absence of sky light) colour override - hex string e.g. #ffffff. */
3970
+ ambientLightColourOverride: string
3971
+ /** The dimmest light the player can see by - hex string e.g. #ffffff. Anywhere darker is lifted to it, e.g. caves and night. */
3972
+ visionMinLightColour: string
3973
+ /** Held item light colour override - hex colour string e.g. #ffffff. Applied regardless of any held item. */
3974
+ heldLightColourOverride: string
3975
+ /** Held item light range override. Distance is measured in blocks. */
3976
+ heldLightRangeOverride: number
3977
+ /** Held item light cone angle override. Angle is measured in degrees. Larger number = wider beam. */
3978
+ heldLightConeAngleOverride: number
3979
+ /** When true, hides world and chunk coordinates regardless of the player's setting. */
3980
+ hideCoordinates: boolean
3981
+ /** Renders a terrain-following strip of animated chevron arrows on the ground from this player to the target position. Optional \`colour\` is any CSS colour string (e.g. "red", "#ffaa00", "rgb(255,0,0)"), or null for default white. */
3982
+ groundArrowPath: { target: [number, number, number]; colour?: string; }
3983
+ }
3984
+
3985
+ export type OtherEntitySettings = {
3986
+ opacity: number
3987
+ zIndex: 0 | 1
3988
+ overlayColour: string
3989
+ canAttack: boolean
3990
+ canSee: boolean
3991
+ interactable: boolean
3992
+ interactionPrompt: string | CustomTextStyling
3993
+ showDamageAmounts: boolean
3994
+ killfeedColour: string
3995
+ meshScaling: EntityMeshScalingMap
3996
+ colorInLobbyLeaderboard: string
3997
+ lobbyLeaderboardValues: LobbyLeaderboardValues
3998
+ lobbyLeaderboardTags: ChatTags
3999
+ nameTagInfo: NameTagInfo
4000
+ hasPriorityNametag: boolean
4001
+ multilineTextBox: MultilineTextBox
4002
+ nameColour: "default" | "yellow" | "lime" | "green" | "aqua" | "cyan" | "blue" | "purple" | "pink" | "red" | "orange"
4003
+ }