I am making special classes for my server, and I want to give someone underwater breathing whenever they are wearing a helmet named scuba. How do I do this with command blocks?


What you could do is /testfor a player with a helmet with a custom name scuba. Test for the slot number they have it in, (helmets are 103) This command should do all that:

/testfor @p[r=2] {Inventory:[{Slot:103b,tag:{display:{Name:"scuba"}}}]}

Hook it up to a clock of your choice and if the /testfor command reads true then have a comparator ready to activate a sticky piston that pushes a redstone block to activate the command

/effect @p minecraft:water_breathing

When they leave your set radius or remove there helmet the sticky piston will deactivate pulling the redstone block activating the command

/effect @p clear

enter image description here This is a list of the inventory slot numbers.

enter image description here

The Youtuber Dragnoz also has a great video on how to do things like this.

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.