Minecraft problem with knockback resistance attribute

I am attempting to make one player immune to knockback. I have a command block with this in:
/replaceitem entity @p slot.inventory.0 minecraft:stone 1 0 {display:{Name:"Anti-Knockback",Lore:["Just so you arent affected by knockback"]},AttributeModifiers:[{AttributeName:"generic.knockbackResistance",Name:"generic.knockbackResistance",Amount:1,Operation:1,UUIDMost:82829,UUIDLeast:167220}]}
It gives me the stone block and it says "+100% knockback resistance" but I'm still knocked back the same as before.
I used this command generator for this command.
Is there something wrong with the command that I can fix or is this just not the way to go about removing knockback. If so, how can I do it?
Thanks
I'm doing this because I have a snowball that summons a massive amount of lightning and it's knocking me back. I thought it might just be that the attribute doesn't affect lightning but I tried it with a skeleton and the result was the same.
Best Answer
An operation of 1 is multiplying against your current base, which is 0. 100% of 0 is still 0. You'll want to use an operation of 0 instead, which is addition (and a generic.knockbackResistance
of 1 is 100% chance to resist):
/replaceitem entity @p slot.inventory.0 minecraft:stone 1 0 {display:{Name:"Anti-Knockback",Lore:["Just so you arent affected by knockback"]},AttributeModifiers:[{AttributeName:"generic.knockbackResistance",Name:"generic.knockbackResistance",Amount:1,Operation:0,UUIDMost:82829,UUIDLeast:167220}]}
Pictures about "Minecraft problem with knockback resistance attribute"



Does Resistance reduce knockback?
It decreases the CHANCE you take knockback, base at 0. Makes no sense. None. It should be changed to the amount of knockback.How do you become immune to knockback in Minecraft?
Knockback ResistanceSlime Hat - provides immunity to Knockback from mobs. Dwarf Turtle Shelmet (Pet Item) - provides immunity to Knockback. $l$ Turtle Pet - Unflippable ability provides immunity to Knockback.Does Netherite armor have knockback resistance?
Netherite Gear is universally better than diamond. Netherite Armour has knockback resistance built in, making it the first piece of gear to use this feature.How much knockback resistance does Netherite give?
Netherite Armor is Stronger and Lasts Longer It's the durability and knockback resistance. Indeed, each piece of Netherite Armor has 12% more durability than Diamond, and provides +1 knockback resistance \u2014 enough, when fully equipped, to sometimes negate knockback completely.Minecraft knockback resistance attribute testing
Sources: Stack Exchange - This article follows the attribution requirements of Stack Exchange and is licensed under CC BY-SA 3.0.
Images: Anete Lusina, Centre for Ageing Better, RODNAE Productions, Andres Ayrton