Skip to content
This repository was archived by the owner on Aug 16, 2020. It is now read-only.

Commit 2992a15

Browse files
committed
🐛 Fix text component schema
1 parent 036ad9d commit 2992a15

File tree

4 files changed

+202
-33
lines changed

4 files changed

+202
-33
lines changed

.vscode/settings.json

+6
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,12 @@
5959
"playground/tags/items/*.json"
6060
],
6161
"url": "./src/tags/item.json"
62+
},
63+
{
64+
"fileMatch": [
65+
"playground/text_components/*.json"
66+
],
67+
"url": "./src/shared/text_component.json"
6268
}
6369
],
6470
"files.associations": {

README.md

+52
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,24 @@ There are two custom properties for `string` schema: `parser` and `params`, whic
1717

1818
# List of Parsers
1919

20+
## `Command` Parser
21+
22+
A parser used to validate commands.
23+
24+
### Parameters
25+
26+
- `leadingSlash`: (boolean | `null`) Whether the command should start with slash (`/`). The string won't be validated if the value doesn't start with slash and the parameter is set to `true`.
27+
28+
## `Entity` Parser
29+
30+
A parser used to validate entities.
31+
32+
### Parameters
33+
34+
- `amount`: (`single` | `multiple`) The acceptable amount of entities.
35+
- `type`: (`entities` | `players`) The type of the entities.
36+
- `isScoreHolder`: (boolean) Optional, defaults to `false`. Whether this entity is a score holder.
37+
2038
## `Identity` Parser
2139

2240
A parser used to validate namespaced IDs.
@@ -29,6 +47,7 @@ A parser used to validate namespaced IDs.
2947
- `$lootTables`: All available loot tables.
3048
- `$predicates`: All available predicates.
3149
- `$recipes`: All available recipes.
50+
- `$storages`: All available recipes.
3251
- `$tags/blocks`: All available block tags.
3352
- `$tags/entityTypes`: All available entity type tags.
3453
- `$tags/fluids`: All available fluid tags.
@@ -41,6 +60,39 @@ A parser used to validate namespaced IDs.
4160
- `allowTag`: (boolean) Optional, defaults to `false`. If set to `true`, an ID starting with `#` under the corresponding registry should be accepted.
4261
- `allowUnknownValue`: (boolean) Optional, defaults to `false`. If set to `true`, IDs that don't exist in neither `registry` nor `values` won't be reported as errors.
4362

63+
## `NbtPath` Parser
64+
65+
A parser used to validate NBT paths.
66+
67+
## `Nbt` Parser
68+
69+
A parser used to validate NBT tags.
70+
71+
### Parameters
72+
73+
- `type`: (`NbtNodeTypeName` | `NbtNodeTypeName[]`) The type of this NBT tag.
74+
- `category`: (`minecraft:block` | `minecraft:entity` | `minecraft:item`) The type of this NBT.
75+
- `id`: (string) Optional. An ID in the specific category.
76+
- `isPredicate`: (boolean) Optional, defaults to `false`. Whether this NBT is in a predicate or not.
77+
78+
## `Objective` Parser
79+
80+
A parser used to validate scoreboard objectives.
81+
82+
## `TranslateKey` Parser
83+
84+
A parser used to validate translation keys in resource packs.
85+
86+
## `Vector` Parser
87+
88+
A parser used to validate number vectors.
89+
90+
### Parameters
91+
92+
- `dimension`: (number) The dimension of the vector.
93+
- `allowLocal`: (boolean) Optional, defaults to `true`. Whether local coordinates are acceptable.
94+
- `allowRelative`: (boolean) Optional, defaults to `true`. Whether relative coordinates are acceptable.
95+
4496
# File Struture
4597

4698
- `src`: Stores all JSON Schemas.

playground/text_components/foo.json

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[
2+
{
3+
"text": "",
4+
"clickEvent": {
5+
"action": "run_command",
6+
"value": ""
7+
},
8+
"hoverEvent": {
9+
"action": "show_text",
10+
"value": {
11+
"text": "foo",
12+
"color": "aqua"
13+
}
14+
}
15+
}
16+
]

0 commit comments

Comments
 (0)