summaryrefslogtreecommitdiffstats
path: root/Tools/BlockTypePaletteGenerator/Readme.md
blob: dc479d16f6e5ff27740358ce3e179cbfd60f6fa2 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
This generator crafts an intermediate index format to be read by cuberite

# Running

Run `lua ./Generator.lua`, pass `blocks.json` as first argument to the script
and the desired output location as 2nd argument.

Make sure to run the Generator from within its directory (`cd` into the path
where `Generator.lua` is.)

## Examples

```bash
SERVER=/path/to/server.jar
java -cp "$SERVER" net.minecraft.data.Main --reports &&
lua Generator.lua \
	generated/reports/blocks.json \
	../../Server/Protocol/1.13/ProtocolBlockTypePalette.json 
```

```bash
SERVER=/path/to/server.jar
java -cp "$SERVER" net.minecraft.data.Main --reports &&
lua Generator.lua - -\
	< generated/reports/blocks.json \
	> ../Server/Protocol/1.13/ProtocolBlockTypePalette.json
```

## Output format

The Format is a `JSON` document containing an object with at least two keys at
the top level: `Metadata` and `Palette`.

`Metadata` contains document metadata, namely a key `"ProtocolBlockType": 1`.

`Palette` contains an array of objects. Each of these objects has at least the
keys `id`, `name` and an optional `props` key that contains the individual
properties of the current state. These properties are a KV dict of pure strings.

The order of the array or object elements is not significant. `id` is unique.

```json
{
  "Metadata": {
    "ProtocolBlockType": 1
  },
  "Palette": [{
      "id": 0,
      "name": "minecraft:air"
    }, {
      "id": 1,
      "name": "minecraft:stone"
    }, {
      "id": 221,
      "name": "minecraft:dark_oak_leaves",
      "props": {
        "persistent": "false",
        "distance": "4"
      }
    }
  ]
}
```