From 798221290d7ffa447d0d9532a51b5f82533cd0e1 Mon Sep 17 00:00:00 2001 From: Xterionix <72647213+Xterionix@users.noreply.github.com> Date: Sat, 23 Mar 2024 11:20:51 +0500 Subject: [PATCH] Misc entity fixes (#248) * - Misc entity fixes * - Update entity sensor * Update source/behavior/entities/format/behaviors/dig.json Co-authored-by: Daan Verstraten * - Change entity sensor range property * - Fix --------- Co-authored-by: Daan Verstraten --- .../entities/format/behaviors/dig.json | 5 +++++ .../entities/format/behaviors/emerge.json | 4 ++-- .../entities/format/behaviors/float.json | 6 ++++++ .../behaviors/random_search_and_dig.json | 10 +++++++++- .../entities/format/behaviors/sleep.json | 6 ++++++ .../format/behaviors/trade_with_player.json | 5 +++++ .../behavior/entities/format/components.json | 4 +++- .../format/components/entity_sensor.json | 15 +++++++++++---- .../format/components/follow_range.json | 4 ++-- .../format/components/is_pregnant.json | 9 +++++++++ .../entities/format/components/projectile.json | 18 ++++++++++++------ .../format/components/spawn_entity.json | 5 +++++ 12 files changed, 75 insertions(+), 16 deletions(-) create mode 100644 source/behavior/entities/format/components/is_pregnant.json diff --git a/source/behavior/entities/format/behaviors/dig.json b/source/behavior/entities/format/behaviors/dig.json index 129c169b..6a4b093e 100644 --- a/source/behavior/entities/format/behaviors/dig.json +++ b/source/behavior/entities/format/behaviors/dig.json @@ -42,6 +42,11 @@ "type": "boolean", "default": false, "description": "If true, vibrations count as disturbances that may delay the start of this goal." + }, + "on_start": { + "title": "On Start", + "$ref": "../types/trigger.json", + "description": "The event to run when the goal start" } } } diff --git a/source/behavior/entities/format/behaviors/emerge.json b/source/behavior/entities/format/behaviors/emerge.json index 77496244..afae3f07 100644 --- a/source/behavior/entities/format/behaviors/emerge.json +++ b/source/behavior/entities/format/behaviors/emerge.json @@ -2,14 +2,14 @@ "$id": "blockception.minecraft.behavior.entities.minecraft.behavior.emerge", "type": "object", "title": "Emerge", - "description": "[EXPERIMENTAL BEHAVIOR] Activates the `EMERGING` actor flag during the specified duration and triggers `on_done` at the end", + "description": "Activates the `EMERGING` actor flag during the specified duration and triggers `on_done` at the end", "additionalProperties": false, "required": [], "properties": { "priority": { "$ref": "./types/priority.json" }, "cooldown_time": { "title": "Cooldown Time", - "type": "integer", + "type": "number", "default": 0.5, "description": "Time in seconds the mob has to wait before using the goal again." }, diff --git a/source/behavior/entities/format/behaviors/float.json b/source/behavior/entities/format/behaviors/float.json index 679167dc..f9efa9eb 100644 --- a/source/behavior/entities/format/behaviors/float.json +++ b/source/behavior/entities/format/behaviors/float.json @@ -8,6 +8,12 @@ "properties": { "priority": { "$ref": "./types/priority.json" + }, + "sink_with_passengers": { + "title": "Sink With Passengers", + "description": "If true, the mob will keep sinking as long as it has passengers.", + "type": "boolean", + "default": false } } } diff --git a/source/behavior/entities/format/behaviors/random_search_and_dig.json b/source/behavior/entities/format/behaviors/random_search_and_dig.json index eed6f128..c2f5018e 100644 --- a/source/behavior/entities/format/behaviors/random_search_and_dig.json +++ b/source/behavior/entities/format/behaviors/random_search_and_dig.json @@ -13,7 +13,15 @@ "title": "Cooldown Range", "default": [0.0, 0.0], "description": "Goal cooldown range in seconds.", - "$ref": "../../../../general/vectors/number2.json" + "anyOf": [ + { + "$ref": "../../../../general/vectors/number2.json" + }, + { + "type": "number", + "minimum": 0 + } + ] }, "digging_duration_range": { "title": "Digging Duration Range", diff --git a/source/behavior/entities/format/behaviors/sleep.json b/source/behavior/entities/format/behaviors/sleep.json index ecd21a98..d2358a08 100644 --- a/source/behavior/entities/format/behaviors/sleep.json +++ b/source/behavior/entities/format/behaviors/sleep.json @@ -43,6 +43,12 @@ "type": "number", "default": 8.0, "description": "The cooldown time in seconds before the goal can be reused after a internal failure or timeout condition." + }, + "goal_radius": { + "title": "Goal Radius", + "description": "Distance in blocks within the mob considers it has reached the goal. This is the \"wiggle room\" to stop the AI from bouncing back and forth trying to reach a specific spot", + "default": 0.5, + "type": "number" } }, "examples": [ diff --git a/source/behavior/entities/format/behaviors/trade_with_player.json b/source/behavior/entities/format/behaviors/trade_with_player.json index 5d6e9d80..a4280100 100644 --- a/source/behavior/entities/format/behaviors/trade_with_player.json +++ b/source/behavior/entities/format/behaviors/trade_with_player.json @@ -8,6 +8,11 @@ "properties": { "priority": { "$ref": "./types/priority.json" + }, + "filters": { + "title": "Filters", + "$ref": "../../filters/filters.json", + "description": "Conditions that need to be met for the behavior to start." } } } diff --git a/source/behavior/entities/format/components.json b/source/behavior/entities/format/components.json index 1f10dc3c..939ba85c 100644 --- a/source/behavior/entities/format/components.json +++ b/source/behavior/entities/format/components.json @@ -91,6 +91,7 @@ "minecraft:is_hidden_when_invisible": { "$ref": "./components/is_hidden_when_invisible.json" }, "minecraft:is_ignited": { "$ref": "./components/is_ignited.json" }, "minecraft:is_illager_captain": { "$ref": "./components/is_illager_captain.json" }, + "minecraft:is_pregnant": { "$ref": "./components/is_pregnant.json" }, "minecraft:is_saddled": { "$ref": "./components/is_saddled.json" }, "minecraft:is_shaking": { "$ref": "./components/is_shaking.json" }, "minecraft:is_sheared": { "$ref": "./components/is_sheared.json" }, @@ -223,7 +224,7 @@ "minecraft:behavior.eat_block": { "$ref": "./behaviors/eat_block.json" }, "minecraft:behavior.eat_carried_item": { "$ref": "./behaviors/eat_carried_item.json" }, "minecraft:behavior.eat_mob": { "$ref": "./behaviors/eat_mob.json" }, - "minecraft:behavior.emerge": { "$ref": "./behaviors/eat_mob.json" }, + "minecraft:behavior.emerge": { "$ref": "./behaviors/emerge.json" }, "minecraft:behavior.enderman_leave_block": { "$ref": "./behaviors/enderman_leave_block.json" }, "minecraft:behavior.enderman_take_block": { "$ref": "./behaviors/enderman_take_block.json" }, "minecraft:behavior.equip_item": { "$ref": "./behaviors/equip_item.json" }, @@ -327,6 +328,7 @@ "minecraft:behavior.slime_random_direction": { "$ref": "./behaviors/slime_random_direction.json" }, "minecraft:behavior.snacking": { "$ref": "./behaviors/snacking.json" }, "minecraft:behavior.sneeze": { "$ref": "./behaviors/sneeze.json" }, + "minecraft:behavior.sniff": { "$ref": "./behaviors/sniff.json" }, "minecraft:behavior.sonic_boom": { "$ref": "./behaviors/sonic_boom.json" }, "minecraft:behavior.squid_dive": { "$ref": "./behaviors/squid_dive.json" }, "minecraft:behavior.squid_flee": { "$ref": "./behaviors/squid_flee.json" }, diff --git a/source/behavior/entities/format/components/entity_sensor.json b/source/behavior/entities/format/components/entity_sensor.json index 9d8c8e73..776d6ed8 100644 --- a/source/behavior/entities/format/components/entity_sensor.json +++ b/source/behavior/entities/format/components/entity_sensor.json @@ -33,10 +33,17 @@ "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" + "description": "The maximum distance another entity can be from this and have the filters checked against it.", + "title": "Range", + "anyOf": [ + { + "$ref": "../../../../general/vectors/number2.json" + }, + { + "default": 10, + "type": "number" + } + ] }, "require_all": { "type": "boolean", diff --git a/source/behavior/entities/format/components/follow_range.json b/source/behavior/entities/format/components/follow_range.json index 8d3871e4..7f9fcb6c 100644 --- a/source/behavior/entities/format/components/follow_range.json +++ b/source/behavior/entities/format/components/follow_range.json @@ -8,12 +8,12 @@ "properties": { "value": { "type": "integer", - "description": "Range of the amount of damage the melee follow_range deals. A negative value can heal the entity instead of hurting it.", + "description": "The distance this entity can be from the target when following it", "title": "Value" }, "max": { "type": "integer", - "description": "Duration, in seconds, of the status ailment applied to the damaged entity.", + "description": "Maximum distance this entity can be from the target when following it", "title": "Max" } }, diff --git a/source/behavior/entities/format/components/is_pregnant.json b/source/behavior/entities/format/components/is_pregnant.json new file mode 100644 index 00000000..686d3977 --- /dev/null +++ b/source/behavior/entities/format/components/is_pregnant.json @@ -0,0 +1,9 @@ +{ + "$id": "blockception.minecraft.behavior.entities.minecraft.is_pregnant", + "description": "Sets that this entity is currently is_pregnant", + "type": "object", + "title": "Is Pregnant", + "additionalProperties": false, + "required": [], + "properties": {} +} diff --git a/source/behavior/entities/format/components/projectile.json b/source/behavior/entities/format/components/projectile.json index 68638399..6d4b0cab 100644 --- a/source/behavior/entities/format/components/projectile.json +++ b/source/behavior/entities/format/components/projectile.json @@ -195,9 +195,9 @@ }, "douse_fire": { "title": "Douse Fire", + "description": "If the target is on fire, then douse the fire.", "type": "boolean", - "default": false, - "description": "If the target is on fire, then douse hte fire." + "default": false }, "freeze_on_hit": { "title": "Freeze On Hit", @@ -285,9 +285,9 @@ "properties": { "catch_fire": { "title": "Catch Fire", + "description": "Determines if the struck object is set on fire.", "type": "boolean", - "default": false, - "description": "Determines if the struck object is set on fire." + "default": false }, "channeling": { "title": "Channeling", @@ -361,6 +361,12 @@ "type": "boolean", "default": false, "description": "If true, then the hit must cause damage to update the last hurt property." + }, + "should_bounce": { + "title": "Should Bounce", + "description": "If true, the projectile will bounce", + "type": "boolean", + "default": false } } }, @@ -585,9 +591,9 @@ }, "teleport_owner": { "title": "Teleport Owner", + "description": "Determines if the owner is transported on hit.", "type": "boolean", - "default": false, - "description": "Determines if the owner is transported on hit." + "default": false }, "thrown_potion_effect": { "title": "Thrown Potion Effect", diff --git a/source/behavior/entities/format/components/spawn_entity.json b/source/behavior/entities/format/components/spawn_entity.json index 43c810df..802ec6f7 100644 --- a/source/behavior/entities/format/components/spawn_entity.json +++ b/source/behavior/entities/format/components/spawn_entity.json @@ -73,6 +73,11 @@ "default": "plop", "description": "Identifier of the sound effect to play when the entity is spawned.", "title": "Spawn Sound" + }, + "spawn_item_event": { + "description": "Event to call on this entity when the item is spawned.", + "title": "Spawn Item Event", + "$ref": "../types/event_object.json" } } }