# API Reference, part 2 of 5

Part 2 of 5 of [API Reference](https://bloxd.io/docs/api-reference.md). It covers createItemDrop to getMoonstoneChestItemSlot. [llms.txt](https://bloxd.io/docs/llms.txt) lists every part.

## createItemDrop
Create a dropped item.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| x | `number` |  |
| y | `number` |  |
| z | `number` |  |
| itemName | `ItemName` | Name of the item. Any item name, including blocks and 'Air' |
| amount | `PNull<number>` | 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). |
| mergeItems | `boolean` | Whether to merge the item into a nearby item of same type, if one exists. Defaults to false. |
| attributes | `ItemAttributes` | Attributes of the item being dropped |
| timeTillDespawn | `number` | Time till the item automatically despawns in milliseconds. Defaults to 5 mins, max of 1 hour. |
| dropperId | `PNull<LifeformId>` | Who dropped the item. |
| options | `ItemDropOptions` | Additional options, such as doPhysics and size. |



### Returns:
`PNull<EntityId>`

 

the id you can pass to setCantPickUpItem, or null if the item drop limit was reached

## createMobHerd
Create a mob herd. A mob herd represents a collection of mobs that move together.

### Returns:
`MobHerdId`

## createShopItem
Create a new shop item under the given category.

Will create a new category if it does not exist.

If the shop item already exists then it will be replaced.

If any per-player overrides exist under the same categoryKey and itemKey then they will be deleted.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| categoryKey | `ShopCategoryKey` | The key of the category to create the item in |
| itemKey | `ShopItemKey` | The unique key for the item |
| item | `ShopItem` | The shop item to create (will be mutated) |

## createShopItemForPlayer
Create a new shop item for a specific player.

Will create a new category if it does not exist.

Will replace any overrides this player already has for the same item.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` | The player to create the item for |
| categoryKey | `ShopCategoryKey` | The key of the category to create the item in |
| itemKey | `ShopItemKey` | The unique key for the item |
| item | `ShopItem` | The shop item to create (will be mutated) |

## deleteAllItems
Deletes all items dropped in the world

## deleteAllLobbyDbValues
Deletes all database values that are saved per lobby.

## deleteAllPlayerDbValues
Deletes all database values that are saved per player, including persisted currencies.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |

## deleteAudioEntity
Delete an audio entity by its entity ID (returned by attemptCreateAudioEntity).

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |

## deleteCurrency
Delete a currency from a player. This will make the currency unknown to the player.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| currencyId | `string` |  |

## deleteEntity
Delete any non-player entity (mesh entity, mob, audio entity, item drop, throwable, etc.) and dispose of their state.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |



### Returns:
`boolean`

 

whether the entity's replicated state existed and was deleted

## deleteItemDrop
Delete an item drop by item drop entity ID

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| itemId | `EntityId` |  |

## deleteLobbyDbValue
Deletes a database value that is saved per lobby.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| key | `string` |  |

## deleteMeshEntity
Delete a mesh entity

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |



### Returns:
`boolean`

 

whether the api successfully deleted the meshEntity

## deletePlayerDbValue
Deletes a database value that is saved per player.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| key | `string` |  |

## deleteQTE
Delete a quicktime event from the screen

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| id | `QTERequestId` | Returned from the addQTE request you want to cancel |

## deleteShopItem
Delete an existing shop item.

Throws an error if the item does not exist.

Will also delete all per-player overrides for the shop item.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| categoryKey | `ShopCategoryKey` | The key of the category containing the item |
| itemKey | `ShopItemKey` | The unique key for the item |

## deleteThrowable
Delete a throwable entity before it automatically removes itself.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |



### Returns:
`boolean`

 

true if the entity was deleted, false if it was not a throwable entity

## deleteUiRequest
Delete a request for a player.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| id | `UiRequestId` | Returned from the addUiRequest call you want to cancel |

## despawnMob
Dispose of a mob's state and remove them from the world without triggering "on death" flows.

Always succeeds.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` |  |

## despawnVehicle
Dispose of a vehicle's state and remove them from the world.

Always succeeds.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| vehicleId | `EntityId` |  |

## editItemCraftingRecipes
Edit the crafting recipes for a player.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemName | `ItemName` |  |
| recipesForItem | `RecipesForItem` |  |

## exitPlayerVehicle
Take a player off whatever they are riding, dropping them where it is. Does nothing if they are

not riding anything.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |

## findItem
Finds the index of a particular item in a player's inventory.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemName | `ItemName` |  |



### Returns:
`PNull<number>`

## findStandardChestItem
Find the index of a particular item in a standard chest

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| chestPos | `number[]` |  |
| itemName | `ItemName` |  |



### Returns:
`PNull<number>`

## forceRespawn
Force respawn a player

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| respawnPos | `number[]` |  |

## getAuraInfo
Get the aura info for a player

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
` { level: number; totalAura: number; auraPerLevel: number } `

## getBlock
Get the name of a block.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| x | `number \| number[]` | could be an array [x, y, z]. If so, the other params shouldn't be passed. |
| y | `number` |  |
| z | `number` |  |



### Returns:
`BlockName`

## getBlockCoordinatesPlayerStandingOn
Get the co-ordinates of the blocks the entity is standing on as a list. For example, if the centre of the entity is at 0,0,0

this function will return [[0, -1, 0], [-1, -1, 0], [0, -1, -1], [-1, -1, -1]]

If the entity is just standing on one block, the function would return e.g. [[0, 0, 0]]

If the entity is midair or has no physics body, returns an empty list [].

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `EntityId` |  |



### Returns:
`number[][]`

## getBlockData
Get stored data about a block in a performant manner. Data is cleared when block changes.

E.g. chest

Works well with blocks marked tickable (e.g. wheat)

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| x | `number` |  |
| y | `number` |  |
| z | `number` |  |



### Returns:
`any`

## getBlockId
Used to get the block id at a specific position.

Intended only for use in hot code paths - default to getBlock for most use cases

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| x | `number` |  |
| y | `number` |  |
| z | `number` |  |



### Returns:
`BlockId`

## getBlockSolidity
Returns whether a block is solid or not.

E.g. Grass block is solid, while water, ladder and water are not.

Will be true if the block is unloaded.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| x | `number \| number[]` |  |
| y | `number` |  |
| z | `number` |  |



### Returns:
`boolean`

## getBlockTypesPlayerStandingOn
Get the types of block the entity is standing on

For example, if an entity is standing on 4 dirt blocks, this will return ["Dirt", "Dirt", "Dirt", "Dirt"]

Returns an empty list if the entity is midair or has no physics body.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `EntityId` |  |



### Returns:
`any[]`

## getClientOption
Returns the current value of a client option

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| option | `PassedOption` |  |



### Returns:
`ClientOptions[PassedOption]`

## getCraftingRecipesForPlayer
Read a player's current crafting recipe set, keyed by output item name. Includes any

per-player overrides set via `editItemCraftingRecipes` / `removeItemCraftingRecipes`.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`Record<string, RecipesForItem>`

## getCurrencyAmount
Get the amount of a given currency a player has.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| currencyId | `string` |  |



### Returns:
`PNull<number>`

 

The amount of the currency, or null if the currency is not defined.

## getCurrentKillstreak
Gets the player's current killstreak

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`number`

## getDefaultMobSetting
Returns the current default value for a mob setting.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobType | `TMobType` |  |
| setting | `TMobSetting` |  |



### Returns:
`MobSettings<TMobType>[TMobSetting]`

## getEffectLevel
Get the level of an effect on a lifeform, or 0 if they don't have it.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| lifeformId | `LifeformId` |  |
| name | `string` |  |



### Returns:
`number`

## getEffects
Get all the effects currently applied to a lifeform.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| lifeformId | `LifeformId` |  |



### Returns:
`string[]`

## getEmptyChunk
Use this to get a chunk ndarray you can edit and set in resetChunk.



Only use chunk helpers if you REALLY need the performance (i.e. you are iterating over tens of thousands of blocks)

ReturnedObject.blockData is a 32x32x32 ndarray of air.

(see https://www.npmjs.com/package/ndarray)

Each block id is a 16-bit number

### Returns:
`GameChunk`

## getEntitiesInRect
Get the entities in the rect between [minX, minY, minZ] and [maxX, maxY, maxZ]

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| minCoords | `number[]` |  |
| maxCoords | `number[]` |  |



### Returns:
`EntityId[]`

## getEntityHeading


### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |



### Returns:
`number`

## getEntityName
Get the in game name of an entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |



### Returns:
`string`

## getEntityRotation
Get the rotation for a server-auth entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |



### Returns:
`[number, number, number]`

## getEntityType


### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |



### Returns:
`EntityType`

## getHealth
Get the current health of an entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `PlayerId` |  |



### Returns:
`number`

## getHeldItem
Get the currently held item of a player

Returns null if no item is being held

If an item is held, return an object of the format {name: itemName, amount: amountOfItem}

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`PNull<InvenItem>`

## getInitialItemMetadata
Get the metadata about a block or item before stats have been modified by any client options

(i.e. its entry in the initial metadata object)

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| itemName | `string` |  |



### Returns:
`Partial<BlockMetadataItem & NonBlockMetadataItem>`

## getInventoryFreeSlotCount
Get the amount of free slots in a player's inventory.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`number`

 

number

## getInventoryItemAmount
The amount of an itemName a player has.

Returns 0 if the player has none, and a negative number if infinite.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemName | `ItemName` |  |



### Returns:
`number`

 

number

## getItemAmount
Get the amount of an item in an item entity

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| itemId | `EntityId` |  |



### Returns:
`number`

 

number

## getItemDropName
Gets the item name of a dropped item

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| itemEId | `EntityId` | The ID of the dropped item from createItemDrop |



### Returns:
`PNull<ItemName>`

## getItemIDsOverlappingWithPlayer
Returns all items overlapping with the given player

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`EntityId[]`

 

the overlapping item entity IDs

## getItemSlot
Get the item at a specific index

Returns null if there is no item at that index

If there is an item, return an object of the format { name: string; amount: PNull<number>; attributes: ItemAttributes; }

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemSlotIndex | `number` |  |



### Returns:
`PNull<InvenItem>`

## getItemStat
Get stat info about a block or item

Either based on a client option for a player: (e.g. `DirtTtb`)

or its entry in the initial metadata object if no client option is set.



If null is passed for lifeformId, this is simply its entry in blockMetadata etc.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| lifeformId | `PNull<LifeformId>` |  |
| itemName | `ItemName` |  |
| stat | `K` |  |



### Returns:
`AnyMetadataItem[K]`

## getLifeformScale
Get the scale of a lifeform.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| lifeformId | `LifeformId` |  |



### Returns:
`number`

## getLobbyDbValue
Gets a database value that is saved per lobby.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| key | `string` |  |



### Returns:
`PNull<string | number>`

## getLobbyName
Get the name of the lobby this game is running in.

### Returns:
`string`

## getLobbyType
Returns if the current lobby the game is running in is special - e.g. a discord guild or dm, or simply a standard lobby

### Returns:
`LobbyType`

## getMetaInfo
Splits the block name by '|'. If no meta info, metaInfo is ''

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| blockName | `BlockName \| null \| undefined` |  |



### Returns:
`ItemMetaInfo`

## getMobAiState
Gets the current AI state for the given mob.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` |  |



### Returns:
` { state: MobAiState; params: MobAiStateParams<MobAiState> } `

## getMobDbId
Gets the persistent database ID for the given mob.

This can be useful for reasoning about mobs that have been loaded from the database, such as owned mobs.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` | The ID of the mob from spawnMob |



### Returns:
`PNull<MobDbId>`

 

The persistent database ID for the mob, or null if the mob is not persistent

## getMobIds
Get the mob IDs of all mobs in the world.

### Returns:
`MobId[]`

## getMobSetting
Get the current value of a mob setting for a specific mob.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` |  |
| setting | `TMobSetting` |  |
| returnDefaultIfNotOverridden | `boolean` | If true, return the default setting if not overridden. |



### Returns:
`MobSettings<MobType>[TMobSetting]`

## getMoonstoneChestItems
Get all the items from a moonstone chest in order. Use this instead of repetitive calls to getMoonstoneChestItemSlot



Moonstone chests are a type of chest where a player accesses the same contents no matter the location of the moonstone chest

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |



### Returns:
`PNull<InvenItem>[]`

## getMoonstoneChestItemSlot
Get the item in a player's moonstone chest slot. Null if empty



Moonstone chests are a type of chest where a player accesses the same contents no matter the location of the moonstone chest

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| idx | `number` |  |



### Returns:
`PNull<InvenItem>`
