Skip to content

Commit

Permalink
Add Item Examples (#182)
Browse files Browse the repository at this point in the history
Add Examples to Item Components from MS-Learn Website
  • Loading branch information
DrinkWater623 authored Aug 17, 2023
1 parent 2abff27 commit d3a8c7a
Show file tree
Hide file tree
Showing 16 changed files with 112 additions and 34 deletions.
8 changes: 7 additions & 1 deletion source/behavior/items/format/components/armor.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,11 @@
"title": "Texture Type",
"enum": ["gold", "none", "leather", "chain", "iron", "diamond", "elytra", "turtle", "netherite"]
}
}
},
"examples": [
{
"protection": 5,
"texture_type" : "diamond"
}
]
}
8 changes: 7 additions & 1 deletion source/behavior/items/format/components/cooldown.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,11 @@
"title": "Duration",
"type": "number"
}
}
},
"examples": [
{
"category" : "attack",
"duration" : 0.2
}
]
}
5 changes: 4 additions & 1 deletion source/behavior/items/format/components/display_name.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"type": "object",
"additionalProperties": false,
"required": ["value"],
"properties": { "value": { "type": "string", "title": "Value", "description": "Set the display name for an item." } }
"properties": { "value": { "type": "string", "title": "Value", "description": "Set the display name for an item." } },
"examples": [
{ "value": "secret_weapon"}
]
}
10 changes: 8 additions & 2 deletions source/behavior/items/format/components/durability.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@
"max_durability": {
"title": "Maximum Durability",
"description": "Maximum durability is the amount of damage that this item can take before breaking.",
"type": "number"
"type": "integer"
}
}
},
"examples": [
{
"damage_chance": {"min":10,"max":50},
"max_durability": 36
}
]
}
5 changes: 4 additions & 1 deletion source/behavior/items/format/components/fuel.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,8 @@
"type": "object",
"additionalProperties": false,
"required": ["duration"],
"properties": { "duration": { "type": "number", "title": "Duration", "description": "How long in seconds will this fuel cook items for." } }
"properties": { "duration": { "type": "number", "title": "Duration", "description": "How long in seconds will this fuel cook items for." } },
"examples": [
{"duration": 3.0}
]
}
2 changes: 1 addition & 1 deletion source/behavior/items/format/components/hand_equipped.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"$id": "blockception.minecraft.behavior.items.minecraft:hand_equiped",
"$id": "blockception.minecraft.behavior.items.minecraft:hand_equipped",
"additionalProperties": false,
"required": ["texture"],
"type": "boolean",
Expand Down
5 changes: 4 additions & 1 deletion source/behavior/items/format/components/icon.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,8 @@
"title": "Texture",
"description": "The key from the resource_pack/textures/item_texture.json `texture_data` object associated with the texture file Example: blaze_powder."
}
}
},
"examples": [
{"texture": "stick"}
]
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,11 @@
"protection": {
"title": "Protection",
"description": "Amount of knockback resistance provided with the total maximum protection being 1.0",
"type": "number"
"type": "number",
"maximum": 1.0
}
}
},
"examples": [
{ "protection": 0.5}
]
}
11 changes: 8 additions & 3 deletions source/behavior/items/format/components/on_use.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,14 @@
"type": "object",
"additionalProperties": false,
"properties": {
"event": { "type": "string", "title": "Event", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" },
"target": { "type": "string", "title": "Target", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "enum": ["self"] }
"event": { "type": "string", "title": "Event", "description": "Event trigger for when the item is used."},
"target": { "type": "string", "title": "Target", "description": "Event Target.", "enum": ["self"] }
}
}
}
},
"examples": [
{
"on_use": "minecraft:entity_transformed"
}
]
}
15 changes: 10 additions & 5 deletions source/behavior/items/format/components/on_use_on.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,20 @@
"additionalProperties": false,
"required": ["on_use_on"],
"properties": {
"on_use": {
"title": "On Use",
"on_use_on": {
"title": "On Use On",
"description": "Event trigger for when the item is used.",
"type": "object",
"additionalProperties": false,
"properties": {
"event": { "type": "string", "title": "Event", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" },
"target": { "type": "string", "title": "Target", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "enum": ["block"] }
"event": { "type": "string", "title": "Event", "description": "Event trigger for when the item is used." },
"target": { "type": "string", "title": "Target", "description": "Event target (block).", "$comment": "UNDOCUMENTED", "enum": ["block"] }
}
}
}
},
"Examples": [
{
"on_use_on": "minecraft:entity_primed"
}
]
}
10 changes: 8 additions & 2 deletions source/behavior/items/format/components/projectile.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$id": "blockception.minecraft.behavior.items.minecraft:projectile",
"title": "Projectile",
"description": "Projectile item component. projectile items shoot out, like an arrow.",
"description": "Compels the item shoot, like an arrow. Pair with minecraft:shooter for dispensers or as ammunition. Pair with minecraft:throwable to set the entity spawned.",
"type": "object",
"additionalProperties": false,
"required": ["projectile_entity"],
Expand All @@ -12,5 +12,11 @@
"description": "How long you must charge a projectile for it to critically hit."
},
"projectile_entity": { "title": "Projectile Entity", "description": "The entity to be fired as a projectile.", "type": "string" }
}
},
"examples": [
{
"minimum_critical_power": 1.25,
"projectile_entity": "arrow"
}
]
}
10 changes: 8 additions & 2 deletions source/behavior/items/format/components/render_offsets.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$id": "blockception.minecraft.behavior.items.minecraft:render_offsets",
"title": "Render Offsets",
"description": "Render offsets component: optional values can be given to offset the way the item is rendered.",
"description": "Render offsets component: optional values can be given to offset the way the item is rendered. Depreciated in json formats 1.20.10 and higher",
"type": "object",
"additionalProperties": false,
"definitions": {
Expand Down Expand Up @@ -64,5 +64,11 @@
"properties": {
"main_hand": { "title": "Main Hand", "description": "Right hand transform data.", "type": "string" },
"off_hand": { "title": "Off Hand", "description": "Left hand transform data.", "type": "string" }
}
},
"examples": [
{
"main_hand": [0,0,0],
"off_hand":[0,0.5,0]
}
]
}
24 changes: 16 additions & 8 deletions source/behavior/items/format/components/shooter.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,27 @@
}
},
"charge_on_draw": { "title": "Charge On Draw", "description": "Charge on draw? Default is set to false.", "default": false, "type": "boolean" },
"launch_power_scale": {
"title": "Launch Power Scale",
"description": "Launch power scale. Default is set to 1.0.",
"default": 1.0,
"type": "number"
},
"max_draw_duration": { "title": "Maximum Draw Duration", "description": "Draw Duration. Default is set to 0.", "default": 0, "type": "number" },
"max_launch_power": { "title": "Maximum Launch Power", "description": "Launch power. Default is set to 1.0.", "default": 0, "type": "number" },
"scale_power_by_draw_duration": {
"title": "Scale Power By Draw Duration",
"description": "Scale power by draw duration? Default is set to false.",
"default": false,
"type": "boolean"
}
}
},
"examples": [
{
"ammunition" :[
{
"item" :"custom_projectile",
"use_offhand" :true,
"search_inventory" :true,
"use_in_creative" :true
}
],
"max_draw_duration" :1.0,
"scale_power_by_draw_duration" :true,
"charge_on_draw" :false
}
]
}
12 changes: 11 additions & 1 deletion source/behavior/items/format/components/throwable.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,15 @@
"default": false,
"type": "boolean"
}
}
},
"examples": [
{
"do_swing_animation" : false,
"min_draw_duration" : 0.0,
"max_draw_duration" : 1.0,
"launch_power_scale" : 1.0,
"max_launch_power" : 2.0,
"scale_power_by_draw_duration" : false
}
]
}
9 changes: 8 additions & 1 deletion source/behavior/items/format/components/weapon.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,12 @@
"event": { "type": "string", "title": "Event", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED" },
"target": { "type": "string", "title": "Target", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "enum": ["self"] }
}
}
},
"examples": [
{
"on_hit_block" : "my_event:block_hit",
"on_hurt_entity" : "my_event:ouch",
"on_not_hurt_entity" : "my_event:panic"
}
]
}
4 changes: 2 additions & 2 deletions source/behavior/items/format/components/wearable.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"type": "object",
"additionalProperties": false,
"properties": {
"dispensable": { "title": "Dispensable", "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "type": "boolean" },
"dispensable": { "title": "Dispensable", "description": "Sets if the item can be dropped by a dispenser block", "type": "boolean" },
"slot": {
"title": "Slot",
"description": "equipment_slot: slot.weapon.mainhand, slot.weapon.offhand, slot.armor.head, slot.armor.chest, slot.armor.legs, slot.armor.feet, slot.hotbar, slot.inventory, slot.enderchest, slot.saddle, slot.armor, slot.chest",
"description": "Which equipment slot the item can fit in",
"type": "string",
"enum": [
"slot.weapon.mainhand",
Expand Down

0 comments on commit d3a8c7a

Please sign in to comment.