# Rev - Schematic

## Description

<div align="left"><figure><img src="/files/qphAaLgTUUmIQaqbhAXT" alt=""><figcaption></figcaption></figure></div>

## Downloads

{% file src="/files/lY8l10QtEJrPhdzzrEqo" %}

## Solution

A quick google search revealed that `.schematic` files are in the `NBT` file format.&#x20;

<figure><img src="/files/AayBIRtD0irCoW2bdhsa" alt=""><figcaption><p>From Minecraft Wiki</p></figcaption></figure>

Open the file using `NBTExplorer`.

<figure><img src="/files/lMgptfqYP8q2Whgs39YK" alt=""><figcaption><p><code>NBTExplorer</code> GUI</p></figcaption></figure>

At the start I thought the `dispenser` will be one of the `TileEntities` so I tried to find it using the following python code:

```python
from nbt import nbt

nbtfile = nbt.NBTFile("Ricardo3s_60AP_100C_200SB.schematic",'rb')

for tileentities in nbtfile['TileEntities']:
	try:
		for item in tileentities['Items']:
			print(item)
	except:
		print(tileentities)
```

As it turns out, `TileEntities` only contain either `minecraft:tnt` item or a Minecraft `Comparator`.

<figure><img src="/files/oRaACThvLb8QCbvUU2pd" alt=""><figcaption><p>Python output</p></figcaption></figure>

I then proceeded to search up on Minecraft dispenser to find out what exactly it is since it is not in `TileEntities`.

<figure><img src="/files/b3rLlovJtQn0VK31FjSz" alt=""><figcaption><p>From Minecraft Wiki once again</p></figcaption></figure>

It seems like a `Dispenser` is a **block**. I then edited the python script to print out all the blocks.

```python
from nbt import nbt
nbtfile = nbt.NBTFile("Ricardo3s_60AP_100C_200SB.schematic",'rb')
print(nbtfile['Blocks'])
```

&#x20;The output is as follows:

<figure><img src="/files/2K4wa4LrAgWP0cFw2wiJ" alt=""><figcaption><p>Python output</p></figcaption></figure>

The output is an array of numbers which suggests that every block is stored as a unique number that determines which block type it is. Previously from the Minecraft wiki page, we can also see the number 23 under the dispenser's **Numeric ID**. Now we just need to count the number of dispensers with the following code:

```python
from nbt import nbt
nbtfile = nbt.NBTFile("Ricardo3s_60AP_100C_200SB.schematic",'rb')

# Count number of blocks with 23 as Numeric ID
print(len([i for i in nbtfile['Blocks'] if i == 23]))
```

Flag: `bucket{2238}`


---

# Agent Instructions: 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:

```
GET https://arne-ctf.gitbook.io/ctf/2023/bucketctf/rev-schematic.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
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.
