Skip to content

Commit 0ed8493

Browse files
authored
Support single values for item components (#268)
1 parent ffdf30a commit 0ed8493

File tree

12 files changed

+223
-98
lines changed

12 files changed

+223
-98
lines changed
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:allow_off_hand",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Allow Off Hand",
64
"description": "The allow off hand component determines whether the item can be placed in the off hand slot of the inventory.",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "Whether the item can be placed in the off hand slot" } },
9-
"examples": [
10-
{ "value": true }
5+
"default": false,
6+
"examples": [true, { "value": true }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"type": "object",
13+
"additionalProperties": false,
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "Whether the item can be placed in the off hand slot",
19+
"type": "boolean",
20+
"default": false
21+
}
22+
}
23+
}
1124
]
1225
}
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:can_destroy_in_creative",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Can Destroy In Creative",
64
"description": "The can destroy in creative component determines if the item will break blocks in creative when swinging.",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "Whether the item can destroy blocks while in creative" } },
9-
"examples": [
10-
{ "value": false }
5+
"default": true,
6+
"examples": [false, { "value": false }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"type": "object",
13+
"additionalProperties": false,
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "Whether the item can destroy blocks while in creative",
19+
"type": "boolean",
20+
"default": true
21+
}
22+
}
23+
}
1124
]
1225
}

source/behavior/items/format/components/display_name.json

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,10 @@
22
"$id": "blockception.minecraft.behavior.items.minecraft:display_name",
33
"title": "Display Name",
44
"description": "Display Name item component. Display Names display the name of an item.",
5+
"$comment": "Does not currently support single value parsing.",
56
"type": "object",
67
"additionalProperties": false,
78
"required": ["value"],
89
"properties": { "value": { "type": "string", "title": "Value", "description": "Set the display name for an item." } },
9-
"examples": [
10-
{ "value": "secret_weapon"}
11-
]
10+
"examples": [{ "value": "secret_weapon" }]
1211
}
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:foil",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Glint",
64
"description": "The glint component determines whether the item has the enchanted glint render effect on it",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "Whether the item has the glint effect." } },
9-
"examples": [
10-
{ "value": true }
5+
"default": false,
6+
"examples": [true, { "value": true }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"type": "object",
13+
"additionalProperties": false,
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "Whether the item has the glint effect.",
19+
"type": "boolean",
20+
"default": false
21+
}
22+
}
23+
}
1124
]
1225
}
Lines changed: 19 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:hand_equipped",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Hand Equipped",
64
"description": "This component determines if an item is rendered like a tool while in hand.",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "If the item is rendered like a tool while in hand." } },
9-
"examples": [
10-
{ "value": true }
5+
"default": false,
6+
"examples": [true, { "value": true }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"type": "object",
13+
"additionalProperties": false,
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "If the item is rendered like a tool while in hand.",
19+
"type": "boolean",
20+
"default": false
21+
}
22+
}
23+
}
1124
]
1225
}
Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,28 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:hover_text_color",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Hover Text Color",
64
"description": "The hover text color component determines the color of the item name when hovering over it.",
7-
"required": ["value"],
8-
"properties": {
9-
"value": {
10-
"description": "The color of the item's hover text.",
11-
"type": "string",
12-
"enum": ["black", "blue", "brown", "cyan", "gray", "green", "light_blue", "light_green", "magenta", "orange", "pink", "purple", "red", "silver", "white", "yellow"],
13-
"title": "Value"
5+
"examples": ["light_blue", { "value": "light_blue" }],
6+
"definitions": {
7+
"color": {
8+
"enum": ["black", "blue", "brown", "cyan", "gray", "green", "light_blue", "light_green", "magenta", "orange", "pink", "purple", "red", "silver", "white", "yellow"]
9+
}
10+
},
11+
"oneOf": [
12+
{
13+
"$ref": "#/definitions/color"
14+
},
15+
{
16+
"type": "object",
17+
"additionalProperties": false,
18+
"required": ["value"],
19+
"properties": {
20+
"value": {
21+
"title": "Value",
22+
"description": "The color of the item's hover text.",
23+
"$ref": "#/definitions/color"
24+
}
25+
}
1426
}
15-
},
16-
"examples": [
17-
{ "value": "light_blue" }
1827
]
1928
}

source/behavior/items/format/components/icon.json

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,26 +2,31 @@
22
"$id": "blockception.minecraft.behavior.items.minecraft:icon",
33
"title": "Icon",
44
"description": "The icon item componenent determines the icon to represent the item in the UI and elsewhere.",
5-
"type": "object",
6-
"additionalProperties": true,
7-
"required": ["textures"],
8-
"properties": {
9-
"textures": {
10-
"title": "Textures",
11-
"description": "Contains key-value pairs of textures used by the item",
12-
"type": "object",
5+
"examples": ["stick", { "textures": { "default": "stick" } }],
6+
"oneOf": [
7+
{
8+
"type": "string"
9+
},
10+
{
11+
"type": "object",
1312
"additionalProperties": true,
14-
"required": ["default"],
13+
"required": ["textures"],
1514
"properties": {
16-
"default": {
17-
"type": "string",
18-
"title": "Default Texture",
19-
"description": "The key from the resource_pack/textures/item_texture.json `texture_data` object associated with the texture file Example: blaze_powder."
15+
"textures": {
16+
"title": "Textures",
17+
"description": "Contains key-value pairs of textures used by the item",
18+
"type": "object",
19+
"additionalProperties": true,
20+
"required": ["default"],
21+
"properties": {
22+
"default": {
23+
"type": "string",
24+
"title": "Default Texture",
25+
"description": "The key from the resource_pack/textures/item_texture.json `texture_data` object associated with the texture file Example: blaze_powder."
26+
}
27+
}
2028
}
2129
}
2230
}
23-
},
24-
"examples": [
25-
{"textures": {"default": "stick"}}
2631
]
27-
}
32+
}
Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,25 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:liquid_clipped",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Liquid Clipped",
64
"description": "The liquid clipped component determines whether the item interacts with liquid blocks on use.",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "Whether the item interacts with liquid blocks on use." } },
9-
"examples": [
10-
{ "value": true }
5+
"default": false,
6+
"examples": [true, { "value": true }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"additionalProperties": false,
13+
"type": "object",
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "Whether the item interacts with liquid blocks on use.",
19+
"type": "boolean",
20+
"default": false
21+
}
22+
}
23+
}
1124
]
12-
}
25+
}
Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,29 @@
11
{
22
"$id": "blockception.minecraft.behavior.items.minecraft:max_stack_size",
3-
"additionalProperties": false,
4-
"type": "object",
53
"title": "Max Stack Size",
64
"description": "The max stack size component determines how many of the item can be stacked together.",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "number", "title": "Value", "description": "How many of the item that can be stacked.", "default": 64, "minimum": 1 } },
9-
"examples": [
10-
{ "value": 1 }
5+
"default": 64,
6+
"examples": [1, { "value": 1 }],
7+
"oneOf": [
8+
{
9+
"type": "number",
10+
"minimum": 1,
11+
"maximum": 64
12+
},
13+
{
14+
"type": "object",
15+
"additionalProperties": false,
16+
"required": ["value"],
17+
"properties": {
18+
"value": {
19+
"title": "Value",
20+
"description": "How many of the item that can be stacked.",
21+
"type": "number",
22+
"default": 64,
23+
"minimum": 1,
24+
"maximum": 64
25+
}
26+
}
27+
}
1128
]
1229
}

source/behavior/items/format/components/should_despawn.json

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,24 @@
22
"$id": "blockception.minecraft.behavior.items.minecraft:should_despawn",
33
"title": "Should Despawn",
44
"description": "Should despawn component determines if the item should eventually despawn while floating in the world",
5-
"additionalProperties": false,
6-
"type": "object",
7-
"required": ["value"],
8-
"properties": { "value": { "type": "boolean", "title": "Value", "description": "Whether the item should eventually despawn while floating in the world" } },
9-
"examples": [
10-
{ "value": false }
5+
"default": true,
6+
"examples": [false, { "value": false }],
7+
"oneOf": [
8+
{
9+
"type": "boolean"
10+
},
11+
{
12+
"type": "object",
13+
"additionalProperties": false,
14+
"required": ["value"],
15+
"properties": {
16+
"value": {
17+
"title": "Value",
18+
"description": "Whether the item should eventually despawn while floating in the world",
19+
"type": "boolean",
20+
"default": true
21+
}
22+
}
23+
}
1124
]
12-
}
25+
}

0 commit comments

Comments
 (0)