## Check if bartering is possible
scoreboard players set #VB vb.dummy1 0
execute as @e[type=item,distance=..1.2] if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{slots:{"container.0":{items:"#minecraft:fishes"}}}} run scoreboard players set #VB vb.dummy1 1
execute as @e[type=item,distance=..1.2] if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{slots:{container.0:{predicates:{"minecraft:custom_data":{vb.item.fish:1b}}}}}} run scoreboard players set #VB vb.dummy1 1
execute if score #VB vb.dummy1 matches 0 run return fail

## Barter with fish
# Affect dropped item
# Uses fish as a base item
execute as @e[type=item,distance=..1.2] if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{slots:{"container.0":{items:"#minecraft:fishes"}}}} run function vb:tick_entity/modified_mob/cat/check_item
# Doesn't use fish as a base item
execute as @e[type=item,distance=..1.2] unless predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{slots:{"container.0":{items:"#minecraft:fishes"}}}} if predicate {condition:"minecraft:entity_properties",entity:"this",predicate:{slots:{container.0:{predicates:{"minecraft:custom_data":{vb.item.fish:1b}}}}}} run function vb:tick_entity/modified_mob/cat/check_item
# Add favor
scoreboard players operation @s vb.entity.cat_favor += #VB vb.dummy2
# Particles
particle heart ~ ~0.2 ~ 0.3 0.3 0.3 0 5

## Set time until next barter
scoreboard players set @s vb.timer.cat_barter 12000