how to use:
throw a ice/golden carrot/ghast tear or a set of golden apple to a diamond sword
the sword can have night vision/slow the mobs near you/give you a resistance effect(level 5) or heal you when you attack
This uses "Custom NBT" on sword.
commands(you can also use the OOC):
scoreboard objectives add Effect dummy
scoreboard objectives add Item dummy
scoreboard objectives add damageDealt stat.damageDealt
scoreboard players set @e[type=Item] Item 2 {Item:{id:"minecraft:ice",Count:1b}}
scoreboard players set @e[type=Item] Item 3 {Item:{id:"minecraft:golden_carrot",Count:1b}}
scoreboard players set @e[type=Item] Item 5 {Item:{id:"minecraft:golden_apple",Damage:1s,Count:64b}}
scoreboard players set @e[type=Item] Item 6 {Item:{id:"minecraft:ghast_tear",Count:1b}}
scoreboard players set @e[type=Item] Item 0 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s}}
scoreboard players set @e[type=Item] Item 8 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s,tag:{Slow:1b}}}
execute @e[score_Item_min=0,score_Item=0] ~ ~ ~ execute @e[score_Item_min=2,score_Item=2,r=0] ~ ~ ~ scoreboard players set @e[r=0,score_Item=0,score_Item_min=0] Item 20
entitydata @e[score_Item_min=20,score_Item=20] {Item:{tag:{Slow:1b}}}
execute @e[score_Item_min=20,score_Item=20] ~ ~ ~ execute @e[score_Item_min=2,score_Item=2,r=0] ~ ~ ~ kill @e[r=0,score_Item_min=2,score_Item=2]
scoreboard players set @e[type=Item] Item 0 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s}}
scoreboard players set @e[type=Item] Item 8 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s,tag:{NightVision:1b}}}
execute @e[score_Item_min=0,score_Item=0] ~ ~ ~ execute @e[score_Item_min=3,score_Item=3,r=0] ~ ~ ~ scoreboard players set @e[r=0,score_Item=0,score_Item_min=0] Item 20
entitydata @e[score_Item_min=20,score_Item=20] {Item:{tag:{NightVision:1b}}}
execute @e[score_Item_min=20,score_Item=20] ~ ~ ~ execute @e[score_Item_min=3,score_Item=3,r=0] ~ ~ ~ kill @e[r=0,score_Item_min=3,score_Item=3]
scoreboard players set @e[type=Item] Item 0 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s}}
scoreboard players set @e[type=Item] Item 8 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s,tag:{OP:1b}}}
execute @e[score_Item_min=0,score_Item=0] ~ ~ ~ execute @e[score_Item_min=5,score_Item=5,r=0] ~ ~ ~ scoreboard players set @e[r=0,score_Item=0,score_Item_min=0] Item 20
entitydata @e[score_Item_min=20,score_Item=20] {Item:{tag:{OP:1b}}}
execute @e[score_Item_min=20,score_Item=20] ~ ~ ~ execute @e[score_Item_min=5,score_Item=5,r=0] ~ ~ ~ kill @e[r=0,score_Item_min=5,score_Item=5]
scoreboard players set @e[type=Item] Item 0 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s}}
scoreboard players set @e[type=Item] Item 8 {Item:{id:"minecraft:diamond_sword",Count:1b,Damage:0s,tag:{LifeSteal:1b}}}
execute @e[score_Item_min=0,score_Item=0] ~ ~ ~ execute @e[score_Item_min=6,score_Item=6,r=0] ~ ~ ~ scoreboard players set @e[r=0,score_Item=0,score_Item_min=0] Item 20
entitydata @e[score_Item_min=20,score_Item=20] {Item:{tag:{LifeSteal:1b}}}
execute @e[score_Item_min=20,score_Item=20] ~ ~ ~ execute @e[score_Item_min=6,score_Item=6,r=0] ~ ~ ~ kill @e[r=0,score_Item_min=6,score_Item=6]
scoreboard players set @a Effect 0
scoreboard players set @a Effect 1 {SelectedItem:{tag:{Slow:1b}}}
execute @a[score_Effect_min=1,score_Effect=1] ~ ~ ~ effect @e[r=10,type=!Player] minecraft:slowness 2 2 true
scoreboard players set @a Effect 0
scoreboard players set @a Effect 1 {SelectedItem:{tag:{NightVision:1b}}}
effect @a[score_Effect_min=1,score_Effect=1] minecraft:night_vision 20 0 true
effect @a[score_Effect_min=0,score_Effect=0] minecraft:night_vision 0 1 true
scoreboard players set @a Effect 0
scoreboard players set @a Effect 1 {SelectedItem:{tag:{OP:1b}}}
effect @a[score_Effect_min=1,score_Effect=1] minecraft:resistance 2 5 true
scoreboard players set @a Effect 0
scoreboard players set @a Effect 1 {SelectedItem:{tag:{LifeSteal:1b}}}
effect @a[score_Effect_min=1,score_Effect=1,score_damageDealt_min=1] minecraft:instant_health 1 0 true
scoreboard players set @a damageDealt 0