From 282e46a296ab77e1b5d9ecda0f152e0fab6fd258 Mon Sep 17 00:00:00 2001 From: DaanV2 Date: Wed, 7 Dec 2022 11:09:57 +0100 Subject: [PATCH] Addeding property filters --- source/behavior/entities/filters/filters.json | 5 ++ .../filters/filters/bool_property.json | 38 +++++++++++++++ .../filters/filters/enum_property.json | 37 ++++++++++++++ .../filters/filters/float_property.json | 37 ++++++++++++++ .../filters/filters/has_property.json | 32 +++++++++++++ .../filters/filters/int_property.json | 37 ++++++++++++++ .../entities/format/behaviors/play.json | 48 +++++++++++++++++++ 7 files changed, 234 insertions(+) create mode 100644 source/behavior/entities/filters/filters/bool_property.json create mode 100644 source/behavior/entities/filters/filters/enum_property.json create mode 100644 source/behavior/entities/filters/filters/float_property.json create mode 100644 source/behavior/entities/filters/filters/has_property.json create mode 100644 source/behavior/entities/filters/filters/int_property.json diff --git a/source/behavior/entities/filters/filters.json b/source/behavior/entities/filters/filters.json index 281881b8..5c4bd906 100644 --- a/source/behavior/entities/filters/filters.json +++ b/source/behavior/entities/filters/filters.json @@ -80,8 +80,11 @@ } }, "allOf": [ + { "if": { "properties": { "test": { "const": "bool_property" } } }, "then": { "$ref": "./filters/bool_property.json" } }, { "if": { "properties": { "test": { "const": "clock_time" } } }, "then": { "$ref": "./filters/clock_time.json" } }, { "if": { "properties": { "test": { "const": "distance_to_nearest_player" } } }, "then": { "$ref": "./filters/distance_to_nearest_player.json" } }, + { "if": { "properties": { "test": { "const": "enum_property" } } }, "then": { "$ref": "./filters/enum_property.json" } }, + { "if": { "properties": { "test": { "const": "float_property" } } }, "then": { "$ref": "./filters/float_property.json" } }, { "if": { "properties": { "test": { "const": "has_ability" } } }, "then": { "$ref": "./filters/has_ability.json" } }, { "if": { "properties": { "test": { "const": "has_biome_tag" } } }, "then": { "$ref": "./filters/has_biome_tag.json" } }, { "if": { "properties": { "test": { "const": "has_component" } } }, "then": { "$ref": "./filters/has_component.json" } }, @@ -90,6 +93,7 @@ { "if": { "properties": { "test": { "const": "has_equipment" } } }, "then": { "$ref": "./filters/has_equipment.json" } }, { "if": { "properties": { "test": { "const": "has_mob_effect" } } }, "then": { "$ref": "./filters/has_mob_effect.json" } }, { "if": { "properties": { "test": { "const": "has_nametag" } } }, "then": { "$ref": "./filters/has_nametag.json" } }, + { "if": { "properties": { "test": { "const": "has_property" } } }, "then": { "$ref": "./filters/has_property.json" } }, { "if": { "properties": { "test": { "const": "has_ranged_weapon" } } }, "then": { "$ref": "./filters/has_ranged_weapon.json" } }, { "if": { "properties": { "test": { "const": "has_silk_touch" } } }, "then": { "$ref": "./filters/has_silk_touch.json" } }, { "if": { "properties": { "test": { "const": "has_tag" } } }, "then": { "$ref": "./filters/has_tag.json" } }, @@ -105,6 +109,7 @@ { "if": { "properties": { "test": { "const": "in_water_or_rain" } } }, "then": { "$ref": "./filters/in_water_or_rain.json" } }, { "if": { "properties": { "test": { "const": "in_water" } } }, "then": { "$ref": "./filters/in_water.json" } }, { "if": { "properties": { "test": { "const": "inactivity_timer" } } }, "then": { "$ref": "./filters/inactivity_timer.json" } }, + { "if": { "properties": { "test": { "const": "int_property" } } }, "then": { "$ref": "./filters/int_property.json" } }, { "if": { "properties": { "test": { "const": "is_altitude" } } }, "then": { "$ref": "./filters/is_altitude.json" } }, { "if": { "properties": { "test": { "const": "is_avoiding_mobs" } } }, "then": { "$ref": "./filters/is_avoiding_mobs.json" } }, { "if": { "properties": { "test": { "const": "is_biome" } } }, "then": { "$ref": "./filters/is_biome.json" } }, diff --git a/source/behavior/entities/filters/filters/bool_property.json b/source/behavior/entities/filters/filters/bool_property.json new file mode 100644 index 00000000..f85ce005 --- /dev/null +++ b/source/behavior/entities/filters/filters/bool_property.json @@ -0,0 +1,38 @@ +{ + "$id": "blockception.minecraft.behavior.entities.filters.bool_property", + "type": "object", + "title": "Bool Property", + "description": "Returns true when the bool actor property matches the value provided.", + "required": ["value", "domain"], + "examples": [{ "test": "bool_property", "value": true }], + "properties": { + "test": { + "type": "string", + "title": "Test Property", + "description": "Returns true when the bool actor property matches the value provided." + }, + "domain": { + "description": "(Required) The property name to look for", + "title": "Operator", + "type": "string" + }, + "operator": { + "$ref": "./types/operator.json", + "description": "(Optional) The comparison to apply with `value`.", + "default": "equals", + "title": "Operator" + }, + "subject": { + "$ref": "./types/subject.json", + "description": "(Optional) The subject of this filter test.", + "default": "self", + "title": "Subject" + }, + "value": { + "type": "boolean", + "default": true, + "title": "Value", + "description": "true or false." + } + } +} diff --git a/source/behavior/entities/filters/filters/enum_property.json b/source/behavior/entities/filters/filters/enum_property.json new file mode 100644 index 00000000..12e92047 --- /dev/null +++ b/source/behavior/entities/filters/filters/enum_property.json @@ -0,0 +1,37 @@ +{ + "$id": "blockception.minecraft.behavior.entities.filters.enum_property", + "type": "object", + "title": "Enum Property", + "description": "Returns true when the enum actor property matches the value provided.", + "required": ["value", "domain"], + "examples": [{ "test": "bool_property", "value": true }], + "properties": { + "test": { + "type": "string", + "title": "Test Property", + "description": "Returns true when the enum actor property matches the value provided." + }, + "domain": { + "description": "(Required) The property name to look for", + "title": "Operator", + "type": "string" + }, + "operator": { + "$ref": "./types/operator.json", + "description": "(Optional) The comparison to apply with `value`.", + "default": "equals", + "title": "Operator" + }, + "subject": { + "$ref": "./types/subject.json", + "description": "(Optional) The subject of this filter test.", + "default": "self", + "title": "Subject" + }, + "value": { + "type": "string", + "title": "Value", + "description": "(Required) A string value." + } + } +} diff --git a/source/behavior/entities/filters/filters/float_property.json b/source/behavior/entities/filters/filters/float_property.json new file mode 100644 index 00000000..f9b5b7e6 --- /dev/null +++ b/source/behavior/entities/filters/filters/float_property.json @@ -0,0 +1,37 @@ +{ + "$id": "blockception.minecraft.behavior.entities.filters.float_property", + "type": "object", + "title": "Float Property", + "description": "Returns true when the float actor property matches the value provided.", + "required": ["value", "domain"], + "examples": [{ "test": "bool_property", "value": true }], + "properties": { + "test": { + "type": "string", + "title": "Test Property", + "description": "Returns true when the float actor property matches the value provided." + }, + "domain": { + "description": "(Required) The property name to look for", + "title": "Operator", + "type": "string" + }, + "operator": { + "$ref": "./types/operator.json", + "description": "(Optional) The comparison to apply with `value`.", + "default": "equals", + "title": "Operator" + }, + "subject": { + "$ref": "./types/subject.json", + "description": "(Optional) The subject of this filter test.", + "default": "self", + "title": "Subject" + }, + "value": { + "type": "string", + "title": "Value", + "description": "(Required) A floating point value." + } + } +} diff --git a/source/behavior/entities/filters/filters/has_property.json b/source/behavior/entities/filters/filters/has_property.json new file mode 100644 index 00000000..108931f3 --- /dev/null +++ b/source/behavior/entities/filters/filters/has_property.json @@ -0,0 +1,32 @@ +{ + "$id": "blockception.minecraft.behavior.entities.filters.has_property", + "type": "object", + "title": "Has Property", + "description": "Tests for the presence of a property of the subject entity.", + "required": ["value", "domain"], + "examples": [{ "test": "bool_property", "value": true }], + "properties": { + "test": { + "type": "string", + "title": "Test Property", + "description": "Tests for the presence of a property of the subject entity." + }, + "operator": { + "$ref": "./types/operator.json", + "description": "(Optionall) The comparison to apply with `value`.", + "default": "equals", + "title": "Operator" + }, + "subject": { + "$ref": "./types/subject.json", + "description": "(Optional) The subject of this filter test.", + "default": "self", + "title": "Subject" + }, + "value": { + "title": "Value", + "type": "string", + "description": "(Required) The property name to look for." + } + } +} diff --git a/source/behavior/entities/filters/filters/int_property.json b/source/behavior/entities/filters/filters/int_property.json new file mode 100644 index 00000000..023cfffe --- /dev/null +++ b/source/behavior/entities/filters/filters/int_property.json @@ -0,0 +1,37 @@ +{ + "$id": "blockception.minecraft.behavior.entities.filters.int_property", + "type": "object", + "title": "Int Property", + "description": "Returns true when the int actor property matches the value provided.", + "required": ["value", "domain"], + "examples": [{ "test": "bool_property", "value": true }], + "properties": { + "test": { + "type": "string", + "title": "Test Property", + "description": "Returns true when the int actor property matches the value provided." + }, + "domain": { + "description": "(Required) The property name to look for", + "title": "Operator", + "type": "string" + }, + "operator": { + "$ref": "./types/operator.json", + "description": "(Optional) The comparison to apply with `value`.", + "default": "equals", + "title": "Operator" + }, + "subject": { + "$ref": "./types/subject.json", + "description": "(Optional) The subject of this filter test.", + "default": "self", + "title": "Subject" + }, + "value": { + "type": "string", + "title": "Value", + "description": "(Required) A floating point value." + } + } +} diff --git a/source/behavior/entities/format/behaviors/play.json b/source/behavior/entities/format/behaviors/play.json index 61c65ff4..ba8e24e5 100644 --- a/source/behavior/entities/format/behaviors/play.json +++ b/source/behavior/entities/format/behaviors/play.json @@ -11,6 +11,54 @@ }, "speed_multiplier": { "$ref": "types/speed_multiplier.json" + }, + "chance_to_start": { + "title": "Chance To Start", + "type": "number", + "default": 0.0, + "description": "Percent chance that the mob will start this goal, from 0 to 1." + }, + "follow_distance": { + "title": "Follow Distance", + "type": "integer", + "default": 2, + "description": "The distance (in blocks) that the mob tries to be in range of the friend it's following." + }, + "friend_search_area": { + "title": "Friend Search Area", + "default": [6, 3, 6], + "$ref": "../../../../general/vectors/number3.json", + "description": "The dimensions of the AABB used to search for a potential friend to play with." + }, + "friend_types": { + "title": "Friend Types", + "type": "array", + "description": "The entity type(s) to consider when searching for a potential friend to play with.", + "items": { + "filters": { + "title": "Filters", + "description": "UNDOCUMENTATED", + "$ref": "../../filters/filters.jon" + } + } + }, + "max_play_duration_seconds": { + "title": "Max Play Duration Seconds", + "type": "number", + "default": 50.0, + "description": "The max amount of seconds that the mob will play for before exiting the Goal." + }, + "random_pos_search_height": { + "title": "Random Pos Search Height", + "type": "integer", + "default": 3, + "description": "The height (in blocks) that the mob will search within to find a random position position to move to. Must be at least 1." + }, + "random_pos_search_range": { + "title": "Random Pos Search Range", + "type": "integer", + "default": 16, + "description": "The distance (in blocks) on ground that the mob will search within to find a random position to move to. Must be at least 1." } } }