minecraft:behavior.trade_interest for you with a switch.Get GodCraftOverview
minecraft:behavior.trade_interest is an entity component: it goes in the components object of a custom mob, or in one of its component groups. Makes a trader look at a player who holds an item it wants and show what it would give in return.
Fields
| Field | Type | Default | Description |
|---|---|---|---|
within_radius | number | 0 | How close the player must be for the trader to notice the item. |
interest_time | number | 45 | Longest time, in seconds, the trader keeps showing its trade items. |
remove_item_time | number | 1 | Longest time, in seconds, the trader waits after you stop holding a tradable item. |
carried_item_switch_time | number | 2 | Longest time, in seconds, the trader shows one item before switching to another that fits the same trade. |
cooldown | number | 2 | Seconds before the trader can use this goal again. |
priority | integer | 0 | Decides which goal wins when several want to run: lower numbers run first.Range: 0 to … |
control_flags | Goal's control flags[] | none | Lists the body parts this goal takes control of (such as move, look or jump), so goals that need the same part don't run together. |
Example
Inside the components object of BP/entities/<name>.json (values are the defaults or placeholders):
BP/entities/<name>.json
{
"minecraft:behavior.trade_interest": {
"within_radius": 0,
"interest_time": 45,
"remove_item_time": 1,
"carried_item_switch_time": 2,
"cooldown": 2,
"priority": 0,
"control_flags": []
}
}