From 98fc2bb2c3168c298f1d57753596519b42d29b00 Mon Sep 17 00:00:00 2001 From: DaanV2 Date: Sat, 17 Feb 2024 12:32:54 +0100 Subject: [PATCH] Applying some schemas fixes --- .../entities/format/behaviors/croak.json | 2 +- .../format/behaviors/melee_box_attack.json | 5 ++ .../format/components/entity_sensor.json | 34 ++++---- .../format/components/equip_item.json | 1 - .../format/components/projectile.json | 14 +++- .../entities/format/types/entity_types.json | 2 +- .../entities/format/types/trigger.json | 19 ++++- .../recipes/types/base types/unlock.json | 77 ++++++++++++------- source/general/sound_event.json | 3 + source/general/vectors/number2OrValue.json | 14 ++++ 10 files changed, 119 insertions(+), 52 deletions(-) create mode 100644 source/general/vectors/number2OrValue.json diff --git a/source/behavior/entities/format/behaviors/croak.json b/source/behavior/entities/format/behaviors/croak.json index 98405a73..effd0881 100644 --- a/source/behavior/entities/format/behaviors/croak.json +++ b/source/behavior/entities/format/behaviors/croak.json @@ -10,7 +10,7 @@ "duration": { "title": "Duration", "description": "Random range in seconds after which the croaking stops. Can also be a constant.", - "$ref": "../../../../general/vectors/integer2OrValue.json" + "$ref": "../../../../general/vectors/number2OrValue.json" }, "filters": { "title": "Filters", diff --git a/source/behavior/entities/format/behaviors/melee_box_attack.json b/source/behavior/entities/format/behaviors/melee_box_attack.json index 8fbe7635..a1df71aa 100644 --- a/source/behavior/entities/format/behaviors/melee_box_attack.json +++ b/source/behavior/entities/format/behaviors/melee_box_attack.json @@ -76,6 +76,11 @@ "$ref": "../types/trigger.json", "description": "Defines the event to trigger when this entity successfully attacks." }, + "on_kill": { + "title": "On Kill", + "$ref": "../types/trigger.json", + "description": "[UNDOCUMENTED] Defines the event to trigger when this entity successfully kills a target." + }, "outer_boundary_time_increase": { "title": "Outer Boundary Time Increase", "type": "number", diff --git a/source/behavior/entities/format/components/entity_sensor.json b/source/behavior/entities/format/components/entity_sensor.json index 844ff2b0..9d8c8e73 100644 --- a/source/behavior/entities/format/components/entity_sensor.json +++ b/source/behavior/entities/format/components/entity_sensor.json @@ -6,6 +6,20 @@ "title": "Entity Sensor", "additionalProperties": false, "properties": { + "cooldown": { + "title": "Cooldown", + "description": "How many seconds should elapse before the subsensor can once again sense for entities. The cooldown is applied on top of the base 1 tick (0.05 seconds) delay. Negative values will result in no cooldown being used.", + "type": "number", + "default": -1 + }, + "event_filters": { + "$ref": "../../filters/filters.json" + }, + "event": { + "title": "Event", + "description": "event.", + "type": "string" + }, "maximum_count": { "type": "integer", "default": -1, @@ -18,6 +32,12 @@ "description": "The minimum number of entities that must pass the filter conditions for the event to send.", "title": "Minimum Count" }, + "range": { + "type": "number", + "default": 10, + "description": "[UNDOCUMENTED] The maximum distance another entity can be from this and have the filters checked against it.", + "title": "Range" + }, "require_all": { "type": "boolean", "default": false, @@ -29,20 +49,6 @@ "default": 10, "description": "The maximum distance another entity can be from this and have the filters checked against it.", "title": "Sensor Range" - }, - "event_filters": { - "$ref": "../../filters/filters.json" - }, - "event": { - "title": "Event", - "description": "event.", - "type": "string" - }, - "cooldown": { - "title": "Cooldown", - "description": "How many seconds should elapse before the subsensor can once again sense for entities. The cooldown is applied on top of the base 1 tick (0.05 seconds) delay. Negative values will result in no cooldown being used.", - "type": "number", - "default": -1 } }, "examples": [ diff --git a/source/behavior/entities/format/components/equip_item.json b/source/behavior/entities/format/components/equip_item.json index 899c67e2..ac89ab85 100644 --- a/source/behavior/entities/format/components/equip_item.json +++ b/source/behavior/entities/format/components/equip_item.json @@ -10,7 +10,6 @@ "type": "array", "description": "List of items that the entity should not equip.", "items": { - "type": "string", "$ref": "../../../../general/item/descriptor.json", "description": "Item that the entity should not equip.", "title": "Excluded Items" diff --git a/source/behavior/entities/format/components/projectile.json b/source/behavior/entities/format/components/projectile.json index 50b06325..68638399 100644 --- a/source/behavior/entities/format/components/projectile.json +++ b/source/behavior/entities/format/components/projectile.json @@ -297,9 +297,17 @@ }, "damage": { "title": "Damage", - "type": "number", - "default": 1, - "description": "The damage dealt on impact." + "description": "The damage dealt on impact.", + "oneOf": [ + { "type": "number", "default": 1 }, + { + "type": "array", + "items": [ + { "type": "number", "title": "Min" }, + { "type": "number", "title": "Max" } + ] + } + ] }, "destroy_on_hit": { "title": "Destroy On Hit", diff --git a/source/behavior/entities/format/types/entity_types.json b/source/behavior/entities/format/types/entity_types.json index 24dc35fc..f514d34c 100644 --- a/source/behavior/entities/format/types/entity_types.json +++ b/source/behavior/entities/format/types/entity_types.json @@ -37,7 +37,7 @@ "title": "Priority" }, "check_if_outnumbered": { - "type": "number", + "type": "boolean", "description": "UNDOCUMENTED.", "title": "Check If Outnumbered" }, diff --git a/source/behavior/entities/format/types/trigger.json b/source/behavior/entities/format/types/trigger.json index f254229b..73ae8673 100644 --- a/source/behavior/entities/format/types/trigger.json +++ b/source/behavior/entities/format/types/trigger.json @@ -20,10 +20,10 @@ "body": { "event": "$1", "target": "self", "filters": [{ "test": "$2", "value": "$3" }] } } ], - "oneOf": [ - { "type": "string" }, - { + "definitions": { + "trigger": { "type": "object", + "title": "Trigger", "additionalProperties": false, "properties": { "event": { "type": "string", "description": "The event to run when the conditions for this trigger are met.", "title": "Event" }, @@ -34,5 +34,18 @@ "target": { "$ref": "../../filters/filters/types/subject.json", "description": "The target of the event.", "title": "Target" } } } + }, + "oneOf": [ + { "type": "string" }, + { + "type": "object", + "$ref": "#/definitions/trigger" + }, + { + "type": "array", + "items": { + "$ref": "#/definitions/trigger" + } + } ] } diff --git a/source/behavior/recipes/types/base types/unlock.json b/source/behavior/recipes/types/base types/unlock.json index 2813fd7d..eff07084 100644 --- a/source/behavior/recipes/types/base types/unlock.json +++ b/source/behavior/recipes/types/base types/unlock.json @@ -4,39 +4,58 @@ "description": "Unlock achievement", "type": "object", "required": ["context"], + "definitions": { + "item": { + "oneOf": [ + { + "required": ["context"], + "properties": { + "context": { + "type": "string", + "title": "Context", + "description": "The context of the achievement to unlock" + } + } + }, + { + "required": ["item"], + "properties": { + "item": { + "type": "string", + "title": "Item", + "examples": ["minecraft:stick"], + "description": "The item to unlock" + }, + "data": { + "type": "integer", + "title": "Data", + "description": "The data of the item to unlock" + } + } + }, + { + "required": ["tag"], + "properties": { + "tag": { + "type": "string", + "title": "Item Tag", + "description": "The item to unlock", + "examples": ["minecraft:planks", "minecraft:wooden_slabs"] + } + } + } + ] + } + }, "oneOf": [ { - "properties": { - "context": { - "type": "string", - "title": "Context", - "description": "The context of the achievement to unlock" - } - } + "type": "object", + "$ref": "#/definitions/item" }, { - "properties": { - "item": { - "type": "string", - "title": "Item", - "examples": ["minecraft:stick"], - "description": "The item to unlock" - }, - "data": { - "type": "integer", - "title": "Data", - "description": "The data of the item to unlock" - } - } - }, - { - "properties": { - "tag": { - "type": "string", - "title": "Item Tag", - "description": "The item to unlock", - "examples": ["minecraft:planks", "minecraft:wooden_slabs"] - } + "type": "array", + "items": { + "$ref": "#/definitions/item" } } ] diff --git a/source/general/sound_event.json b/source/general/sound_event.json index 7494bba5..b4b75d89 100644 --- a/source/general/sound_event.json +++ b/source/general/sound_event.json @@ -5,6 +5,7 @@ "description": "UNDOCUMENTED.", "$comment": "UNDOCUMENTED", "enum": [ + "", "add.chest", "admire", "agitated", @@ -293,8 +294,10 @@ "milk.screamer", "milk", "mob.armor_stand.place", + "mob.hoglin.converted_to_zombified", "mob.husk.convert_to_drowned", "mob.husk.convert_to_frog", + "mob.pig.death", "mob.husk.convert_to_stray", "mob.husk.convert_to_zombie", "mob.player.hurt_drown", diff --git a/source/general/vectors/number2OrValue.json b/source/general/vectors/number2OrValue.json new file mode 100644 index 00000000..a3e7782d --- /dev/null +++ b/source/general/vectors/number2OrValue.json @@ -0,0 +1,14 @@ +{ + "oneOf": [ + { + "type": "array", + "$ref": "./number2.json" + }, + { + "title": "Value", + "type": "number" + } + ], + "examples": [0, [0, 10]], + "defaultSnippets": [{ "label": "New Array 2", "body": ["^$1", "^$2"] }] +}