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?


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.


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}]}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.