"swimming" condition to activate an effect
I created a similar thorn enchantment but with activation of the dolphin effect for a few seconds for those affected. The point is that I would like this feature to be activated in water or at least while swimming (Although simply activating it when in water would be better). I honestly don't know how to do it I had some ideas but it doesn't look decent.
code:
{ "description": "Dolphin Call", "supported_items": "#minecraft:enchantable/chest_armor", "weight": 1, "max_level": 3, "min_cost": { "base": 15, "per_level_above_first": 9 }, "max_cost": { "base": 45, "per_level_above_first": 9 }, "anvil_cost": 4, "slots": [ "chest" ], "effects": { "minecraft:post_attack": [ { "enchanted": "attacker", "affected": "victim", "effect": { "type": "minecraft:apply_mob_effect", "to_apply": "minecraft:dolphins_grace", "min_duration": { "type": "minecraft:linear", "base": 1, "per_level_above_first": 2 }, "max_duration": { "type": "minecraft:linear", "base": 1, "per_level_above_first": 2 }, "min_amplifier": 0, "max_amplifier": 0 }, "requirements": { "condition": "minecraft:random_chance", "chance": { "type": "minecraft:enchantment_level", "amount": { "type": "minecraft:linear", "base": 0.15, "per_level_above_first": 0.15 } } } } ] } }