So I'm making a map for version 1.9 and one of its core mechanics, is that if someone is holding an object in hand, they get a certain effect (speed, jump boost etc.) and I'd like the effect to come off as soon as they switch to an empty slot or another item. With the second one the job is simple, but I've been wondering and can't find the solution for a seemingly simple question. Is it possible to detect if a player isn't holding anything in their hand?

  • Can't you just copy your NBT check and use nbt=!{…} for the reverse check? That way you don't need to individually check for holding another item and for holding nothing, it's just one check for both. – Fabian Röling Oct 21 at 4:26

Maybe this is what you want:
/give PlayerNameHere minecraft:iron_boots 1 0 {AttributeModifiers:[{AttributeName:"generic.movementSpeed",Name:"generic.movementSpeed",Amount:20,Operation:1,UUIDLeast:425245,UUIDMost:849726,Slot:"feet"}],display:{Name:"runners shoes"}}

This gives a specific player a pair of iron boots called runners shoes, with which he can run faster, if he has it on his feet.
Hope I could help you.

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.