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,874 @@
1
+ import type {
2
+ GameApi,
3
+ Console,
4
+ EntityId,
5
+ Pos,
6
+ LifeformId,
7
+ PlayerId,
8
+ PNull,
9
+ PlayerDbId,
10
+ LifeformBodyPart,
11
+ PlayerAttemptDamageOtherPlayerOpts,
12
+ HittingSoundOverride,
13
+ ItemName,
14
+ EnchantmentAttributes,
15
+ EnchantmentPerk,
16
+ EnchantmentTier,
17
+ CustomTextStyling,
18
+ TranslatedText,
19
+ EntityName,
20
+ Rank,
21
+ StyledIcon,
22
+ FontSize,
23
+ StyledText,
24
+ TextStyle,
25
+ ProgressBar,
26
+ StyledKeyBinding,
27
+ NoaAction,
28
+ ClientOption,
29
+ EarthSkyBox,
30
+ Vec3,
31
+ LobbyLeaderboardInfo,
32
+ TextWithDisplayOptions,
33
+ HeaderChip,
34
+ GunshotOrigin,
35
+ ShopCategoryKey,
36
+ ShopItemKey,
37
+ ShopItem,
38
+ ShopItemUserInput,
39
+ SchematicId,
40
+ ShopItemBadgeType,
41
+ ShopCategoryConfig,
42
+ OtherEntitySetting,
43
+ EntityMeshScalingMap,
44
+ EntityNamedNode,
45
+ PlayerMeshNamedNode,
46
+ LobbyLeaderboardValues,
47
+ ChatTags,
48
+ NameTagInfo,
49
+ RankInfo,
50
+ HealthbarInfo,
51
+ NameTagBorder,
52
+ HealthbarDisplay,
53
+ HealthbarColourGradient,
54
+ NameTagBorderStyle,
55
+ NameTagBorderTarget,
56
+ MultilineTextBox,
57
+ TempParticleSystemOpts,
58
+ ParticlePresetOpts,
59
+ ParticleSystemOpts,
60
+ VelocityGradient,
61
+ TimeColorGradient,
62
+ RandomColorGradient,
63
+ ParticlePresetId,
64
+ AnimationSchema,
65
+ BlockbenchAnimationSchema,
66
+ LoopModeSchema,
67
+ AnimationTimelineSchema,
68
+ KeyframeSchema,
69
+ LerpPointSchema,
70
+ Point,
71
+ LerpModeSchema,
72
+ BlockbenchLoopModeSchema,
73
+ BlockbenchAnimationTimelineSchema,
74
+ TimestampString,
75
+ BlockbenchAnimationFrameSchema,
76
+ BlockbenchLerpModeSchema,
77
+ NodeSkeletonAnimationSchema,
78
+ NodeName,
79
+ NodeAnimationSchema,
80
+ BlockbenchBonesAnimationSchema,
81
+ BlockbenchBoneAnimationSchema,
82
+ MobId,
83
+ MobDbId,
84
+ BlockName,
85
+ BlockId,
86
+ WorldBlockChangedInfo,
87
+ WorldBlockChangedCause,
88
+ GameChunk,
89
+ PersistedExtraInfo,
90
+ ItemAttributes,
91
+ ItemDropOptions,
92
+ AudioEntityOpts,
93
+ AnimParams,
94
+ HarvestType,
95
+ BlockMetadataModelType,
96
+ SpecialToolDrop,
97
+ RecursiveReadonly,
98
+ Primitive,
99
+ SoundType,
100
+ GunStatsOverride,
101
+ GunMetadata,
102
+ NonOverridableStats,
103
+ GunCategory,
104
+ WeaponComboInfo,
105
+ AnyMetadataItem,
106
+ CustomItemStat,
107
+ InvenItem,
108
+ RecipesForItem,
109
+ EntityType,
110
+ NetworkedEntityType,
111
+ LifeformType,
112
+ ThrowableItem,
113
+ MeshEntityType,
114
+ MeshEntityOptsStringified,
115
+ MeshEntityOpts,
116
+ CommonMeshEntityOpts,
117
+ BlockNameOrId,
118
+ Cosmetics,
119
+ PlayerPose,
120
+ MeshParticleSystemOpts,
121
+ CosmeticType,
122
+ CosmeticName,
123
+ MobHerdId,
124
+ MobType,
125
+ MobSpawnOpts,
126
+ MobVariation,
127
+ MobSetting,
128
+ MobSettings,
129
+ MobItemDrop,
130
+ MobBurstAttackInfo,
131
+ MobArmour,
132
+ MobWarpTargetSpecialAttackInfo,
133
+ MobCombatTetherCombatInfo,
134
+ MobEvadeInfo,
135
+ MobChargeSpecialAttackInfo,
136
+ MobTameInfo,
137
+ MobPetInfo,
138
+ MobHealthRegenSettings,
139
+ MobBridgeInfo,
140
+ MobSlideInfo,
141
+ MobJumpInfo,
142
+ MobRandomFacingInfo,
143
+ ArmourPart,
144
+ MobArmourPiece,
145
+ TempMobParticleOpts,
146
+ MobParticleOpts,
147
+ ItemNameWithEffects,
148
+ LevelUpBonuses,
149
+ EffectOpts,
150
+ PotionEffect,
151
+ MobFeedLevelUpLevels,
152
+ MobLevelUpBonus,
153
+ MobFeedLevel,
154
+ InclusiveRange,
155
+ Bounds,
156
+ MutableBounds,
157
+ MobAiState,
158
+ MobAiStateParams,
159
+ MobWorldView,
160
+ MeshEntityPhysicsOpts,
161
+ QTEType,
162
+ QTEClientParameters,
163
+ QTEParametersForType,
164
+ QTEDefinitions,
165
+ ProgressBarQteParams,
166
+ ProgressBarQteState,
167
+ TimedClickQteParams,
168
+ TimedClickQteState,
169
+ GravityBarQteParams,
170
+ GravityBarQteState,
171
+ PrecisionBarQteParams,
172
+ PrecisionBarQteState,
173
+ RhythmClickQteParams,
174
+ RhythmClickQteState,
175
+ QTERequestId,
176
+ UiRequestId,
177
+ IngameIconName,
178
+ InbuiltEffectInfo,
179
+ PlayerPhysicsState,
180
+ PhysicsTier,
181
+ PhysicsTiers,
182
+ SettableVehicleSetting,
183
+ SettableVehicleSettingValue,
184
+ VehicleSetting,
185
+ BlockVehicleSetting,
186
+ ResolvedPhysicsSettings,
187
+ ByBlockRecordKey,
188
+ DefaultPhysicsTypeSettings,
189
+ AllPhysicsSettings,
190
+ ImpactCameraShakeOpts,
191
+ SteeringOpts,
192
+ FluidSkipOpts,
193
+ AirborneModeOpts,
194
+ AirborneMovementOpts,
195
+ FallSpeedLimitOpts,
196
+ HeadingAirborneMovement,
197
+ CameraDirectionAirborneMovement,
198
+ PerBlockVehicleSetting,
199
+ VehicleSettingValue,
200
+ BlockVehicleSettingValue,
201
+ PerBlockVehicleSettingValue,
202
+ MeshEntityVehicleType,
203
+ VehicleSpawnOpts,
204
+ AngleDir,
205
+ BlockRaycastResult,
206
+ MeshParticleSystemUpdates,
207
+ MeshParticleSystemUpdate,
208
+ UgcCurrencyInfo,
209
+ UserCallbacks,
210
+ WorldGamemode,
211
+ QueuedCommandId,
212
+ QueuedStatusString,
213
+ UiRequestClientParameters,
214
+ MultiBlockInfo,
215
+ BoughtShopItem,
216
+ OnPlayerChatObjectResponse,
217
+ ChatMessageObject,
218
+ FishingAttemptOptions,
219
+ _TypeOf,
220
+ ItemMetaInfo,
221
+ BlockMetadataItem,
222
+ NonBlockMetadataItem,
223
+ LoadedChunk,
224
+ Song,
225
+ ParticleSystemBlendMode,
226
+ HalfblockPlacement,
227
+ WalkThroughType,
228
+ LobbyType,
229
+ PhysicsType,
230
+ BoatTier,
231
+ GliderTier,
232
+ BalloonTier,
233
+ SleepingTier,
234
+ CarTier,
235
+ MovementType,
236
+ ExplosionType,
237
+ ClientOptions,
238
+ OtherEntitySettings,
239
+ } from "@bloxd"
240
+
241
+ declare global {
242
+ /** The ID of the player running the code.
243
+ *
244
+ * Lobby code usually has nobody running it, so this is null.
245
+ */
246
+ const myId: string | null
247
+ /** The position of the code block or press to code board */
248
+ const thisPos: [number, number, number]
249
+ /** The owner of the current custom lobby */
250
+ const lobbyOwnerId: string | null
251
+ const console: Console
252
+ /** Game API */
253
+ const api: GameApi
254
+
255
+ /**
256
+ * Called every tick, 20 times per second
257
+ * @param ms - The fixed timestep, can be used as "milliseconds since last tick"
258
+ */
259
+ var tick: (ms: number) => void
260
+
261
+ /**
262
+ * Called when the lobby is shutting down
263
+ * @param serverIsShuttingDown - Whether the server is shutting down
264
+ */
265
+ var onClose: (serverIsShuttingDown: boolean) => void
266
+
267
+ /**
268
+ * Called when a player joins the lobby
269
+ * @param playerId - The id of the player that joined
270
+ * @param fromGameReset - Whether this call is from a game reset (used by SessionBasedGame)
271
+ */
272
+ var onPlayerJoin: (playerId: string, fromGameReset: boolean) => void
273
+
274
+ /**
275
+ * Called when a player leaves the lobby
276
+ * @param playerId - The id of the player that left
277
+ * @param serverIsShuttingDown - Whether the server is shutting down
278
+ */
279
+ var onPlayerLeave: (playerId: string, serverIsShuttingDown: boolean) => void
280
+
281
+ /**
282
+ * Called when a player jumps
283
+ * @param playerId - The id of the player that jumped
284
+ */
285
+ var onPlayerJump: (playerId: string) => void
286
+
287
+ /**
288
+ * Called when a player requests to respawn.
289
+ * Optionally return the respawn location. Defaults to [0, 0, 0].
290
+ * Return true to handle yourself (good for async,
291
+ * but be careful that the player isn't at the place they died,
292
+ * as they could pick up their old items or hit the player they were fighting).
293
+ * @param playerId - The id of the player that requested to respawn
294
+ */
295
+ var onRespawnRequest: (playerId: string) => true | void | number[]
296
+
297
+ /**
298
+ * Called when a player sends a command
299
+ * @param playerId - The id of the player that sent the command
300
+ * @param command - The command that the player sent
301
+ */
302
+ var playerCommand: (playerId: string, command: string) => boolean
303
+
304
+ /**
305
+ * Called when a player sends a chat message
306
+ * Return false or null to prevent the broadcast of the message.
307
+ * Return a string or CustomTextStyling to add a prefix to message.
308
+ * Return for most flexibility: an object where keys are playerIds -
309
+ * the value for a playerId being false means that player won't receive the message.
310
+ * Otherwise playerId values should be an object with (optional) keys
311
+ * prefixContent and chatContent to modify the prefix and the chat.
312
+ * CustomTextStyling[] prefixContent is expected, e.g. [["prefix"]] or [[{ str: "prefix" }]].
313
+ * World code is not permitted to specify chatContent, it will be ignored.
314
+ * @param playerId - The id of the player that sent the message
315
+ * @param chatMessage - The message that the player sent
316
+ * @param channelName - The name of the channel that the message was sent in
317
+ */
318
+ var onPlayerChat: (playerId: PlayerId, chatMessage: string, channelName?: string) => boolean | void | ChatTags | OnPlayerChatObjectResponse
319
+
320
+ /**
321
+ * Called when a player changes a block
322
+ * Return "preventChange" to prevent the change.
323
+ * If player places block, fromBlock will be Air (and toBlock the block).
324
+ * If a player breaks a block, toBlock will be Air.
325
+ * Return "preventDrop" to prevent a block item from dropping.
326
+ * Return an array to set the dropped item position.
327
+ */
328
+ var onPlayerChangeBlock: (playerId: PlayerId, x: number, y: number, z: number, fromBlock: BlockName, toBlock: BlockName, droppedItem: BlockName | null, fromBlockInfo: MultiBlockInfo, toBlockInfo: MultiBlockInfo) => void | "preventChange" | "preventDrop" | [number, number, number]
329
+
330
+ /**
331
+ * Called when a player drops an item
332
+ * Return "preventDrop" to prevent the player from dropping the item at all.
333
+ * Return "allowButNoDroppedItemCreated" to allow discarding items without dropping them.
334
+ */
335
+ var onPlayerDropItem: (playerId: PlayerId, x: number, y: number, z: number, itemName: ItemName, itemAmount: number, fromIdx: number) => void | "preventDrop" | "allowButNoDroppedItemCreated"
336
+
337
+ /**
338
+ * Called when a player picks up an item
339
+ * @param playerId - The id of the player that picked up the item
340
+ * @param itemName - The name of the item that was picked up
341
+ * @param itemAmount - The amount of the item that was picked up
342
+ * @param itemEntityId - The entityId of the item that was picked up
343
+ */
344
+ var onPlayerPickedUpItem: (playerId: PlayerId, itemName: string, itemAmount: number, itemEntityId: EntityId) => void
345
+
346
+ /**
347
+ * Called when a player selects a different inventory slot.
348
+ * This will be called eventually when you have already set the slot using
349
+ * api.setSelectedInventorySlotI so be careful not to cause an infinite loop doing this.
350
+ * @param playerId - The id of the player that selected the inventory slot
351
+ * @param slotIndex - The index of the inventory slot that was selected
352
+ */
353
+ var onPlayerSelectInventorySlot: (playerId: PlayerId, slotIndex: number) => void
354
+
355
+ /**
356
+ * Called when a player stands on a block
357
+ * @param playerId - The id of the player that stood on the block
358
+ * @param x - The x coordinate of the block that was stood on
359
+ * @param y - The y coordinate of the block that was stood on
360
+ * @param z - The z coordinate of the block that was stood on
361
+ * @param blockName - The name of the block that was stood on
362
+ */
363
+ var onBlockStand: (playerId: PlayerId, x: number, y: number, z: number, blockName: BlockName) => void
364
+
365
+ /**
366
+ * Called when a player enters a block. Only called once per block until the player leaves the block.
367
+ * @param playerId - The id of the player that entered the block
368
+ * @param x - The x coordinate of the block that was entered
369
+ * @param y - The y coordinate of the block that was entered
370
+ * @param z - The z coordinate of the block that was entered
371
+ * @param blockName - The name of the block that was entered
372
+ */
373
+ var onBlockStandStart: (playerId: PlayerId, x: number, y: number, z: number, blockName: BlockName) => void
374
+
375
+ /**
376
+ * Called when a player leaves a block.
377
+ * @param playerId - The id of the player that left the block
378
+ * @param x - The x coordinate of the block that was left
379
+ * @param y - The y coordinate of the block that was left
380
+ * @param z - The z coordinate of the block that was left
381
+ * @param blockName - The name of the block that was left
382
+ */
383
+ var onBlockStandStop: (playerId: PlayerId, x: number, y: number, z: number, blockName: BlockName) => void
384
+
385
+ /**
386
+ * Called when a player attempts to craft an item
387
+ * Return "preventCraft" to prevent a craft from happening
388
+ * @param playerId - The id of the player that is attempting to craft the item
389
+ * @param itemName - The name of the item that is being crafted
390
+ * @param craftingIdx - The index of the used recipe in the item's recipe list
391
+ * @param craftTimes - The number of times the craft recipe is used at once (e.g. shift held while crafting)
392
+ */
393
+ var onPlayerAttemptCraft: (playerId: PlayerId, itemName: string, craftingIdx: number, craftTimes: number) => void | "preventCraft"
394
+
395
+ /**
396
+ * Called when a player crafts an item
397
+ * @param playerId - The id of the player that crafted the item
398
+ * @param itemName - The name of the item that was crafted
399
+ * @param craftingIdx - The index of the used recipe in the item's recipe list
400
+ * @param recipe - The recipe that was used to craft the item
401
+ * @param craftTimes - The number of times the craft recipe is used at once (e.g. shift held while crafting)
402
+ */
403
+ var onPlayerCraft: (playerId: PlayerId, itemName: string, craftingIdx: number, recipe: RecipesForItem[number], craftTimes: number) => void
404
+
405
+ /**
406
+ * Called when a player attempts to open a chest
407
+ * Return "preventOpen" to prevent the player from opening the chest
408
+ */
409
+ var onPlayerAttemptOpenChest: (playerId: PlayerId, x: number, y: number, z: number, isMoonstoneChest: boolean, isIronChest: boolean) => void | "preventOpen"
410
+
411
+ /**
412
+ * Called when a player opens a chest
413
+ */
414
+ var onPlayerOpenedChest: (playerId: PlayerId, x: number, y: number, z: number, isMoonstoneChest: boolean, isIronChest: boolean) => void
415
+
416
+ /**
417
+ * Called when a player moves an item out of their inventory
418
+ * Return "preventChange" to prevent the movement
419
+ */
420
+ var onPlayerMoveItemOutOfInventory: (playerId: PlayerId, itemName: string, itemAmount: number, fromIdx: number, movementType: string) => void | "preventChange"
421
+
422
+ /**
423
+ * Called for all types of inventory item movement.
424
+ * Certain methods of moving item can result in splitting a stack
425
+ * into multiple slots. (e.g. shift-click).
426
+ * toStartIdx and toEndIdx provide the min and max idxs moved into.
427
+ * Return "preventChange" to prevent item movement.
428
+ */
429
+ var onPlayerMoveInvenItem: (playerId: PlayerId, fromIdx: number, toStartIdx: number, toEndIdx: number, amt: number) => void | "preventChange"
430
+
431
+ /**
432
+ * Called when a player moves an item into an index within a range of inventory slots
433
+ * Return "preventChange" to prevent the movement
434
+ */
435
+ var onPlayerMoveItemIntoIdxs: (playerId: PlayerId, start: number, end: number, moveIdx: number, itemAmount: number) => void | "preventChange"
436
+
437
+ /**
438
+ * Return "preventChange" to prevent the swap
439
+ * @param playerId - The id of the player swapping the inventory slots
440
+ * @param i - The index of the first slot
441
+ * @param j - The index of the second slot
442
+ */
443
+ var onPlayerSwapInvenSlots: (playerId: PlayerId, i: number, j: number) => void | "preventChange"
444
+
445
+ /**
446
+ * Return "preventChange" to prevent the movement
447
+ * @param playerId - The id of the player moving the item
448
+ * @param i - The index of the first slot
449
+ * @param j - The index of the second slot
450
+ * @param amt - The amount of the item being moved
451
+ */
452
+ var onPlayerMoveInvenItemWithAmt: (playerId: PlayerId, i: number, j: number, amt: number) => void | "preventChange"
453
+
454
+ /**
455
+ * Called when player alt actions (right click on pc).
456
+ * The co-ordinates will be undefined if there is no targeted block (and block will be "Air")
457
+ * Some actions can be prevented by returning "preventAction",
458
+ * but this may not work as well for certain actions which the game client predicts to succeed -
459
+ * test it to see if it works for your use case, feel free to report any broken ones.
460
+ */
461
+ var onPlayerAttemptAltAction: (playerId: PlayerId, x: number, y: number, z: number, block: BlockName, targetEId: EntityId | null) => void | "preventAction"
462
+
463
+ /**
464
+ * Called when player completes an alt action. Right click, the interact bind (E by default) and a mobile tap all arrive here; a left click does not, so this is the callback to use for anything a player should have to choose to do rather than trigger by swinging.
465
+ * Keeps firing while the input is held, roughly every 50-150ms. That is harmless for anything idempotent, but an interaction that grants an item, charges a currency or advances a conversation has to swallow the repeats itself - open shops with toggle off, and debounce the rest per player.
466
+ * The co-ordinates will be undefined if there is no targeted block (and block will be "Air")
467
+ */
468
+ var onPlayerAltAction: (playerId: PlayerId, x: number, y: number, z: number, block: BlockName, targetEId: EntityId | null) => void
469
+
470
+ /**
471
+ * Called when a player clicks
472
+ * Don't have important functionality depending on wasAltClick,
473
+ * as it'll always be false for touchscreen players.
474
+ */
475
+ var onPlayerClick: (playerId: PlayerId, wasAltClick: boolean, x: number, y: number, z: number, block: BlockName, targetEId: EntityId | null) => void
476
+
477
+ /**
478
+ * Called when a player releases a click (mouse-up on desktop, touch-end on mobile).
479
+ * Fires for both primary and secondary click releases.
480
+ * Keep in mind wasAltClick will always be false for touchscreen players.
481
+ */
482
+ var onPlayerClickUp: (playerId: PlayerId, wasAltClick: boolean, x: number, y: number, z: number, block: BlockName, targetEId: EntityId | null) => void
483
+
484
+ /**
485
+ * Called when a client option is updated
486
+ * @param playerId - The id of the player whose option was updated
487
+ * @param option - The option that was updated
488
+ * @param value - The new value of the option, always null for custom code
489
+ */
490
+ var onClientOptionUpdated: (playerId: PlayerId, option: ClientOption, value: any) => void
491
+
492
+ /**
493
+ * Called when a mob setting is updated
494
+ * @param mobId - The id of the mob whose setting was updated
495
+ * @param setting - The setting that was updated
496
+ * @param value - The new value of the setting
497
+ */
498
+ var onMobSettingUpdated: (mobId: MobId, setting: MobSetting, value: any) => void
499
+
500
+ /**
501
+ * Called when a player's inventory is updated
502
+ * @param playerId - The id of the player whose inventory was updated
503
+ */
504
+ var onInventoryUpdated: (playerId: PlayerId) => void
505
+
506
+ /**
507
+ * Called when a chest is updated by a player
508
+ * x, y, z, will be null if isMoonstoneChest is true
509
+ */
510
+ var onChestUpdated: (initiatorEId: PlayerId, isMoonstoneChest: boolean, x: number | null, y: number | null, z: number | null) => void
511
+
512
+ /**
513
+ * Called when a block is changed in the world
514
+ * initiatorDbId is null if updated by game code e.g. when a sapling grows
515
+ * Return "preventChange" to prevent change
516
+ * Return "preventDrop" to prevent a block item from dropping
517
+ */
518
+ var onWorldChangeBlock: (x: number, y: number, z: number, fromBlock: BlockName, toBlock: BlockName, initiatorDbId: string | null, extraInfo: WorldBlockChangedInfo) => void | "preventChange" | "preventDrop"
519
+
520
+ /**
521
+ * Called when a mesh entity is created
522
+ * @param eId - The id of the mesh entity
523
+ * @param type - The type of mesh entity
524
+ * @param initiatorId - The id of the entity that created the mesh entity, if any
525
+ */
526
+ var onCreateBloxdMeshEntity: (eId: EntityId, type: string, initiatorId: EntityId | null) => void
527
+
528
+ /**
529
+ * Called when a entity collides with another entity
530
+ * @param eId - The id of the entity
531
+ * @param otherEId - The id of the other entity
532
+ */
533
+ var onEntityCollision: (eId: EntityId, otherEId: EntityId) => void
534
+
535
+ /**
536
+ * Called when a player attempts to spawn a mob, e.g. using a spawn orb.
537
+ * Return "preventSpawn" to prevent the mob from spawning.
538
+ */
539
+ var onPlayerAttemptSpawnMob: (playerId: PlayerId, mobType: MobType, x: number, y: number, z: number) => void | "preventSpawn"
540
+
541
+ /**
542
+ * Called when the world attempts to spawn a mob.
543
+ * Return "preventSpawn" to prevent the mob from spawning.
544
+ * @param mobType - The type of mob
545
+ * @param x - The potential x coordinate of the mob
546
+ * @param y - The potential y coordinate of the mob
547
+ * @param z - The potential z coordinate of the mob
548
+ */
549
+ var onWorldAttemptSpawnMob: (mobType: MobType, x: number, y: number, z: number) => void | "preventSpawn"
550
+
551
+ /**
552
+ * Called when a mob is spawned by a player
553
+ */
554
+ var onPlayerSpawnMob: (playerId: PlayerId, mobId: MobId, mobType: MobType, x: number, y: number, z: number, mobHerdId: MobHerdId, playSoundOnSpawn: boolean) => void
555
+
556
+ /**
557
+ * Called when a mob is spawned by the world
558
+ */
559
+ var onWorldSpawnMob: (mobId: MobId, mobType: MobType, x: number, y: number, z: number, mobHerdId: MobHerdId, playSoundOnSpawn: boolean) => void
560
+
561
+ /**
562
+ * Called when a mob is despawned by the world.
563
+ * Return "preventDespawn" to prevent the mob from despawning.
564
+ * @param mobId - The id of the mob despawned
565
+ */
566
+ var onWorldAttemptDespawnMob: (mobId: MobId) => void | "preventDespawn"
567
+
568
+ /**
569
+ * Called when a mob is despawned
570
+ * @param mobId - The id of the mob despawned
571
+ */
572
+ var onMobDespawned: (mobId: MobId) => void
573
+
574
+ /**
575
+ * Called when a vehicle is spawned on a player's behalf.
576
+ * Return "preventSpawn" to prevent the vehicle from spawning.
577
+ */
578
+ var onPlayerAttemptSpawnVehicle: (playerId: PlayerId, vehicleType: MeshEntityVehicleType, x: number, y: number, z: number) => void | "preventSpawn"
579
+
580
+ /**
581
+ * Called when the world attempts to spawn a vehicle.
582
+ * Return "preventSpawn" to prevent the vehicle from spawning.
583
+ * @param vehicleType - The type of vehicle
584
+ * @param x - The potential x coordinate of the vehicle
585
+ * @param y - The potential y coordinate of the vehicle
586
+ * @param z - The potential z coordinate of the vehicle
587
+ */
588
+ var onWorldAttemptSpawnVehicle: (vehicleType: MeshEntityVehicleType, x: number, y: number, z: number) => void | "preventSpawn"
589
+
590
+ /**
591
+ * Called when a vehicle is spawned by a player, e.g. by placing a boat
592
+ */
593
+ var onPlayerSpawnVehicle: (playerId: PlayerId, vehicleEId: EntityId, vehicleType: MeshEntityVehicleType, x: number, y: number, z: number) => void
594
+
595
+ /**
596
+ * Called when a vehicle is spawned by the world
597
+ */
598
+ var onWorldSpawnVehicle: (vehicleEId: EntityId, vehicleType: MeshEntityVehicleType, x: number, y: number, z: number) => void
599
+
600
+ /**
601
+ * Called when a vehicle is despawned
602
+ * @param vehicleEId - The id of the vehicle despawned
603
+ * @param vehicleType - The type of vehicle despawned
604
+ */
605
+ var onVehicleDespawned: (vehicleEId: EntityId, vehicleType: MeshEntityVehicleType) => void
606
+
607
+ /**
608
+ * Called when any non-player entity is deleted, after any type specific callback such as "onMobDespawned".
609
+ * Not called when an item drop is picked up or expires, or when a throwable expires or hits something.
610
+ * @param eId - The id of the entity deleted
611
+ * @param entityType - The type of the entity deleted
612
+ */
613
+ var onEntityDeleted: (eId: EntityId, entityType: EntityType) => void
614
+
615
+ /**
616
+ * Called when a player attacks another player
617
+ * @param playerId - The id of the player attacking
618
+ */
619
+ var onPlayerAttack: (playerId: string) => void
620
+
621
+ /**
622
+ * Called when a player is damaging another player
623
+ * Return "preventDamage" to prevent damage
624
+ * Return number to change damage dealt to that amount
625
+ * Sometimes the damager will have left the game (e.g. spikes placer);
626
+ * in this case, attackingPlayer will be the damagedPlayer,
627
+ * but we pass damagerDbId for use cases where it's important.
628
+ */
629
+ var onPlayerDamagingOtherPlayer: (attackingPlayer: PlayerId, damagedPlayer: PlayerId, damageDealt: number, withItem: string, bodyPartHit: LifeformBodyPart, damagerDbId: PlayerDbId) => number | void | "preventDamage"
630
+
631
+ /**
632
+ * Called when a player is damaging a mob
633
+ * Return "preventDamage" to prevent damage
634
+ * Return number to change damage dealt to that amount
635
+ */
636
+ var onPlayerDamagingMob: (playerId: PlayerId, mobId: MobId, damageDealt: number, withItem: string, damagerDbId: PlayerDbId) => number | void | "preventDamage"
637
+
638
+ /**
639
+ * Called when a mob is damaging a player
640
+ * Return "preventDamage" to prevent damage
641
+ * Return number to change damage dealt to that amount
642
+ * @param attackingMob the id of the mob damaging the player
643
+ * @param damagedPlayer the id of the player being damaged
644
+ * @param damageDealt the amount of damage dealt
645
+ * @param withItem the item used to attack
646
+ */
647
+ var onMobDamagingPlayer: (attackingMob: MobId, damagedPlayer: PlayerId, damageDealt: number, withItem: string) => number | void | "preventDamage"
648
+
649
+ /**
650
+ * Called when a mob is damaging another mob
651
+ * Return "preventDamage" to prevent damage
652
+ * Return number to change damage dealt to that amount
653
+ * @param attackingMob the id of the mob attacking
654
+ * @param damagedMob the id of the mob being damaged
655
+ * @param damageDealt the amount of damage dealt
656
+ * @param withItem the item used to attack
657
+ */
658
+ var onMobDamagingOtherMob: (attackingMob: MobId, damagedMob: MobId, damageDealt: number, withItem: string) => number | void | "preventDamage"
659
+
660
+ /**
661
+ * Called when a player is about to be killed
662
+ * Return "preventDeath" to prevent the player from being killed
663
+ * @param killedPlayer - The id of the player being killed
664
+ * @param attackingLifeform - The optional id of the lifeform attacking the player
665
+ */
666
+ var onAttemptKillPlayer: (killedPlayer: PlayerId, attackingLifeform?: LifeformId) => void | "preventDeath"
667
+
668
+ /**
669
+ * Called when a player kills another player
670
+ * Return "keepInventory" to not drop the player's inventory
671
+ * @param attackingPlayer - The id of the player attacking
672
+ * @param killedPlayer - The id of the player killed
673
+ * @param damageDealt - The amount of damage dealt
674
+ * @param withItem - The item used to attack
675
+ */
676
+ var onPlayerKilledOtherPlayer: (attackingPlayer: string, killedPlayer: string, damageDealt: number, withItem: string) => void | "keepInventory"
677
+
678
+ /**
679
+ * Called when a mob kills a player
680
+ * Return "keepInventory" to not drop the player's inventory
681
+ * @param attackingMob - The id of the mob attacking
682
+ * @param killedPlayer - The id of the player killed
683
+ * @param damageDealt - The amount of damage dealt
684
+ * @param withItem - The item used to attack
685
+ */
686
+ var onMobKilledPlayer: (attackingMob: any, killedPlayer: any, damageDealt: any, withItem: any) => void | "keepInventory"
687
+
688
+ /**
689
+ * Called when a player kills a mob
690
+ * Return "preventDrop" to prevent the mob from dropping items
691
+ */
692
+ var onPlayerKilledMob: (playerId: PlayerId, mobId: MobId, damageDealt: number, withItem: string) => void | "preventDrop"
693
+
694
+ /**
695
+ * Called when a mob kills another mob
696
+ * Return "preventDrop" to prevent the mob from dropping items
697
+ * @param attackingMob - The id of the mob attacking
698
+ * @param killedMob - The id of the mob killed
699
+ * @param damageDealt - The amount of damage dealt
700
+ * @param withItem - The item used to attack
701
+ */
702
+ var onMobKilledOtherMob: (attackingMob: MobId, killedMob: MobId, damageDealt: number, withItem: string) => void | "preventDrop"
703
+
704
+ /**
705
+ * Called when a player is affected by a new potion effect
706
+ * @param initiatorId - The id of the player who initiated the potion effect
707
+ * @param targetId - The id of the player who has started being affected
708
+ * @param effectName - The name of the potion effect
709
+ */
710
+ var onPlayerPotionEffect: (initiatorId: string, targetId: string, effectName: "Damage" | "Speed" | "Damage Reduction" | "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") => void | "preventEffect"
711
+
712
+ /**
713
+ * Called when a player is damaging a mesh entity
714
+ */
715
+ var onPlayerDamagingMeshEntity: (playerId: PlayerId, damagedId: EntityId, damageDealt: number, withItem: string) => void
716
+
717
+ /**
718
+ * Called when a player breaks a mesh entity
719
+ * @param playerId - The id of the player breaking the mesh entity
720
+ * @param entityId - The id of the mesh entity being broken
721
+ */
722
+ var onPlayerBreakMeshEntity: (playerId: PlayerId, entityId: EntityId) => void
723
+
724
+ /**
725
+ * Called when a player uses a throwable item
726
+ */
727
+ var onPlayerUsedThrowable: (playerId: PlayerId, throwableName: ThrowableItem, thrownEntityId: EntityId) => void
728
+
729
+ /**
730
+ * Called when a player's thrown projectile hits the terrain
731
+ */
732
+ var onPlayerThrowableHitTerrain: (playerId: PlayerId, throwableName: ThrowableItem, thrownEntityId: EntityId) => void
733
+
734
+ /**
735
+ * Set client option \`touchscreenActionButton\` to take effect
736
+ * Called when a player presses the touchscreen action button
737
+ * Called for both touchDown and touchUp
738
+ * @param playerId - The id of the player pressing the touchscreen action button
739
+ * @param touchDown - Whether the touchscreen action button was pressed or released
740
+ */
741
+ var onTouchscreenActionButton: (playerId: PlayerId, touchDown: boolean) => void
742
+
743
+ /**
744
+ * Called when a player claims a task
745
+ * @param playerId - The id of the player claiming the task
746
+ * @param taskId - The id of the task being claimed
747
+ * @param isPromoTask - Whether the task is a promo task
748
+ * @param claimedRewards - The rewards claimed by the player
749
+ */
750
+ var onTaskClaimed: (playerId: string, taskId: any, isPromoTask: any, claimedRewards: any) => any
751
+
752
+ /**
753
+ * Called when a chunk is first loaded
754
+ * API Methods that modify the chunk like setBlock cannot be used here to make
755
+ * persisted changes, and will introduce client-server desync most cases,
756
+ * but might have some creative uses if you know what you're doing.
757
+ * For most use cases, consider using another callback e.g. tick.
758
+ * @param chunkId - The id of the chunk being loaded
759
+ * @param chunk - The chunk being loaded, which can be modified by this callback
760
+ * For world code callbacks this value will always be null.
761
+ * @param wasPersistedChunk - Whether the chunk was persisted
762
+ */
763
+ var onChunkLoaded: (chunkId: string, chunk: LoadedChunk, wasPersistedChunk: boolean) => void
764
+
765
+ /**
766
+ * Called when a player requests a chunk
767
+ */
768
+ var onPlayerRequestChunk: (playerId: PlayerId, chunkX: number, chunkY: number, chunkZ: number, chunkId: string) => void
769
+
770
+ /**
771
+ * Called when an item drop is created
772
+ */
773
+ var onItemDropCreated: (itemEId: EntityId, itemName: string, itemAmount: number, x: number, y: number, z: number) => void
774
+
775
+ /**
776
+ * Called when a player starts charging an item
777
+ * @param playerId - The id of the player charging the item
778
+ * @param itemName - The name of the item being charged
779
+ */
780
+ var onPlayerStartChargingItem: (playerId: PlayerId, itemName: string) => void | "preventCharge"
781
+
782
+ /**
783
+ * Called when a player finishes charging an item
784
+ */
785
+ var onPlayerFinishChargingItem: (playerId: PlayerId, used: boolean, itemName: string, duration: number) => void
786
+
787
+ /**
788
+ * Called once when a fishing hook first enters water. Coordinates are the bob's position at water entry.
789
+ * Return "preventFish" to cancel, or { caughtItemName?, biteDelayMs?, qte? } to select the fish and override the rod's bite delay
790
+ * and nine-second timed-click QTE. Default delays are Rusty 7–9 seconds, Sturdy 5–7, and Carbon/other rods 2–4.
791
+ * The selected fish is fixed for the attempt; omitting caughtItemName uses the engine's default fish selection.
792
+ */
793
+ var onPlayerAttemptFish: (playerId: PlayerId, rodName: string, x: number, y: number, z: number) => void | FishingAttemptOptions | "preventFish"
794
+
795
+ /**
796
+ * Called after the fishing QTE succeeds and the bob/session have been removed.
797
+ * Coordinates are the fishing position captured at water entry. caughtItemName is the item selected for the attempt.
798
+ * Returning nothing gives one of that item, or drops it if the inventory is full.
799
+ * Return "preventDrop" to suppress the default reward and award custom catches here instead.
800
+ */
801
+ var onPlayerSucceededFishCatch: (playerId: PlayerId, rodName: string, x: number, y: number, z: number, caughtItemName: ItemName) => void | "preventDrop"
802
+
803
+ /**
804
+ * Called after the fishing QTE fails or its time window expires, after removing the bob/session.
805
+ * Coordinates are the fishing position captured at water entry. Retracting, switching rods, dying, and leaving cancel silently.
806
+ * caughtItemName is the item selected for the failed attempt; no reward is given.
807
+ */
808
+ var onPlayerFailedFishCatch: (playerId: PlayerId, rodName: string, x: number, y: number, z: number, caughtItemName: ItemName) => void
809
+
810
+
811
+ var onPlayerFinishQTE: (playerId: PlayerId, qteId: QTERequestId, result: boolean) => void
812
+
813
+ /**
814
+ * Called when a player opens or closes the shop menu
815
+ * @param playerId - The id of the player whose shop menu changed
816
+ * @param isOpen - Whether the shop menu is now open
817
+ */
818
+ var onPlayerToggledShopMenu: (playerId: PlayerId, isOpen: boolean) => void
819
+
820
+ /** Called after a player plays an emote from the emote wheel. */
821
+ var onPlayerPlayedEmote: (playerId: PlayerId, emoteId: string) => void
822
+
823
+ /**
824
+ * Called when a player enters a vehicle
825
+ * @param playerId - The id of the player that entered the vehicle
826
+ * @param vehicleType - The type of the vehicle
827
+ * @param vehicleEId - The id of the vehicle
828
+ */
829
+ var onPlayerEnteredVehicle: (playerId: PlayerId, vehicleType: MeshEntityVehicleType, vehicleEId: EntityId) => void
830
+
831
+ /**
832
+ * Called when a player exits a vehicle
833
+ * @param playerId - The id of the player that exited the vehicle
834
+ * @param vehicleType - The type of the vehicle
835
+ * @param vehicleEId - The id of the vehicle
836
+ */
837
+ var onPlayerExitedVehicle: (playerId: PlayerId, vehicleType: MeshEntityVehicleType, vehicleEId: EntityId) => void
838
+
839
+ /**
840
+ * Called after a player successfully buys a shop item
841
+ * @param playerId - The id of the player that bought the item
842
+ * @param categoryKey - The shop category key
843
+ * @param itemKey - The shop item key
844
+ * @param item - The resolved shop item (with per-player overrides applied, internal properties stripped)
845
+ * @param userInput - The user input provided, if the item has a userInput config
846
+ */
847
+ var onPlayerBoughtShopItem: (playerId: PlayerId, categoryKey: ShopCategoryKey, itemKey: ShopItemKey, item: BoughtShopItem, userInput?: string) => void
848
+
849
+ /**
850
+ * Called when a player responds to a UI request.
851
+ *
852
+ * @param playerId - The id of the player responding to the UI request.
853
+ * @param id - The id of the UI request.
854
+ * @param response - The response to the UI request.
855
+ */
856
+ var onUiRequestResponded: (playerId: PlayerId, id: UiRequestId, response: boolean) => void
857
+
858
+ /**
859
+ * Called every so often.
860
+ * You should save custom db values/s3 objects here.
861
+ * Persisted items ARE saved on graceful shutdown (e.g. uncaught error, update, etc),
862
+ * but this helps prevent large data-loss on non-graceful shutdowns.
863
+ */
864
+ var doPeriodicSave: () => void
865
+
866
+ /** Load another world-code file by relative path (./ or ../).
867
+ * Does not work at runtime - Code is bundled before being run.
868
+ * index.js/index.ts cannot be required: they hold the callbacks the engine runs.
869
+ * No typing is available for the required file — use \`import\` and \`export\` syntax for full typing support.
870
+ */
871
+ function require(id: string): any
872
+ }
873
+
874
+ export {}