# API Reference, part 5 of 5

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

## setDefaultMobSetting
Set the default value for a mob setting.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobType | `TMobType` |  |
| setting | `TMobSetting` |  |
| value | `MobSettings<TMobType>[TMobSetting]` |  |

## setDirectionArrow
Show a directional arrow indicator on the player's screen pointing toward a world position.

When the position is off-screen the indicator is a rotating chevron at the screen edge.

When the position is on-screen it becomes a small marker dot.



The arrow persists until explicitly cleared via `clearDirectionArrow`.

Calling again with the same `id` updates the existing arrow in-place.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` | The player to show the arrow to |
| id | `string` | Unique identifier for this arrow (allows multiple concurrent arrows) |
| position | `number[]` | [x, y, z] world position the arrow should point toward |
| text | `PNull<string \| CustomTextStyling>` | Optional label rendered below the indicator. Supports CustomTextStyling for rich text with icons/colours. |
| showDistance | `boolean` | If true, displays the distance (in blocks) from the player to the arrow position. |
| style | `PNull<TextStyle>` | Optional style object (same format as CustomTextStyling's StyledText `style`). Controls chevron/marker colour, label typography, and opacity. |

## setEntityHeading


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

## setEntityRotation
Set the rotation for a server-auth entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |
| xRotation | `number` |  |
| yRotation | `number` |  |
| zRotation | `number` |  |

## setEveryoneSettingForPlayer
Set a player's other-entity setting for every player, mob and Person mesh in the game.

includeNewJoiners=true means that the player will have the setting applied to new joiners.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| settingName | `Setting` |  |
| settingValue | `OtherEntitySettings[Setting]` |  |
| includeNewJoiners | `boolean` |  |

## setHealth
Set the current health of an entity.

If you want to set their health to more than their current max health, the optional increaseMaxHealthIfNeeded must be true.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |
| newHealth | `PNull<number>` | Can be null to make the player not have health |
| whoDidDamage | ` LifeformId \| { lifeformId: LifeformId; withItem: string } ` | Optional |
| increaseMaxHealthIfNeeded | `boolean` | Optional |



### Returns:
`boolean`

## setItemAmount
Set the amount of an item in an item entity

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

## setItemSlot
Put an item in a specific index. Default hotbar is indexes 0-9

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemSlotIndex | `number` | 0-indexed |
| itemName | `ItemName` | Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared. |
| itemAmount | `PNull<number>` | -1 for infinity. Should not be set, or null, for items that are not stackable. |
| attributes | `ItemAttributes` | An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has. |
| tellClient | `boolean` | whether to tell client about it - results in desync between client and server if client doesnt locally perform the same action |

## setItemStat
Set a stat attribute for a block or item



NOTE: Only a subset of stats are customisable this way.

afterEatenItem requires an unstackable food.

minChargeStateToUse must be within the item's chargeStages and set on the base item, applying to all its charging variants.

fishingRodInfo adjusts existing rods; drops names the replacement mining drop.

Example: setItemStat(playerId, "Iron Dagger", "comboInfo", { comboWindowMs: 1000, comboMultipliers: [1, 1.5, 2] })

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| itemName | `ItemName` |  |
| stat | `K` |  |
| value | `AnyMetadataItem[K]` |  |

## setLifeformScale
Set the visual + physical scale of a lifeform. A scale of 1 is the default size,

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| lifeformId | `LifeformId` |  |
| scale | `number` | Must be a finite positive number. |

## setLobbyDbValue
Sets a database value that is saved per lobby. This persists between sessions.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| key | `string` |  |
| value | `string \| number` |  |

## setMaxPlayers
Update the max players and soft max players matchmaking will use



softMaxPlayers is the number of players that matchmaking will route to using "Quick Play".

Once the softMaxPlayers limit is reached, this lobby can only be joined by requesting the lobby name or joining a friend.



maxPlayers is the absolute maximum: a lobby will not have more players than this.

Tip: softMaxPlayers should be around 90% of maxPlayers



WARNING: This change is not immediate, as it takes a while for matchmaking to find out.

Also, this will not kick players out of the lobby if set to a lower value than the current player count.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| softMaxPlayers | `number` |  |
| maxPlayers | `number` |  |

## setMobAiState
Sets the current AI state for the given mob.

Some AI states will require context such as the ID of the lifeform being chased.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` |  |
| state | `TState` |  |
| params | `MobAiStateParams<TState>` |  |

## setMobSetting
Set the current value of a mob setting for a specific mob.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| mobId | `MobId` |  |
| setting | `TMobSetting` |  |
| value | `MobSettings<MobType>[TMobSetting]` |  |

## setMoonstoneChestItemSlot
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` | 0-indexed |
| itemName | `ItemName` | Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared. |
| itemAmount | `number` | -1 for infinity. Should not be set, or null, for items that are not stackable. |
| metadata | `ItemAttributes` | An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has. |

## setOtherEntitySetting
Set a player's other-entity setting for a specific entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| relevantPlayerId | `PlayerId` |  |
| targetedEntityId | `EntityId` |  |
| settingName | `Setting` |  |
| settingValue | `OtherEntitySettings[Setting]` |  |

## setOtherEntitySettings
Set many of a player's other-entity settings for a specific entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| relevantPlayerId | `PlayerId` |  |
| targetedEntityId | `EntityId` |  |
| settingsObject | `Partial<OtherEntitySettings>` |  |

## setOtherEntitySettingToDefault
Reset a player's other-entity setting for a specific entity to the game's default value.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| relevantPlayerId | `PlayerId` |  |
| targetedEntityId | `EntityId` |  |
| settingName | `Setting` |  |

## setPlayerDbValue
Sets a database value that is saved per player. For custom games this persists between sessions and

between lobbies, and is shared across all of the game's variations (e.g. a hub and its sub-modes).

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

## setPlayerGamemode
Set the gamemode of a player. This is persistent across lobbies for custom games.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` | The ID of the player to set the gamemode of. |
| gamemode | `WorldGamemode` | The gamemode to set the player to. |

## setPlayerOpacity
Set an entity's opacity

A simple helper that calls setTargetedPlayerSettingForEveryone

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

## setPlayerOpacityForOnePlayer
Set the opacity of an entity for one player

A simple helper that calls setOtherEntitySetting

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerIdWhoViewsOpacityPlayer | `PlayerId` | The player who sees that with opacity |
| playerIdOfOpacityPlayer | `EntityId` | The entity whose opacity is changed |
| opacity | `number` |  |

## setPlayerPhysicsState
Set physics state of player (vehicle type and tier).



For types that have tiers (e.g. BOAT, GLIDER, CAR), a `tier` of `null` defaults to the first

tier (0). Types without tiers (e.g. DEFAULT) must be given a `null` tier.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| physicsState | `PlayerPhysicsState<PhysicsType>` |  |
| positionOffset | `[number, number, number]` | Optional offset to adjust the player's collision box |

## setPlayerPose
Set the pose of the player

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| pose | `PlayerPose` |  |
| poseOffset | `[number, number, number]` |  |

## setPlayerVehicle
Seat a player in a vehicle. Seat 0 drives; other seats follow the vehicle without movement control.

The player leaves their current vehicle and replaces anyone occupying the requested seat.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| vehicleEId | `EntityId` | A spawned vehicle or a rideable mob. |
| seatIndex | `number` | Seat index (default 0). |

## setPosition
Set position of a player / entity.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| entityId | `EntityId` |  |
| x | `number \| number[]` | Can also be an array, in which case y and z shouldn't be passed |
| y | `number` |  |
| z | `number` |  |

## setSelectedInventorySlotI
Force the player to have the ith inventory slot selected. E.g. newI 0 makes the player have the 0th inventory slot selected

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| newI | `number` | integer from 0-9 |

## setShieldAmount
Set the current shield of a lifeform.

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

## setStandardChestItemSlot


### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| chestPos | `number[]` |  |
| idx | `number` | 0-indexed |
| itemName | `ItemName` | Can be 'Air', in which case itemAmount will be ignored and the slot will be cleared. |
| itemAmount | `number` | -1 for infinity. Should not be set, or null, for items that are not stackable. |
| playerId | `PlayerId` | The player who is interacting with the chest. |
| attributes | `ItemAttributes` | An optional object for certain types of item. For guns this can contain the shotsLeft field which is the amount of ammo the gun currently has. |

## setTargetedPlayerSettingForEveryone
Set every player's other-entity setting to a specific value for a particular entity.

includeNewJoiners=true means that new players joining the game will also have this other player setting applied.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| targetedPlayerId | `EntityId` |  |
| settingName | `Setting` |  |
| settingValue | `OtherEntitySettings[Setting]` |  |
| includeNewJoiners | `boolean` |  |

## setTotalAura
Sets the total aura for a player. Will not go over max level or under 0

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

## setVehicleSetting
Override a physics setting for a specific vehicle entity, replacing the type/tier default for that

vehicle's rider. The override is stored on the shared Bloxd and, when the vehicle currently has a

rider, replicated to that rider's client. Mirrors `setMobSetting`.



A setting can also be overridden for one block by naming the block first, e.g.

`setVehicleSetting(boatId, "IceCanAutoStep", true)`. That is stored as an entry of the matching

`<setting>ByBlock` record, which the physics tick reads as a precomputed block lookup.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| vehicleEId | `EntityId` |  |
| setting | `TSetting` |  |
| value | `SettableVehicleSettingValue<TSetting>` |  |

## setVelocity
Set the velocity of an entity

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

## setWalkThroughRect
Allow a player to walk through (or not walk through) voxels that are located within a given rectangle.

For blocks that are normally solid and not seethrough, the player will experience slight visual glitches while inside the block.



You could set both pos1 and pos2 to [0, 0, 0] to make only 0, 0, 0 walkthrough, for example.



A player standing inside a voxel that turns solid for them is lifted onto it if there is room above, including onto a CANT_WALK_THROUGH rect.

To let them stay where they are, remove the block before removing its exemption.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| pos1 | `number[]` | The one corner of the cuboid. Format [x, y, z] |
| pos2 | `number[]` | The top right corner of the cuboid. Format [x, y, z] |
| updateType | `WalkThroughType` | The type of update. Whether to make a rect solid, or able to be walked through. Pass DEFAULT_WALK_THROUGH with a previously passed rect to disable any walkthrough setting for that rect. |

## setWalkThroughType
Allow a player to walk through a type of block. For blocks that are normally solid and not seethrough, the player will experience slight visual glitches while inside the block.



A player standing inside a block that turns solid for them is lifted onto it if there is room above. To let them stay where they are, remove the block before making its type solid again.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| blockName | `BlockName` |  |
| disable | `boolean` | If you've enabled a player to walk through a block and want to make the block solid for them again, pass this with true. Otherwise you only need to pass playerId and blockName |

## shakePlayerCamera
Shake a player's camera.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` |  |
| intensity | `number` | Shake "power" (0..1); the client clamps the accumulated power to 1. |
| durationMs | `number` | How long the shake lasts, in milliseconds. |

## showShopTutorial
Show the shop tutorial for a player. Will not be shown if they have ever seen the shop tutorial in your game before.

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

## updateAudioEntity
Update an audio entity's config (sound, volume, falloff, rate). Only the provided fields

change.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |
| opts | `Partial<AudioEntityOpts>` | Any subset of soundName, volume, refDistance, maxHearDist, rate. |

## updateEntityNodeMeshAttachment
Attach/detach mesh instances to/from an entity

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |
| node | `EntityNamedNode` | node to attach to |
| type | `PNull<MeshType>` | if null, detaches mesh from this node |
| opts | `MeshEntityOpts[MeshType]` |  |
| offset | `[number, number, number]` |  |
| rotation | `[number, number, number]` |  |

## updateMeshEntity
Update a mesh entity. If used on a non-mesh entity, will do nothing.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| eId | `EntityId` |  |
| type | `MeshType` |  |
| opts | `MeshEntityOpts[MeshType]` |  |

## updateMeshParticleSystems
Updates the particle systems of multiple mesh entities at specified nodes

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| updates | `MeshParticleSystemUpdates` |  |

## updateShopItem
Update selected properties of an existing shop item.

For example, { canBuy: true } to allow players to purchase the item.

Throws an error if the item does not exist.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| categoryKey | `ShopCategoryKey` | The key of the category containing the item |
| itemKey | `ShopItemKey` | The unique key for the item |
| changes | `Partial<ShopItem>` | Partial shop item properties to update |

## updateShopItemForPlayer
Update selected properties of an existing shop item for a specific player.

For example, { canBuy: true } to allow this player to purchase the item.

Throws an error if the item does not exist.

### Parameters:
| Parameter | Type | Description |
|-----------|------|-------------|
| playerId | `PlayerId` | The player to update the item for |
| categoryKey | `ShopCategoryKey` | The key of the category containing the item |
| itemKey | `ShopItemKey` | The unique key for the item |
| changes | `Partial<ShopItem>` | Partial shop item properties to update |
