minecraft:behavior.drop_item_for
Allows the entity to move toward a target, and drop an item near the target. This goal requires a "minecraft:navigation" to execute.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
seconds_before_pickup | Decimalmin 0 | 0 | The numbers of seconds that will pass before the dropped entity can be picked up from the ground. |
cooldown | Decimalmin 0 | 0.25 | Total time that the goal is on cooldown before it can be used again. |
drop_item_chance | Decimal0 to 1 | 1 | The percent chance the entity will drop an item when using this goal. |
offering_distance | Decimalmin 0 | 1 | The preferred distance the entity tries to be from the target it is dropping an item for. |
minimum_teleport_distance | Decimalmin 0 | 2 | If the target position is farther away than this distance on any tick, the entity will teleport to the target position. |
max_head_look_at_height | Decimalmin 0 | 10 | The maximum height the entities head will look at when dropping the item. The entity will always be looking at its target. |
target_range | List of decimal or Object | [1, 1, 1] | The range in blocks within which the entity searches to find a target to drop an item for. |
x | Decimal | 0 | |
y | Decimal | 0 | |
z | Decimal | 0 | |
teleport_offset | List of decimal or Object | [0, 1, 0] | When the entity teleports, offset the teleport position by this many blocks in the X, Y, and Z coordinate. |
x | Decimal | 0 | |
y | Decimal | 0 | |
z | Decimal | 0 | |
time_of_day_range | Object | {"max": 1, "min": 0} | The valid times of day that this goal can be used. For reference: noon is 0.0, sunset is 0.25, midnight is 0.5, and sunrise is 0.75, and back to noon for 1.0. |
min | Decimal | 0 | |
max | Decimal | 0 | |
loot_table | Text | "" | The loot table that contains the possible loot the entity can drop with this goal. |
on_drop_attempt | Object | {"event": "", "filters": {"AND": null, "NOT": null, "OR":… | The event to trigger when the entity attempts to drop an item. |
event | Text | "" | |
target | Textself, other, player, target, parent, baby, block, damager, holder, item | "self" | |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Filters allow data objects to specify test criteria which allows their use. Filters can be defined by a single object of type (Filter Test), an array of tests, collection groups, or a combination of these objects. |
test | Text | — | The name of the test to apply. |
subject | Boolean or Integer or Decimal or Text | — | The subject of this filter test. |
operator | Boolean or Integer or Decimal or Text | — | The comparison to apply with 'value'. |
domain | Boolean or Integer or Decimal or Text | — | The domain the test should be performed in. |
value | Boolean or Integer or Decimal or Text | — | The value being compared with the test. |
entity_types | List of object or Object | [] | The list of conditions another entity must meet to be a valid target to drop an item for. |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | Conditions that make this entry in the list valid |
max_dist | Decimal | 16 | Maximum distance this mob can be away to be a valid choice |
max_height | Decimal | -1 | Maximum height this mob can be away to be a valid choice |
max_flee | Decimal | 10 | Maximum distance this mob can be from the target to stop fleeing |
walk_speed_multiplier | Decimal | 1 | Multiplier for the walking speed. A value of 1.0 means the speed is unchanged |
sprint_speed_multiplier | Decimal | 1 | Multiplier for the sprinting speed. A value of 1.0 means the speed is unchanged |
priority | Integer | 0 | Priority for this mob type |
check_if_outnumbered | Boolean | false | If true, the mob will check if its outnumbered |
reevaluate_description | Boolean | false | If true, the mob will stop being targeted if it stops meeting any conditions. |
cooldown | Integer | 0 | The amount of time in seconds that the mob has to wait before selecting a target of the same type again |
must_see | Boolean | — | If true, the mob has to be visible to be a valid choice |
must_see_forget_duration | Integer | 3 | Determines the amount of time in seconds that this mob will look for a target before forgetting about it and looking for a new one when the target isn't visible any more |
search_range | Integer | 0 | The distance in blocks the entity will search within to find a valid target position. |
search_height | Integer | 1 | The height in blocks the entity will search within to find a valid target position. |
goal_radius | Decimal | 0.5 | 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. |
search_count | Integermin 0 | 0 | The number of randomly selected blocks each tick that the mob will check within its search range and height for a valid block to move to. A value of 0 will have the mob check every block within range in one tick. |
speed_multiplier | Decimalmin 0 | 1 | Movement speed multiplier of the mob when using this goal. |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Cat uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.drop_item_for": {
"priority": 1,
"seconds_before_pickup": 0.0,
"cooldown": 0.25,
"drop_item_chance": 0.7,
"offering_distance": 5.0,
"minimum_teleport_distance": 2.0,
"max_head_look_at_height": 10.0,
"target_range": [
5.0,
5.0,
5.0
],
"teleport_offset": [
0.0,
1.0,
0.0
],
"time_of_day_range": {
"min": 0.74999,
"max": 0.8
},
"search_range": 5,
"search_height": 2,
"goal_radius": 1.0,
"entity_types": [
{
"filters": {
"test": "is_family",
"subject": "other",
"value": "player"
},
"max_dist": 6
}
],
"loot_table": "loot_tables/entities/cat_gift.json",
"on_drop_attempt": {
"event": "minecraft:cat_gifted_owner",
"target": "self"
}
}
}Used by 1
Vanilla entities with minecraft:behavior.drop_item_for in their definition:
Related components
behavior.pickup_itemsbehavior.move_to_villagebehavior.harvest_farm_blockbehavior.lay_eggbehavior.move_indoorsbehavior.move_outdoorsbehavior.place_blockbehavior.raid_gardenbehavior.digbehavior.dragonscanningbehavior.eat_blockbehavior.eat_carried_itembehavior.eat_mobbehavior.fertilize_farm_blockbehavior.hold_groundbehavior.inspect_bookshelfbehavior.move_through_villagebehavior.open_doorbehavior.random_search_and_digbehavior.restrict_open_doorbehavior.snackingbehavior.stroll_towards_villagebehavior.take_blockbehavior.transport_items