I was wondering how to make all water completely poisonous in Minecraft 1.18.1; as in, give you wither. My current command (gotten from Google) is:

/execute @a ~ ~ ~ detect ~ ~-1 ~ Minecraft:water 0 effect give wither @p 1 0 true

But it turns red at the first @a. I have no idea what the problem is.
But that's not all there is to the issue. I want to make it so that when you wear special armor the wither does not affect you; or at least, constantly get rid of all wither effects from you every tick. I have, of course, no idea how to do this either.
I am not too experienced with commands, so I can't understand too complicated commands (especially scoreboards, but entitydata is ok), so if it means to click a button, that makes you immune for a certain amount of time, that's also doable. But I'm not sure how to make the water poisonous in the first place, so... help!

I'm playing on Java.

2 Answers 2


More complete conversion of the command to 1.13+ syntax:

/execute as @a at @s if block ~ ~-1 ~ water run effect give @s wither 2 0 true

You can make certain kinds of armor give players resistance to the effect by adding unless entity @s[nbt={...}] before the if block. See How can I test for a player wearing specific armor? for the correct NBT syntax to put in the ....

Also note that for some reason if you give the player the Wither effect for only one second they never take any damage, so you have to give the effect for two or more seconds for it to actually do anything other than turn the player's hearts black.

  • This doesn't seem to work. I've tried changing the ~ ~-1 ~ to simply ~ ~ ~, and also changing 'water' to 'minecraft:water', double and triple checked that the repeating command block was always active, tried switching between gamemodes, but it still doesn't work. I'd appreciate further help! Mar 11, 2022 at 11:30
  • Weird. I just tested it and it definitely works for me. (Unless the edit was itself the problem you were experiencing)
    – pppery
    Mar 11, 2022 at 17:22

Use /execute as @a ...

Execute has different sub commands, like as means you are executing as another entity or at means you are executing at a location.

Also, if you need the effect for all entities (players, mobs, monsters) to have the effect, replace the @a with an @e. Currently, you are only dealing the effect to players.

Note: Either way, change the @p to an @s (Especially if you are going to use @e instead of @a)

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .