> For the complete documentation index, see [llms.txt](https://zarzel.gitbook.io/zarscript2/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://zarzel.gitbook.io/zarscript2/documentation/api-libs/world.md).

# world

World and entity related functions

### world.timer

```lua
world.timer(): number
```

Returns the multiplier of speed the game is running at.

### world.set\_timer

```lua
world.set_timer(timer_speed)
```

| Argument     | Type   | Description |
| ------------ | ------ | ----------- |
| timer\_speed | Number | Timer speed |

Sets the multiplier to make the speed faster or slower, 0.5 makes the game run at half-speed

### world.refresh\_chunks

```lua
world.refresh_chunks()
```

Refreshes the loaded chunks, just like F3+A does

### world.entities

```lua
world.entities(): table
```

Returns a table with all the loaded entities IDs

### world.block

```lua
world.block(x, y, z): string
```

| Argument | Type   | Description |
| -------- | ------ | ----------- |
| x        | Number | x position  |
| y        | Number | y position  |
| z        | Number | z position  |

Returns the name of the block in the specified cords

### world.name

```lua
world.name(entity_id): string
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the name of the specified entity

### world.display\_name

```lua
world.display_name(entity_id): string
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the display name of the specified entity, example: \[MVP++] Player

### world.held\_item

```lua
world.held_item(entity_id): string
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the name of the item the player is holding

### world.hurt\_time

```lua
world.hurt_time(entity_id): number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns how much ticks of hurt time the player has left

### world.health

```lua
world.health(entity_id): number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the player health, divide by two for getting heart amount

### world.max\_health

```lua
world.max_health(entity_id): number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the player max health, divide by two for getting heart amount

### world.sprinting

```lua
world.sprinting(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the player is sprinting

### world.facing

```lua
world.facing(entity_id): number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

This function will return a direction on a number

1: Down\
2: Up\
3: North\
4: South\
5: West\
6: East

### world.angles

```lua
world.angles(entity_id): number, number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the player's yaw and pitch

### world.bounding\_box

```lua
world.bounding_box(entity_id): number, number, number, number, number, number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns minX, minY, minZ, maxX, maxY, maxZ of the players BBOX

### world.ticks\_existed

```lua
world.ticks_existed(entity_id): number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the ticks the player has existed in the world

### world.is\_player

```lua
world.is_player(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is a player

### world.width\_height

```lua
world.width_height(entity_id): number, number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the entity width and height

### world.is\_sneaking

```lua
world.is_sneaking(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is sneaking

### world.is\_invisible

```lua
world.is_invisible(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is invisible

### world.burning

```lua
world.burning(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is burning

### world.is\_bot

```lua
world.is_bot(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is detected as a bot by the client

### world.is\_friend

```lua
world.is_friend(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is a friend in the client

### world.is\_enemy

```lua
world.is_enemy(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is an enemy in the client

### world.riding

```lua
world.riding(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns if the entity is riding anything

### world.position

```lua
world.position(entity_id): number, number, number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the player's x, y and z positions

### world.prev\_position

```lua
world.prev_position(entity_id): number, number, number
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Returns the previous player's x, y and z positions

### world.is\_potion\_active

```lua
world.is_potion_active(entity_id, potion_id): boolean
```

| Argument   | Type   | Description                         |
| ---------- | ------ | ----------------------------------- |
| entity\_id | Number | ID of the entity                    |
| potion\_id | Number | ID of the potion to check if active |

Returns if the player has the specified potion id active

### world.remove

```lua
world.remove(entity_id): boolean
```

| Argument   | Type   | Description      |
| ---------- | ------ | ---------------- |
| entity\_id | Number | ID of the entity |

Removes the entity from the world, will return true if successfully removed

### world.biome

```lua
world.biome(): string
```

Returns the current biome name

### world.inventory

```lua
world.inventory(): table
```

Returns the player's inventory in a table, table.helmet, table.chestplate, table.leggings, table.boots, table.hand
