From d3a8c7a4a49ee1e3f1e99c145983a014b6e64c07 Mon Sep 17 00:00:00 2001 From: DW623 Date: Thu, 17 Aug 2023 11:04:39 -0700 Subject: [PATCH] Add Item Examples (#182) Add Examples to Item Components from MS-Learn Website --- .../items/format/components/armor.json | 8 ++++++- .../items/format/components/cooldown.json | 8 ++++++- .../items/format/components/display_name.json | 5 +++- .../items/format/components/durability.json | 10 ++++++-- .../items/format/components/fuel.json | 5 +++- .../format/components/hand_equipped.json | 2 +- .../items/format/components/icon.json | 5 +++- .../components/knockback_resistance.json | 8 +++++-- .../items/format/components/on_use.json | 11 ++++++--- .../items/format/components/on_use_on.json | 15 ++++++++---- .../items/format/components/projectile.json | 10 ++++++-- .../format/components/render_offsets.json | 10 ++++++-- .../items/format/components/shooter.json | 24 ++++++++++++------- .../items/format/components/throwable.json | 12 +++++++++- .../items/format/components/weapon.json | 9 ++++++- .../items/format/components/wearable.json | 4 ++-- 16 files changed, 112 insertions(+), 34 deletions(-) diff --git a/source/behavior/items/format/components/armor.json b/source/behavior/items/format/components/armor.json index 8538d149..c868f3bc 100644 --- a/source/behavior/items/format/components/armor.json +++ b/source/behavior/items/format/components/armor.json @@ -14,5 +14,11 @@ "title": "Texture Type", "enum": ["gold", "none", "leather", "chain", "iron", "diamond", "elytra", "turtle", "netherite"] } - } + }, + "examples": [ + { + "protection": 5, + "texture_type" : "diamond" + } + ] } diff --git a/source/behavior/items/format/components/cooldown.json b/source/behavior/items/format/components/cooldown.json index 6d5c766d..951ca689 100644 --- a/source/behavior/items/format/components/cooldown.json +++ b/source/behavior/items/format/components/cooldown.json @@ -12,5 +12,11 @@ "title": "Duration", "type": "number" } - } + }, + "examples": [ + { + "category" : "attack", + "duration" : 0.2 + } + ] } diff --git a/source/behavior/items/format/components/display_name.json b/source/behavior/items/format/components/display_name.json index d4b8b552..6f17fbde 100644 --- a/source/behavior/items/format/components/display_name.json +++ b/source/behavior/items/format/components/display_name.json @@ -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"} + ] } diff --git a/source/behavior/items/format/components/durability.json b/source/behavior/items/format/components/durability.json index 31e8e513..7265334e 100644 --- a/source/behavior/items/format/components/durability.json +++ b/source/behavior/items/format/components/durability.json @@ -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 + } + ] } diff --git a/source/behavior/items/format/components/fuel.json b/source/behavior/items/format/components/fuel.json index 259acaaf..938e73ef 100644 --- a/source/behavior/items/format/components/fuel.json +++ b/source/behavior/items/format/components/fuel.json @@ -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} + ] } diff --git a/source/behavior/items/format/components/hand_equipped.json b/source/behavior/items/format/components/hand_equipped.json index 1afcd3bc..b138c33c 100644 --- a/source/behavior/items/format/components/hand_equipped.json +++ b/source/behavior/items/format/components/hand_equipped.json @@ -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", diff --git a/source/behavior/items/format/components/icon.json b/source/behavior/items/format/components/icon.json index c5a99021..884186c7 100644 --- a/source/behavior/items/format/components/icon.json +++ b/source/behavior/items/format/components/icon.json @@ -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"} + ] } diff --git a/source/behavior/items/format/components/knockback_resistance.json b/source/behavior/items/format/components/knockback_resistance.json index de79f24f..e2040219 100644 --- a/source/behavior/items/format/components/knockback_resistance.json +++ b/source/behavior/items/format/components/knockback_resistance.json @@ -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} + ] } diff --git a/source/behavior/items/format/components/on_use.json b/source/behavior/items/format/components/on_use.json index 67ad14ca..b8fde025 100644 --- a/source/behavior/items/format/components/on_use.json +++ b/source/behavior/items/format/components/on_use.json @@ -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" + } + ] } diff --git a/source/behavior/items/format/components/on_use_on.json b/source/behavior/items/format/components/on_use_on.json index f3a1124a..75f789bb 100644 --- a/source/behavior/items/format/components/on_use_on.json +++ b/source/behavior/items/format/components/on_use_on.json @@ -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" + } + ] } diff --git a/source/behavior/items/format/components/projectile.json b/source/behavior/items/format/components/projectile.json index 14f9e990..0f97e460 100644 --- a/source/behavior/items/format/components/projectile.json +++ b/source/behavior/items/format/components/projectile.json @@ -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"], @@ -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" + } + ] } diff --git a/source/behavior/items/format/components/render_offsets.json b/source/behavior/items/format/components/render_offsets.json index 0334db39..3077c924 100644 --- a/source/behavior/items/format/components/render_offsets.json +++ b/source/behavior/items/format/components/render_offsets.json @@ -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": { @@ -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] + } + ] } diff --git a/source/behavior/items/format/components/shooter.json b/source/behavior/items/format/components/shooter.json index bf74c13a..a62df5c5 100644 --- a/source/behavior/items/format/components/shooter.json +++ b/source/behavior/items/format/components/shooter.json @@ -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 + } + ] } diff --git a/source/behavior/items/format/components/throwable.json b/source/behavior/items/format/components/throwable.json index 06e143be..7808645b 100644 --- a/source/behavior/items/format/components/throwable.json +++ b/source/behavior/items/format/components/throwable.json @@ -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 + } + ] } diff --git a/source/behavior/items/format/components/weapon.json b/source/behavior/items/format/components/weapon.json index b65ea671..15660e63 100644 --- a/source/behavior/items/format/components/weapon.json +++ b/source/behavior/items/format/components/weapon.json @@ -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" + } + ] } diff --git a/source/behavior/items/format/components/wearable.json b/source/behavior/items/format/components/wearable.json index a5a0f1bc..03175861 100644 --- a/source/behavior/items/format/components/wearable.json +++ b/source/behavior/items/format/components/wearable.json @@ -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",