minecraft:behavior.drink_potion
Allows the mob to drink potions based on specified environment conditions.
Properties
| Property | Type | Default | What it does |
|---|---|---|---|
speed_modifier | Decimal | 0 | The movement speed modifier to apply to the entity while it is drinking a potion. A value of 0 represents no change in speed. |
potions | List of object | [] | A list of potions that this entity can drink. Each potion entry has the following parameters: |
id | Integer | -1 | The registry ID of the potion to use |
chance | Decimal | 1 | The percent chance (from 0.0 to 1.0) of this potion being selected when searching for a potion to use. |
filters | Object or List of object | {"AND": null, "NOT": null, "OR": null, "all": null, "all_… | The filters to use when determining if this potion can be selected. |
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. |
priority | Integermin 0 | 0 | |
control_flags | List of text | [] |
Example from the game files
This is how vanilla Wandering Trader uses it in Minecraft Bedrock 1.26.60.5:
{
"minecraft:behavior.drink_potion": {
"potions": [
{
"chance": 1,
"filters": {
"all_of": [
{
"any_of": [
{
"operator": ">=",
"test": "hourly_clock_time",
"value": 18000
},
{
"operator": "<",
"test": "hourly_clock_time",
"value": 12000
}
]
},
{
"subject": "self",
"test": "is_visible",
"value": true
},
{
"any_of": [
{
"subject": "self",
"test": "is_avoiding_mobs",
"value": true
},
{
"all_of": [
{
"subject": "self",
"test": "has_component",
"value": "minecraft:angry"
},
{
"operator": "!=",
"test": "is_family",
"subject": "target",
"value": "player"
}
]
}
]
}
]
},
"id": 7
},
{
"chance": 1,
"filters": {
"all_of": [
{
"operator": ">=",
"test": "hourly_clock_time",
"value": 12000
},
{
"operator": "<",
"test": "hourly_clock_time",
"value": 18000
},
{
"subject": "self",
"test": "is_visible",
"value": true
},
{
"any_of": [
{
"subject": "self",
"test": "is_avoiding_mobs",
"value": true
},
{
"subject": "self",
"test": "has_component",
"value": "minecraft:angry"
}
]
}
]
},
"id": 8
}
],
"priority": 1,
"speed_modifier": -0.2
}
}Used by 2
Vanilla entities with minecraft:behavior.drink_potion in their definition:
Related components
behavior.random_strollbehavior.random_look_aroundbehavior.equip_itembehavior.move_towards_home_restrictionbehavior.timer_flag_1behavior.look_at_entitybehavior.move_towards_dwelling_restrictionbehavior.jump_to_blockbehavior.squid_divebehavior.squid_idlebehavior.squid_move_away_from_groundbehavior.squid_out_of_waterbehavior.croakbehavior.dragondeathbehavior.drink_milkbehavior.emergebehavior.investigate_suspicious_locationbehavior.lay_downbehavior.napbehavior.rise_to_liquid_levelbehavior.rollbehavior.silverfish_merge_with_stonebehavior.silverfish_wake_up_friendsbehavior.sleep