bloxd.io.d.ts 2.0.1 → 2.2.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.
Files changed (158) hide show
  1. package/dist/api-type-def/clientOption/clientOptions/canChange.d.ts +75 -75
  2. package/dist/api-type-def/clientOption/clientOptions/crouchingSpeed.d.ts +46 -46
  3. package/dist/api-type-def/clientOption/clientOptions/index.d.ts +34 -34
  4. package/dist/api-type-def/clientOption/clientOptions/runningSpeed.d.ts +51 -51
  5. package/dist/api-type-def/clientOption/clientOptions/speedMultiplier.d.ts +53 -53
  6. package/dist/api-type-def/clientOption/clientOptions/walkingSpeed.d.ts +51 -51
  7. package/dist/api-type-def/clientOption/index.d.ts +12 -16
  8. package/dist/api-type-def/entitySetting/entitySettings/example.d.ts +63 -63
  9. package/dist/api-type-def/entitySetting/entitySettings/index.d.ts +32 -32
  10. package/dist/api-type-def/entitySetting/entitySettings/opacity.d.ts +69 -69
  11. package/dist/api-type-def/entitySetting/entitySettings/overlayColour.d.ts +65 -65
  12. package/dist/api-type-def/entitySetting/entitySettings/zIndex.d.ts +64 -64
  13. package/dist/api-type-def/entitySetting/index.d.ts +54 -61
  14. package/dist/api-type-def/index.d.ts +86 -10
  15. package/dist/api-type-def/mobSetting/index.d.ts +44 -35
  16. package/dist/api-type-def/mobSetting/mobSettings/index.d.ts +6 -6
  17. package/dist/api-type-def/mobSetting/mobSettings/variation.d.ts +118 -118
  18. package/dist/api-type-def/normal/block/attemptWorldChangeBlock.d.ts +3 -0
  19. package/dist/api-type-def/normal/block/blockCoordToChunkId.d.ts +3 -0
  20. package/dist/api-type-def/normal/block/blockIdToBlockName.d.ts +9 -0
  21. package/dist/api-type-def/normal/block/blockNameToBlockId.d.ts +17 -0
  22. package/dist/api-type-def/normal/block/chunkIdToBotLeftCoord.d.ts +3 -0
  23. package/dist/api-type-def/normal/block/getBlock.d.ts +17 -0
  24. package/dist/api-type-def/normal/block/getBlockId.d.ts +12 -0
  25. package/dist/api-type-def/normal/block/getBlockSolidity.d.ts +19 -0
  26. package/dist/api-type-def/normal/block/getChunk.d.ts +15 -0
  27. package/dist/api-type-def/normal/block/getEmptyChunk.d.ts +12 -0
  28. package/dist/api-type-def/normal/block/getMetaInfo.d.ts +9 -0
  29. package/dist/api-type-def/normal/block/index.d.ts +30 -0
  30. package/dist/api-type-def/normal/block/isBlockInLoadedChunk.d.ts +10 -0
  31. package/dist/api-type-def/normal/block/setBlock.d.ts +20 -0
  32. package/dist/api-type-def/normal/block/setBlockRect.d.ts +11 -0
  33. package/dist/api-type-def/normal/block/setBlockWalls.d.ts +13 -0
  34. package/dist/api-type-def/normal/entity/getEntityName.d.ts +9 -0
  35. package/dist/api-type-def/normal/entity/index.d.ts +3 -0
  36. package/dist/api-type-def/normal/forceRespawn.d.ts +10 -1
  37. package/dist/api-type-def/normal/getUnitCoordinatesLifeformWithin.d.ts +10 -12
  38. package/dist/api-type-def/normal/health/applyHealthChange.d.ts +10 -12
  39. package/dist/api-type-def/normal/health/applyMeleeHit.d.ts +18 -20
  40. package/dist/api-type-def/normal/health/attemptApplyDamage.d.ts +29 -31
  41. package/dist/api-type-def/normal/health/getHealth.d.ts +13 -15
  42. package/dist/api-type-def/normal/health/index.d.ts +9 -8
  43. package/dist/api-type-def/normal/health/isAlive.d.ts +9 -11
  44. package/dist/api-type-def/normal/health/killLifeform.d.ts +10 -12
  45. package/dist/api-type-def/normal/health/setHealth.d.ts +15 -17
  46. package/dist/api-type-def/normal/index.d.ts +67 -13
  47. package/dist/api-type-def/normal/item/createItemDrop.d.ts +20 -0
  48. package/dist/api-type-def/normal/item/deleteItemDrop.d.ts +3 -0
  49. package/dist/api-type-def/normal/item/index.d.ts +5 -0
  50. package/dist/api-type-def/normal/item/setCantPickUpItem.d.ts +3 -0
  51. package/dist/api-type-def/normal/killstreak/clearKillstreak.d.ts +9 -11
  52. package/dist/api-type-def/normal/killstreak/getCurrentKillstreak.d.ts +9 -11
  53. package/dist/api-type-def/normal/killstreak/index.d.ts +4 -3
  54. package/dist/api-type-def/normal/message/broadcastMessage.d.ts +14 -16
  55. package/dist/api-type-def/normal/message/index.d.ts +23 -4
  56. package/dist/api-type-def/normal/message/sendFlyingMiddleMessage.d.ts +13 -15
  57. package/dist/api-type-def/normal/message/sendMessage.d.ts +26 -25
  58. package/dist/api-type-def/normal/message/sendTopRightHelper.d.ts +31 -0
  59. package/dist/api-type-def/normal/playParticleEffect.d.ts +11 -0
  60. package/dist/api-type-def/normal/player/getNumPlayers.d.ts +8 -10
  61. package/dist/api-type-def/normal/player/getPlayerDbId.d.ts +9 -0
  62. package/dist/api-type-def/normal/player/getPlayerId.d.ts +9 -0
  63. package/dist/api-type-def/normal/player/getPlayerIdFromDbId.d.ts +9 -0
  64. package/dist/api-type-def/normal/player/getPlayerIds.d.ts +8 -10
  65. package/dist/api-type-def/normal/player/getPlayerPartyWhenJoined.d.ts +10 -12
  66. package/dist/api-type-def/normal/player/index.d.ts +12 -6
  67. package/dist/api-type-def/normal/player/isMobile.d.ts +9 -0
  68. package/dist/api-type-def/normal/player/kickPlayer.d.ts +8 -0
  69. package/dist/api-type-def/normal/player/playerIsInGame.d.ts +9 -11
  70. package/dist/api-type-def/normal/player/playerIsLoggedIn.d.ts +7 -9
  71. package/dist/api-type-def/normal/positions/getPosition.d.ts +9 -11
  72. package/dist/api-type-def/normal/positions/index.d.ts +7 -3
  73. package/dist/api-type-def/normal/positions/setPosition.d.ts +23 -22
  74. package/dist/api-type-def/normal/shields/getShieldAmount.d.ts +11 -13
  75. package/dist/api-type-def/normal/shields/index.d.ts +4 -4
  76. package/dist/api-type-def/normal/shields/setShieldAmount.d.ts +10 -12
  77. package/dist/api-type-def/normal/shops/configureShopCategory.d.ts +10 -12
  78. package/dist/api-type-def/normal/shops/configureShopCategoryForPlayer.d.ts +11 -0
  79. package/dist/api-type-def/normal/shops/createShopItem.d.ts +14 -16
  80. package/dist/api-type-def/normal/shops/createShopItemForPlayer.d.ts +14 -0
  81. package/dist/api-type-def/normal/shops/deleteShopItem.d.ts +12 -14
  82. package/dist/api-type-def/normal/shops/index.d.ts +11 -6
  83. package/dist/api-type-def/normal/shops/resetShopItemForPlayer.d.ts +14 -0
  84. package/dist/api-type-def/normal/shops/showShopTutorial.d.ts +9 -11
  85. package/dist/api-type-def/normal/shops/updateShopItem.d.ts +13 -15
  86. package/dist/api-type-def/normal/shops/updateShopItemForPlayer.d.ts +14 -0
  87. package/dist/api-type-def/normal/standingOns/getBlockCoordinatesPlayerStandingOn.d.ts +12 -14
  88. package/dist/api-type-def/normal/standingOns/getBlockTypesPlayerStandingOn.d.ts +10 -12
  89. package/dist/api-type-def/normal/standingOns/index.d.ts +4 -3
  90. package/dist/index.d.ts +9 -9
  91. package/dist/type/ApplyMeleeHitOverrides.d.ts +7 -7
  92. package/dist/type/ChunkId.d.ts +1 -0
  93. package/dist/type/Coordinate.d.ts +1 -1
  94. package/dist/type/Direction.d.ts +1 -1
  95. package/dist/type/Health.d.ts +1 -1
  96. package/dist/type/ItemMetaInfo.d.ts +1 -0
  97. package/dist/type/LifeFormBodyPart.d.ts +1 -1
  98. package/dist/type/Party.d.ts +5 -5
  99. package/dist/type/PlayerAttemptDamageOtherPlayerOpts.d.ts +19 -19
  100. package/dist/type/ShieldAmount.d.ts +1 -1
  101. package/dist/type/WhoDidDamage.d.ts +5 -5
  102. package/dist/type/WhoKilled.d.ts +2 -2
  103. package/dist/type/WorldBlockChangedInfo.d.ts +3 -0
  104. package/dist/type/block/AllBlockId.d.ts +1 -1
  105. package/dist/type/block/AllBlockName.d.ts +1 -1
  106. package/dist/type/block/Block.d.ts +3 -3
  107. package/dist/type/block/BlockId.d.ts +2 -6
  108. package/dist/type/block/BlockName.d.ts +2 -6
  109. package/dist/type/block/index.d.ts +5 -5
  110. package/dist/type/color/Array255Color.d.ts +8 -8
  111. package/dist/type/color/Array255ColorWithA.d.ts +10 -10
  112. package/dist/type/color/StringColor.d.ts +7 -7
  113. package/dist/type/color/index.d.ts +3 -3
  114. package/dist/type/dbId/PlayerDbId.d.ts +1 -5
  115. package/dist/type/dbId/index.d.ts +1 -1
  116. package/dist/type/id/EntityId.d.ts +2 -6
  117. package/dist/type/id/Id.d.ts +1 -5
  118. package/dist/type/id/ItemEntityId.d.ts +2 -0
  119. package/dist/type/id/LifeFormId.d.ts +3 -3
  120. package/dist/type/id/MobId.d.ts +2 -6
  121. package/dist/type/id/PlayerId.d.ts +2 -6
  122. package/dist/type/id/index.d.ts +6 -5
  123. package/dist/type/index.d.ts +24 -20
  124. package/dist/type/item/AllItemId.d.ts +4 -4
  125. package/dist/type/item/AllItemName.d.ts +1 -1
  126. package/dist/type/item/Item.d.ts +3 -3
  127. package/dist/type/item/ItemAttributes.d.ts +5 -0
  128. package/dist/type/item/ItemId.d.ts +2 -6
  129. package/dist/type/item/ItemName.d.ts +2 -6
  130. package/dist/type/item/index.d.ts +6 -5
  131. package/dist/type/message/CustomTextStyling.d.ts +2 -2
  132. package/dist/type/message/EntityName.d.ts +8 -8
  133. package/dist/type/message/StyledIcon.d.ts +10 -10
  134. package/dist/type/message/StyledText.d.ts +6 -6
  135. package/dist/type/message/TextStyle.d.ts +8 -8
  136. package/dist/type/message/TranslatedText.d.ts +5 -5
  137. package/dist/type/message/index.d.ts +6 -6
  138. package/dist/type/mob/MobType.d.ts +1 -1
  139. package/dist/type/mob/index.d.ts +1 -1
  140. package/dist/type/particle/ParticlePresetOpts.d.ts +20 -20
  141. package/dist/type/particle/ParticleSystemBlendMode.d.ts +21 -21
  142. package/dist/type/particle/PresetId.d.ts +1 -1
  143. package/dist/type/particle/TempParticleSystemOpts.d.ts +31 -31
  144. package/dist/type/particle/Texture.d.ts +1 -1
  145. package/dist/type/particle/index.d.ts +5 -5
  146. package/dist/type/shop/ShopCategoryConfig.d.ts +9 -9
  147. package/dist/type/shop/ShopCategoryKey.d.ts +1 -1
  148. package/dist/type/shop/ShopItem.d.ts +25 -25
  149. package/dist/type/shop/ShopItemBadgeType.d.ts +1 -1
  150. package/dist/type/shop/ShopItemKey.d.ts +1 -1
  151. package/dist/type/shop/ShopItemUserInput.d.ts +25 -25
  152. package/dist/type/shop/index.d.ts +6 -6
  153. package/dist/type/sound/AllSoundName.d.ts +1 -1
  154. package/dist/type/sound/SoundName.d.ts +2 -6
  155. package/dist/type/sound/index.d.ts +2 -2
  156. package/dist/type/utilType.d.ts +3 -3
  157. package/package.json +1 -1
  158. package/readme.md +48 -1
@@ -0,0 +1,12 @@
1
+ import { BlockId } from "../../../type/index";
2
+ /**
3
+ * Used to get the block id at a specific position.
4
+ * Intended only for use in hot code paths - default to getBlock for most use cases
5
+ *
6
+ * @param {number} x
7
+ * @param {number} y
8
+ * @param {number} z
9
+ * @returns {BlockId}
10
+ */
11
+ declare const getBlockId: (x: number, y: number, z: number) => BlockId;
12
+ export { getBlockId };
@@ -0,0 +1,19 @@
1
+ import { Coordinate } from "../../../type/index";
2
+ /**
3
+ * Returns whether a block is solid or not.
4
+ * E.g. Grass block is solid, while water, ladder and water are not.
5
+ * Will be true if the block is unloaded.
6
+ *
7
+ * overload 1: getBlockSolidity(x: number, y: number, z: number): boolean
8
+ * overload 2: getBlockSolidity(pos: Coordinate): boolean
9
+ *
10
+ * @param {number} x
11
+ * @param {number} y
12
+ * @param {number} z
13
+ * @returns {boolean}
14
+ */
15
+ declare const getBlockSolidity: {
16
+ (x: number, y: number, z: number): boolean;
17
+ (pos: Coordinate): boolean;
18
+ };
19
+ export { getBlockSolidity };
@@ -0,0 +1,15 @@
1
+ import { Coordinate } from "../../../type/index";
2
+ /**
3
+ * Only use this instead of getBlock if you REALLY need the performance (i.e. you are iterating over tens of thousands of blocks)
4
+ * ReturnedObject.blockData is a 32x32x32 ndarray of block ids
5
+ * (see https://www.npmjs.com/package/ndarray)
6
+ * Each block id is a 16-bit number
7
+ * The ndarray should only be read from, writing to it will result in desync between the server and client
8
+ *
9
+ * @param {number[]} pos - The returned chunk contains pos
10
+ * @returns {PNull<GameChunk>} - null if the chunk is not loaded in a persisted world. ReturnedObject.blockData is an ndarray that can be accessed
11
+ *
12
+ * @throws allways happen error
13
+ */
14
+ declare const getChunk: (pos: Coordinate) => never;
15
+ export { getChunk };
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Only use chunk helpers if you REALLY need the performance (i.e. you are iterating over tens of thousands of blocks)
3
+ * ReturnedObject.blockData is a 32x32x32 ndarray of air.
4
+ * (see https://www.npmjs.com/package/ndarray)
5
+ * Each block id is a 16-bit number
6
+ *
7
+ * @throws alwavs happen error
8
+ *
9
+ * @returns {GameChunk}
10
+ */
11
+ declare const getEmptyChunk: () => never;
12
+ export { getEmptyChunk };
@@ -0,0 +1,9 @@
1
+ import { Block, ItemMetaInfo } from "../../../type/index";
2
+ /**
3
+ * Splits the block name by '|'. If no meta info, metaInfo is ''
4
+ *
5
+ * @param {BlockName | null | undefined} blockName
6
+ * @returns {ItemMetaInfo}
7
+ */
8
+ declare const getMetaInfo: (blockName: Block | null | undefined) => ItemMetaInfo;
9
+ export { getMetaInfo };
@@ -0,0 +1,30 @@
1
+ export declare const BlockApis: {
2
+ isBlockInLoadedChunk: (x: number, y: number, z: number) => boolean;
3
+ getBlock: {
4
+ (x: number, y: number, z: number): import("../../..").BlockName;
5
+ (pos: import("../../..").Coordinate): import("../../..").BlockName;
6
+ };
7
+ getBlockId: (x: number, y: number, z: number) => import("../../..").BlockId;
8
+ setBlock: {
9
+ (x: number, y: number, z: number, blockName: import("../../..").BlockName): void;
10
+ (pos: import("../../..").Coordinate, blockName: import("../../..").BlockName): void;
11
+ };
12
+ attemptWorldChangeBlock: (initatorDbId: null | import("../../..").PlayerDbId, x: number, y: number, z: number, blockName: import("../../..").BlockName, extraInfo?: import("../../..").WorldBlockChangedInfo) => "preventChange" | "preventDrop" | void;
13
+ getBlockSolidity: {
14
+ (x: number, y: number, z: number): boolean;
15
+ (pos: import("../../..").Coordinate): boolean;
16
+ };
17
+ setBlockRect: (pos1: import("../../..").Coordinate, pos2: import("../../..").Coordinate, blockName: import("../../..").Block) => void;
18
+ setBlockWalls: (pos1: import("../../..").Coordinate, pos2: import("../../..").Coordinate, blockName: import("../../..").Block, hasFloor?: boolean, hasCeiling?: boolean) => void;
19
+ getChunk: (pos: import("../../..").Coordinate) => never;
20
+ getEmptyChunk: () => never;
21
+ getMetaInfo: (blockName: import("../../..").Block | null | undefined) => import("../../..").ItemMetaInfo;
22
+ blockNameToBlockId: {
23
+ (blockName: import("../../..").BlockName): import("../../..").BlockId;
24
+ (blockName: import("../../..").BlockName, allowInvalidBlock: true): null | import("../../..").BlockId;
25
+ (blockName: import("../../..").BlockName, allowInvalidBlock: false): import("../../..").BlockId;
26
+ };
27
+ blockIdToBlockName: (blockId: import("../../..").BlockId) => import("../../..").BlockName;
28
+ blockCoordToChunkId: (pos: import("../../..").Coordinate) => import("../../..").ChunkId;
29
+ chunkIdToBotLeftCoord: (chunkId: import("../../..").ChunkId) => import("../../..").Coordinate;
30
+ };
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Check if the block at a specific position is in a loaded chunk.
3
+ *
4
+ * @param {number} x
5
+ * @param {number} y
6
+ * @param {number} z
7
+ * @returns {boolean} - boolean
8
+ */
9
+ declare const isBlockInLoadedChunk: (x: number, y: number, z: number) => boolean;
10
+ export { isBlockInLoadedChunk };
@@ -0,0 +1,20 @@
1
+ import { BlockName, Coordinate } from "../../../type/index";
2
+ /**
3
+ * Set a block. Valid names are those either contained in blockMetadata.ts or are 'Air'
4
+ *
5
+ * 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.
6
+ *
7
+ * overload1: setBlock(x: number, y: number, z: number, blockName: BlockName): void
8
+ * overload2: setBlock(pos: Coordinate, blockName: BlockName): void
9
+ *
10
+ * @param {number} x
11
+ * @param {number} y
12
+ * @param {number} z
13
+ * @param {BlockName} blockName
14
+ * @returns {void}
15
+ */
16
+ declare const setBlock: {
17
+ (x: number, y: number, z: number, blockName: BlockName): void;
18
+ (pos: Coordinate, blockName: BlockName): void;
19
+ };
20
+ export { setBlock };
@@ -0,0 +1,11 @@
1
+ import { Block, Coordinate } from "../../../type/index";
2
+ /**
3
+ * Helper function that sets all blocks in a rectangle to a specific block.
4
+ *
5
+ * @param {number[]} pos1 - array [x, y, z]
6
+ * @param {number[]} pos2 - array [x, y, z]
7
+ * @param {BlockName} blockName
8
+ * @returns {void}
9
+ */
10
+ declare const setBlockRect: (pos1: Coordinate, pos2: Coordinate, blockName: Block) => void;
11
+ export { setBlockRect };
@@ -0,0 +1,13 @@
1
+ import { Block, Coordinate } from "../../../type/index";
2
+ /**
3
+ * Create walls by providing two opposite corners of the cuboid
4
+ *
5
+ * @param {number[]} pos1 - array [x, y, z]
6
+ * @param {number[]} pos2 - array [x, y, z]
7
+ * @param {BlockName} blockName
8
+ * @param {boolean} [hasFloor]
9
+ * @param {boolean} [hasCeiling]
10
+ * @returns {void}
11
+ */
12
+ declare const setBlockWalls: (pos1: Coordinate, pos2: Coordinate, blockName: Block, hasFloor?: boolean, hasCeiling?: boolean) => void;
13
+ export { setBlockWalls };
@@ -0,0 +1,9 @@
1
+ import { EntityId } from "../../../type/index";
2
+ /**
3
+ * Get the in game name of an entity.
4
+ *
5
+ * @param {EntityId} entityId
6
+ * @returns {string}
7
+ */
8
+ declare const getEntityName: (entityId: EntityId) => string;
9
+ export { getEntityName };
@@ -0,0 +1,3 @@
1
+ export declare const EntityApis: {
2
+ getEntityName: (entityId: import("../../..").EntityId) => string;
3
+ };
@@ -1 +1,10 @@
1
- export {};
1
+ import { Coordinate, PlayerId } from "../../type/index";
2
+ /**
3
+ * Force respawn a player
4
+ *
5
+ * @param {PlayerId} playerId
6
+ * @param {Coordinate} [respawnPos]
7
+ * @returns {void}
8
+ */
9
+ declare const forceRespawn: (playerId: PlayerId, respawnPos?: Readonly<Coordinate>) => void;
10
+ export { forceRespawn };
@@ -1,12 +1,10 @@
1
- import { Coordinate, LifeformId } from "../../type/index";
2
- interface GetUnitCoordinatesLifeformWithinInterface {
3
- /**
4
- * Get the up to 12 unit co-ordinates the lifeform is located within
5
- * (A lifeform is modelled as having four corners and can be in up to 3 blocks vertically)
6
- *
7
- * @param {LifeformId} lifeformId
8
- * @returns {number[][]} - List of x, y, z positions e.g. [[-1, 0, 0], [-1, 1, 0], [-1, 2, 0]]
9
- */
10
- getUnitCoordinatesLifeformWithin(lifeformId: LifeformId): Coordinate[];
11
- }
12
- export default GetUnitCoordinatesLifeformWithinInterface;
1
+ import { Coordinate, LifeformId } from "../../type/index";
2
+ /**
3
+ * Get the up to 12 unit co-ordinates the lifeform is located within
4
+ * (A lifeform is modelled as having four corners and can be in up to 3 blocks vertically)
5
+ *
6
+ * @param {LifeformId} lifeformId
7
+ * @returns {number[][]} - List of x, y, z positions e.g. [[-1, 0, 0], [-1, 1, 0], [-1, 2, 0]]
8
+ */
9
+ declare const getUnitCoordinatesLifeformWithin: (lifeformId: LifeformId) => Coordinate[];
10
+ export { getUnitCoordinatesLifeformWithin };
@@ -1,12 +1,10 @@
1
- import { LifeformId, WhoDidDamage } from "../../../type/index";
2
- interface ApplyHealthChangeInterface {
3
- /**
4
- * @param {LifeformId} lifeformId
5
- * @param {number} 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.
6
- * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoDidDamage] - Optional - If damage done by another player
7
- * @param {boolean} [broadcastLifeformHurt]
8
- * @returns {boolean} - Whether the entity was killed
9
- */
10
- applyHealthChange(lifeformId: LifeformId, changeAmount: number, whoDidDamage?: Readonly<WhoDidDamage>, broadcastLifeformHurt?: boolean): boolean;
11
- }
12
- export default ApplyHealthChangeInterface;
1
+ import { LifeformId, WhoDidDamage } from "../../../type/index";
2
+ /**
3
+ * @param {LifeformId} lifeformId
4
+ * @param {number} 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.
5
+ * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoDidDamage] - Optional - If damage done by another player
6
+ * @param {boolean} [broadcastLifeformHurt]
7
+ * @returns {boolean} - Whether the entity was killed
8
+ */
9
+ declare const applyHealthChange: (lifeformId: LifeformId, changeAmount: number, whoDidDamage?: Readonly<WhoDidDamage>, broadcastLifeformHurt?: boolean) => boolean;
10
+ export { applyHealthChange };
@@ -1,20 +1,18 @@
1
- import { applyMeleeHitOverrides, Direcrion, LifeformBodyPart, LifeformId } from "../../../type/index";
2
- interface ApplyMeleeHitInterface {
3
- /**
4
- * Make it as if hittingEId hit hitEId
5
- *
6
- * @param {LifeformId} hittingEId
7
- * @param {LifeformId} hitEId
8
- * @param {number[]} dirFacing
9
- * @param {PNull<LifeformBodyPart>} [bodyPartHit]
10
- * @param { {
11
- * damage?: PNull<number>
12
- * heldItemName?: PNull<string>
13
- * horizontalKbMultiplier?: number
14
- * verticalKbMultiplier?: number
15
- * } } [overrides]
16
- * @returns {boolean} - hitEId was died by this calling
17
- */
18
- applyMeleeHit(hittingEId: LifeformId, hitEId: LifeformId, dirFacing: Readonly<Direcrion>, bodyPartHit?: LifeformBodyPart | null, overrides?: Readonly<applyMeleeHitOverrides>): boolean;
19
- }
20
- export default ApplyMeleeHitInterface;
1
+ import { applyMeleeHitOverrides, Direcrion, LifeformBodyPart, LifeformId } from "../../../type/index";
2
+ /**
3
+ * Make it as if hittingEId hit hitEId
4
+ *
5
+ * @param {LifeformId} hittingEId
6
+ * @param {LifeformId} hitEId
7
+ * @param {number[]} dirFacing
8
+ * @param {PNull<LifeformBodyPart>} [bodyPartHit]
9
+ * @param { {
10
+ * damage?: PNull<number>
11
+ * heldItemName?: PNull<string>
12
+ * horizontalKbMultiplier?: number
13
+ * verticalKbMultiplier?: number
14
+ * } } [overrides]
15
+ * @returns {boolean} - hitEId was died by this calling
16
+ */
17
+ declare const applyMeleeHit: (hittingEId: LifeformId, hitEId: LifeformId, dirFacing: Readonly<Direcrion>, bodyPartHit?: LifeformBodyPart | null, overrides?: Readonly<applyMeleeHitOverrides>) => boolean;
18
+ export { applyMeleeHit };
@@ -1,31 +1,29 @@
1
- import { PlayerAttemptDamageOtherPlayerOpts } from "../../../type/index";
2
- interface AttemptApplyDamageInterface {
3
- /**
4
- * Apply damage to a lifeform.
5
- * eId is the player initiating the damage, hitEId is the lifeform being hit.
6
- *
7
- * It is recommended to self-inflict damage when the game code wants to apply damage to a lifeform.
8
- *
9
- * @param {PlayerAttemptDamageOtherPlayerOpts} {
10
- * eId,
11
- * hitEId,
12
- * attemptedDmgAmt,
13
- * withItem,
14
- * bodyPartHit = undefined,
15
- * attackDir = undefined,
16
- * showCritParticles = false,
17
- * reduceVerticalKbVelocity = true,
18
- * horizontalKbMultiplier = 1,
19
- * verticalKbMultiplier = 1,
20
- * broadcastEntityHurt = true,
21
- * attackCooldownSettings = null,
22
- * hittingSoundOverride = null,
23
- * ignoreOtherEntitySettingCanAttack = false,
24
- * isTrueDamage = false,
25
- * damagerDbId = null,
26
- * }
27
- * @returns {boolean} - whether the attack damaged the lifeform
28
- */
29
- attemptApplyDamage(options: Readonly<PlayerAttemptDamageOtherPlayerOpts>): boolean;
30
- }
31
- export default AttemptApplyDamageInterface;
1
+ import { PlayerAttemptDamageOtherPlayerOpts } from "../../../type/index";
2
+ /**
3
+ * Apply damage to a lifeform.
4
+ * eId is the player initiating the damage, hitEId is the lifeform being hit.
5
+ *
6
+ * It is recommended to self-inflict damage when the game code wants to apply damage to a lifeform.
7
+ *
8
+ * @param {PlayerAttemptDamageOtherPlayerOpts} {
9
+ * eId,
10
+ * hitEId,
11
+ * attemptedDmgAmt,
12
+ * withItem,
13
+ * bodyPartHit = undefined,
14
+ * attackDir = undefined,
15
+ * showCritParticles = false,
16
+ * reduceVerticalKbVelocity = true,
17
+ * horizontalKbMultiplier = 1,
18
+ * verticalKbMultiplier = 1,
19
+ * broadcastEntityHurt = true,
20
+ * attackCooldownSettings = null,
21
+ * hittingSoundOverride = null,
22
+ * ignoreOtherEntitySettingCanAttack = false,
23
+ * isTrueDamage = false,
24
+ * damagerDbId = null,
25
+ * }
26
+ * @returns {boolean} - whether the attack damaged the lifeform
27
+ */
28
+ declare const attemptApplyDamage: (options: Readonly<PlayerAttemptDamageOtherPlayerOpts>) => boolean;
29
+ export { attemptApplyDamage };
@@ -1,15 +1,13 @@
1
- import { EntityId, Health } from "../../../type/index";
2
- interface GetHealthInterface {
3
- /**
4
- * Get the current health of an entity.
5
- *
6
- * @bulebrainbrand may be this function can use all entity...
7
- * but offical docment is contradiction Playerid and EntityId
8
- * well,pls test and report
9
- *
10
- * @param {EntityId} entityId
11
- * @returns {number}
12
- */
13
- getHealth(entityId: EntityId): Health;
14
- }
15
- export default GetHealthInterface;
1
+ import { EntityId, Health } from "../../../type/index";
2
+ /**
3
+ * Get the current health of an entity.
4
+ *
5
+ * @bulebrainbrand may be this function can use all entity...
6
+ * but offical docment is contradiction Playerid and EntityId
7
+ * well,pls test and report
8
+ *
9
+ * @param {EntityId} entityId
10
+ * @returns {number}
11
+ */
12
+ declare const getHealth: (entityId: EntityId) => Health;
13
+ export { getHealth };
@@ -1,8 +1,9 @@
1
- import GetHealthInterface from "./getHealth";
2
- import SetHealthinterface from "./setHealth";
3
- import AttemptApplyDamageInterface from "./attemptApplyDamage";
4
- import ApplyMeleeHitInterface from "./applyMeleeHit";
5
- import ApplyHealthChangeInterface from "./applyHealthChange";
6
- import killLifeformInterface from "./killLifeform";
7
- import IsAliveInterface from "./isAlive";
8
- export type HealthApis = GetHealthInterface & SetHealthinterface & AttemptApplyDamageInterface & ApplyMeleeHitInterface & ApplyHealthChangeInterface & killLifeformInterface & IsAliveInterface;
1
+ export declare const HealthApis: {
2
+ getHealth: (entityId: import("../../..").EntityId) => import("../../..").Health;
3
+ setHealth: (entityId: import("../../..").EntityId, newHealth: import("../../..").Health | null, whoDidDamage?: Readonly<import("../../..").WhoDidDamage>, increaseMaxHealthIfNeeded?: boolean) => boolean;
4
+ attemptApplyDamage: (options: Readonly<import("../../..").PlayerAttemptDamageOtherPlayerOpts>) => boolean;
5
+ applyMeleeHit: (hittingEId: import("../../..").LifeformId, hitEId: import("../../..").LifeformId, dirFacing: Readonly<import("../../..").Direcrion>, bodyPartHit?: import("../../..").LifeformBodyPart | null, overrides?: Readonly<import("../../..").applyMeleeHitOverrides>) => boolean;
6
+ applyHealthChange: (lifeformId: import("../../..").LifeformId, changeAmount: number, whoDidDamage?: Readonly<import("../../..").WhoDidDamage>, broadcastLifeformHurt?: boolean) => boolean;
7
+ killLifeform: (lifeformId: import("../../..").LifeformId, whoKilled?: import("../../..").WhoKilled) => void;
8
+ isAlive: (lifeformId: import("../../..").LifeformId) => boolean;
9
+ };
@@ -1,11 +1,9 @@
1
- import { LifeformId } from "../../../type/index";
2
- interface IsAliveInterface {
3
- /**
4
- * Whether a lifeform is alive or dead (or on the respawn screen, in a player's case).
5
- *
6
- * @param {LifeformId} lifeformId
7
- * @returns {boolean}
8
- */
9
- isAlive(lifeformId: LifeformId): boolean;
10
- }
11
- export default IsAliveInterface;
1
+ import { LifeformId } from "../../../type/index";
2
+ /**
3
+ * Whether a lifeform is alive or dead (or on the respawn screen, in a player's case).
4
+ *
5
+ * @param {LifeformId} lifeformId
6
+ * @returns {boolean}
7
+ */
8
+ declare const isAlive: (lifeformId: LifeformId) => boolean;
9
+ export { isAlive };
@@ -1,12 +1,10 @@
1
- import { LifeformId, WhoKilled } from "../../../type/index";
2
- interface killLifeformInterface {
3
- /**
4
- * Kill a lifeform.
5
- *
6
- * @param {LifeformId} lifeformId
7
- * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoKilled] - Optional
8
- * @returns {void}
9
- */
10
- killLifeform(lifeformId: LifeformId, whoKilled?: WhoKilled): void;
11
- }
12
- export default killLifeformInterface;
1
+ import { LifeformId, WhoKilled } from "../../../type/index";
2
+ /**
3
+ * Kill a lifeform.
4
+ *
5
+ * @param {LifeformId} lifeformId
6
+ * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoKilled] - Optional
7
+ * @returns {void}
8
+ */
9
+ declare const killLifeform: (lifeformId: LifeformId, whoKilled?: WhoKilled) => void;
10
+ export { killLifeform };
@@ -1,17 +1,15 @@
1
- import { EntityId, Health, WhoDidDamage } from "../../../type/index";
2
- interface SetHealthinterface {
3
- /**
4
- * Set the current health of an entity.
5
- * If you want to set their health to more than their current max health, the optional increaseMaxHealthIfNeeded must be true.
6
- *
7
- * @bulebrainbrand i think this api cannot use other lifeformId
8
- *
9
- * @param {EntityId} entityId
10
- * @param {PNull<number>} newHealth - Can be null to make the player not have health
11
- * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoDidDamage] - Optional
12
- * @param {boolean} [increaseMaxHealthIfNeeded] - Optional
13
- * @returns {boolean} - Whether this change in health killed the player
14
- */
15
- setHealth(entityId: EntityId, newHealth: Health | null, whoDidDamage?: Readonly<WhoDidDamage>, increaseMaxHealthIfNeeded?: boolean): boolean;
16
- }
17
- export default SetHealthinterface;
1
+ import { EntityId, Health, WhoDidDamage } from "../../../type/index";
2
+ /**
3
+ * Set the current health of an entity.
4
+ * If you want to set their health to more than their current max health, the optional increaseMaxHealthIfNeeded must be true.
5
+ *
6
+ * @bulebrainbrand i think this api cannot use other lifeformId
7
+ *
8
+ * @param {EntityId} entityId
9
+ * @param {PNull<number>} newHealth - Can be null to make the player not have health
10
+ * @param { LifeformId | { lifeformId: LifeformId; withItem: string } } [whoDidDamage] - Optional
11
+ * @param {boolean} [increaseMaxHealthIfNeeded] - Optional
12
+ * @returns {boolean} - Whether this change in health killed the player
13
+ */
14
+ declare const setHealth: (entityId: EntityId, newHealth: Health | null, whoDidDamage?: Readonly<WhoDidDamage>, increaseMaxHealthIfNeeded?: boolean) => boolean;
15
+ export { setHealth };
@@ -1,13 +1,67 @@
1
- import GetUnitCoordinatesLifeformWithinInterface from "./getUnitCoordinatesLifeformWithin";
2
- import { ShopApis } from "./shops/index";
3
- import { ShieldApis } from "./shields/index";
4
- import { PositionApis } from "./positions/index";
5
- import { StandingOnApis } from "./standingOns/index";
6
- import { HealthApis } from "./health/index";
7
- import { KillstreakApis } from "./killstreak/index";
8
- import { MessageApis } from "./message/index";
9
- import { PlayerApis } from "./player/index";
10
- import { MargeObject } from "../../type/index";
11
- type AllNormalApiIntersection = PositionApis & PlayerApis & StandingOnApis & GetUnitCoordinatesLifeformWithinInterface & ShopApis & ShieldApis & HealthApis & KillstreakApis & MessageApis;
12
- export type NormalApi = MargeObject<AllNormalApiIntersection>;
13
- export {};
1
+ export declare const NormalApis: {
2
+ readonly forceRespawn: (playerId: import("../../type/index").PlayerId, respawnPos?: Readonly<import("../../type/index").Coordinate>) => void;
3
+ readonly getEntityName: (entityId: import("../../type/index").EntityId) => string;
4
+ readonly getPlayerIds: () => import("../../type/index").PlayerId[];
5
+ readonly getNumPlayers: () => number;
6
+ readonly getPlayerPartyWhenJoined: (playerId: import("../../type/index").PlayerId) => import("../../type/index").Party | null;
7
+ readonly playerIsInGame: (playerId: import("../../type/index").PlayerId) => boolean;
8
+ readonly playerIsLoggedIn: (playerId: import("../../type/index").PlayerId) => boolean;
9
+ readonly getPlayerId: (playerName: string) => null | import("../../type/index").PlayerId;
10
+ readonly getPlayerDbId: (playerId: import("../../type/index").PlayerId) => import("../../type/index").PlayerDbId;
11
+ readonly getPlayerIdFromDbId: (dbId: import("../../type/index").PlayerDbId) => null | import("../../type/index").PlayerId;
12
+ readonly kickPlayer: (playerId: import("../../type/index").PlayerId, reason: string) => void;
13
+ readonly isMobile: (playerId: import("../../type/index").PlayerId) => boolean;
14
+ readonly broadcastMessage: (message: string | import("../../type/index").CustomTextStyling, style?: {
15
+ fontWeight?: number | string;
16
+ color?: string;
17
+ }) => void;
18
+ readonly sendMessage: {
19
+ (playerId: import("../../type/index").PlayerId, message: string, style: {
20
+ fontWeight?: number | string;
21
+ color?: string;
22
+ }): void;
23
+ (playerId: import("../../type/index").PlayerId, message: import("../../type/index").CustomTextStyling): void;
24
+ };
25
+ readonly sendFlyingMiddleMessage: (playerId: import("../../type/index").PlayerId, message: string | import("../../type/index").CustomTextStyling, distanceFromAction?: number, lifetimeMs?: number) => void;
26
+ readonly sendTopRightHelper: (playerId: import("../../type/index").PlayerId, icon: string, text: string, opts: {
27
+ duration?: number;
28
+ width?: number;
29
+ height?: number;
30
+ color?: import("../../type/index").StringColor;
31
+ iconSizeMult?: number;
32
+ textAndIconColor?: string;
33
+ fontSize?: string;
34
+ }) => void;
35
+ readonly getCurrentKillstreak: (playerId: import("../../type/index").PlayerId) => number;
36
+ readonly clearKillstreak: (playerId: import("../../type/index").PlayerId) => void;
37
+ readonly createItemDrop: (x: number, y: number, z: number, itemName: import("../../type/index").ItemName, amount?: number | null, margeItems?: boolean, attributes?: import("../../type/index").ItemAttributes, timeTillDespawn?: number, dropperId?: import("../../type/index").LifeformId | null, options?: never) => null | import("../../type/index").ItemEntityId;
38
+ readonly setCantPickUpItem: (playerId: import("../../type/index").PlayerId, itemId: import("../../type/index").ItemEntityId) => void;
39
+ readonly deleteItemDrop: (itemId: import("../../type/index").ItemEntityId) => void;
40
+ readonly getHealth: (entityId: import("../../type/index").EntityId) => import("../../type/index").Health;
41
+ readonly setHealth: (entityId: import("../../type/index").EntityId, newHealth: import("../../type/index").Health | null, whoDidDamage?: Readonly<import("../../type/index").WhoDidDamage>, increaseMaxHealthIfNeeded?: boolean) => boolean;
42
+ readonly attemptApplyDamage: (options: Readonly<import("../../type/index").PlayerAttemptDamageOtherPlayerOpts>) => boolean;
43
+ readonly applyMeleeHit: (hittingEId: import("../../type/index").LifeformId, hitEId: import("../../type/index").LifeformId, dirFacing: Readonly<import("../../type/index").Direcrion>, bodyPartHit?: import("../../type/index").LifeformBodyPart | null, overrides?: Readonly<import("../../type/index").applyMeleeHitOverrides>) => boolean;
44
+ readonly applyHealthChange: (lifeformId: import("../../type/index").LifeformId, changeAmount: number, whoDidDamage?: Readonly<import("../../type/index").WhoDidDamage>, broadcastLifeformHurt?: boolean) => boolean;
45
+ readonly killLifeform: (lifeformId: import("../../type/index").LifeformId, whoKilled?: import("../../type/index").WhoKilled) => void;
46
+ readonly isAlive: (lifeformId: import("../../type/index").LifeformId) => boolean;
47
+ readonly getBlockCoordinatesPlayerStandingOn: (playerId: import("../../type/index").PlayerId) => import("../../type/index").Coordinate[];
48
+ readonly getBlockTypesPlayerStandingOn: (playerId: import("../../type/index").PlayerId) => import("../../type/index").BlockName[];
49
+ readonly getPosition: (entityId: import("../../type/index").EntityId) => import("../../type/index").Coordinate;
50
+ readonly setPosition: {
51
+ (entityId: import("../../type/index").EntityId, x: number, y: number, z: number): void;
52
+ (entityId: import("../../type/index").EntityId, position: Readonly<import("../../type/index").Coordinate>): void;
53
+ };
54
+ readonly getShieldAmount: (entityId: import("../../type/index").EntityId) => import("../../type/index").ShieldAmount;
55
+ readonly setShieldAmount: (lifeformId: import("../../type/index").LifeformId, newShieldAmount: import("../../type/index").ShieldAmount) => void;
56
+ readonly showShopTutorial: (playerId: import("../../type/index").PlayerId) => void;
57
+ readonly createShopItem: (categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey, item: import("../../type/index").ShopItem) => void;
58
+ readonly updateShopItem: (categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey, changes: Partial<import("../../type/index").ShopItem>) => void;
59
+ readonly deleteShopItem: (categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey) => void;
60
+ readonly configureShopCategory: (categoryKey: import("../../type/index").ShopCategoryKey, config: import("../../type/index").ShopCategoryConfig) => void;
61
+ readonly createShopItemForPlayer: (playerId: import("../../type/index").PlayerId, categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey, item: import("../../type/index").ShopItem) => void;
62
+ readonly updateShopItemForPlayer: (playerId: import("../../type/index").PlayerId, categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey, changes: Partial<import("../../type/index").ShopItem>) => void;
63
+ readonly resetShopItemForPlayer: (playerId: import("../../type/index").PlayerId, categoryKey: import("../../type/index").ShopCategoryKey, itemKey: import("../../type/index").ShopItemKey) => void;
64
+ readonly configureShopCategoryForPlayer: (playerId: import("../../type/index").PlayerId, categoryKey: import("../../type/index").ShopCategoryKey, config: import("../../type/index").ShopCategoryConfig) => void;
65
+ readonly getUnitCoordinatesLifeformWithin: (lifeformId: import("../../type/index").LifeformId) => import("../../type/index").Coordinate[];
66
+ readonly playParticleEffect: (opts: import("../../type/index").TempParticleSystemOpts, clientPredictedBy?: import("../../type/index").PlayerId) => void;
67
+ };
@@ -0,0 +1,20 @@
1
+ import { ItemAttributes, ItemEntityId, ItemName, LifeformId } from "../../../type/index";
2
+ /**
3
+ * Create a dropped item.
4
+ *
5
+ * ItemDropOptions is never cuz i can't find type define in offical docment
6
+ *
7
+ * @param {number} x
8
+ * @param {number} y
9
+ * @param {number} z
10
+ * @param {ItemName} itemName - Name of the item. Valid names can be found in blockMetadata.ts and itemMetadata.ts
11
+ * @param {number | null} [amount] - The amount of the item to include in the drop - so when the player picks up the item drop, they get this many of the item.
12
+ * @param {boolean} [mergeItems] - Whether to merge the item into a nearby item of same type, if one exists. Defaults to false.
13
+ * @param {ItemAttributes} [attributes] - Attributes of the item being dropped
14
+ * @param {number} [timeTillDespawn] - Time till the item automatically despawns in milliseconds. Max of 5 mins.
15
+ * @param {null | LifeformId } [dropperId] - Who dropped the item.
16
+ * @param {ItemDropOptions} [options] - Additional options, such as doPhysics and size.
17
+ * @returns {null | EntityId} - the id you can pass to setCantPickUpItem, or null if the item drop limit was reached
18
+ */
19
+ declare const createItemDrop: (x: number, y: number, z: number, itemName: ItemName, amount?: number | null, margeItems?: boolean, attributes?: ItemAttributes, timeTillDespawn?: number, dropperId?: LifeformId | null, options?: never) => null | ItemEntityId;
20
+ export { createItemDrop };
@@ -0,0 +1,3 @@
1
+ import { ItemEntityId } from "../../../type/index";
2
+ declare const deleteItemDrop: (itemId: ItemEntityId) => void;
3
+ export { deleteItemDrop };
@@ -0,0 +1,5 @@
1
+ export declare const ItemApis: {
2
+ readonly createItemDrop: (x: number, y: number, z: number, itemName: import("../../..").ItemName, amount?: number | null, margeItems?: boolean, attributes?: import("../../..").ItemAttributes, timeTillDespawn?: number, dropperId?: import("../../..").LifeformId | null, options?: never) => null | import("../../..").ItemEntityId;
3
+ readonly setCantPickUpItem: (playerId: import("../../..").PlayerId, itemId: import("../../..").ItemEntityId) => void;
4
+ readonly deleteItemDrop: (itemId: import("../../..").ItemEntityId) => void;
5
+ };
@@ -0,0 +1,3 @@
1
+ import { ItemEntityId, PlayerId } from "../../../type/index";
2
+ declare const setCantPickUpItem: (playerId: PlayerId, itemId: ItemEntityId) => void;
3
+ export { setCantPickUpItem };