> For the complete documentation index, see [llms.txt](https://docs.quickclient.cc/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.quickclient.cc/en/game/world.md).

# World and blocks

Reading blocks, searching an area, weather and time.

`world()` is used to read the blocks around the player, as well as the weather and time. If the world has not loaded yet, every block reads as air.

```java
Block under = world().block(player().x(), player().y() - 1, player().z());
if (under.is("obsidian")) chat("Standing on obsidian");
```

## A single block

| Method                  | Type      | Description                                                                     |
| ----------------------- | --------- | ------------------------------------------------------------------------------- |
| `block(x, y, z)`        | `Block`   | block data at integer coordinates                                               |
| `block(double x, y, z)` | `Block`   | by position; fractional coordinates round down, as in the game itself           |
| `block(point)`          | `Block`   | by point                                                                        |
| `air(x, y, z)`          | `boolean` | whether this cell is air; one world read with no allocations                    |
| `solid(x, y, z)`        | `boolean` | a solid block you can collide with                                              |
| `liquid(x, y, z)`       | `boolean` | water or lava                                                                   |
| `replaceable(x, y, z)`  | `boolean` | a block can be placed in this spot                                              |
| `is(x, y, z, id)`       | `boolean` | compare the id without creating a `Block`; the string is parsed once and cached |
| `height(x, z)`          | `int`     | the topmost non-empty block in the column                                       |
| `loaded(x, z)`          | `boolean` | whether the chunk is loaded                                                     |

`block(...)` creates an object every time and reads all of the block's properties at once. If you only need one property, use `air`, `solid`, `liquid`, `replaceable` or `is` instead. They are cheaper, especially in loops.

### Block

| Method                                          | Type      | Description                                         |
| ----------------------------------------------- | --------- | --------------------------------------------------- |
| `id()`, `key()`                                 | `String`  | `"minecraft:obsidian"` and `"obsidian"`             |
| `is(value)`                                     | `boolean` | compare the id, the `minecraft:` prefix is optional |
| `x()`, `y()`, `z()`                             | `int`     | coordinates                                         |
| `center()`                                      | `Point`   | center of the block                                 |
| `hardness()`                                    | `float`   | hardness; negative for unbreakable blocks           |
| `air()`, `solid()`, `liquid()`, `replaceable()` | `boolean` | the same properties as in the table above           |

## Scanning an area

To check a large number of blocks, such as a whole cube around the player, avoid calling `block()` in a triple loop. Use `scan` and `find` for that.

`scan` walks the chunk sections once and returns one property for every block in the cube. It does not create `BlockPos` objects or strings, and it skips empty sections and unloaded chunks. `find` works the same way, but looks for blocks with a given id.

```java
int radius = 8;
boolean[] solid = world().scan(px, py, pz, radius, World.SOLID);
if (World.at(solid, radius, 0, -1, 0)) chat("Solid block underfoot");

int[] chests = world().find(px, py, pz, 32, "chest");
for (int i = 0; i < chests.length; i += 3) {
    waypoints().add("chest", chests[i], chests[i + 1], chests[i + 2], 20 * 30);
}
```

**How it works**

* `scan` returns a flat array of flags. The flag for a specific block is easy to get with `World.at` and an offset from the center: `0, -1, 0` is the block right under the player.
* `find` returns coordinates in a row, three at a time, so the loop steps by 3. Each chest found gets a waypoint for 30 seconds.

| Method                                | Type        | Description                                                                        |
| ------------------------------------- | ----------- | ---------------------------------------------------------------------------------- |
| `scan(x, y, z, radius, query)`        | `boolean[]` | flags for the whole cube; `query` is `World.AIR`, `SOLID`, `LIQUID`, `REPLACEABLE` |
| `scan(x, y, z, radius, query, into)`  | `boolean[]` | the same, but into the array you pass; if the size fits, no new array is created   |
| `find(x, y, z, radius, id)`           | `int[]`     | `x, y, z` triples of found blocks, at most `FIND_DEFAULT` of them                  |
| `find(x, y, z, radius, id, limit)`    | `int[]`     | the same with a given limit                                                        |
| `World.side(radius)`                  | `int`       | cube side length, `radius * 2 + 1`                                                 |
| `World.volume(radius)`                | `int`       | length of the flags array                                                          |
| `World.index(radius, dx, dy, dz)`     | `int`       | array index for an offset from the center, `-1` outside the cube                   |
| `World.at(flags, radius, dx, dy, dz)` | `boolean`   | flag at an offset; always `false` outside the cube                                 |

Limits: `SCAN_RADIUS = 32`, `FIND_RADIUS = 64`, `FIND_LIMIT = 65536`, `FIND_DEFAULT = 4096`. A radius above the limit is clamped to the limit without a warning.

## Weather and time

| Method                      | Type      | Description                                                                  |
| --------------------------- | --------- | ---------------------------------------------------------------------------- |
| `loaded()`                  | `boolean` | whether the world is loaded                                                  |
| `dimension()`               | `String`  | the dimension, for example `"minecraft:overworld"`                           |
| `raining()`, `thundering()` | `boolean` | it is raining, there is a thunderstorm                                       |
| `dayTime()`                 | `long`    | time of day 0..24000; if the server shifts time, the value may be inaccurate |
| `time()`                    | `long`    | how many ticks have passed since the world was created                       |
| `bottom()`, `top()`         | `int`     | the world's lower and upper height limits                                    |

Rays from the eyes, that is, finding the block the player is looking at, are described on a separate page: [Rays and the crosshair](/en/game/raycast.md).


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.quickclient.cc/en/game/world.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
