Commands/effect
< Commands
effect
Restrictions | |
---|---|
First introduced |
Java Edition 1.5 (13w09b) |
Add or remove status effects on players and other entities.
Contents
Syntax[edit]
- Java Edition
effect clear [<targets>] [<effect>]
- Removes an effect.
effect give <targets> <effect> [<seconds>] [<amplifier>] [<hideParticles>]
- Gives an effect.
- Bedrock Edition
effect <player: target> clear
- Removes all effects.
effect <player: target> <effect: Effect> [seconds: int] [amplifier: int] [hideParticles: Boolean]
- Gives or removes an effect.
Arguments[edit]
JE: <targets>
: entity
BE: player: target
: CommandSelector<Actor>
- Must be a player name, a target selector or a UUID[Java Edition only].
- Specifies the target(s). In Bedrock Edition, if not specified, defaults to the player who executes the command.
JE: <effect>
: mob_effect
BE: effect: Effect
: MobEffect
- Specifies the effect to be added or removed.
JE: <seconds>
: integer
BE: seconds: int
: int
- Must be a 32-bit integer number. In Java Edition, it must be between 0 and 1000000 (inclusive). In Bedrock Edition, it must be between 1 and 2147483647 (inclusive)[1].
- Specifies the effect's duration in seconds (or in gameticks for
instant_damage
,instant_health
, andsaturation
). If not specified, defaults to 30 seconds (or 1 gameticks forinstant_damage
,instant_health
, andsaturation
).
JE: <amplifier>
: integer
BE: amplifier: int
: int
- Must be a 32-bit integer number. In Java Edition, it must be between -2147483648 and 2147483647 (inclusive). And it must be between 0 and 255 (inclusive).
- Specifies the number of additional levels to add to the effect. If not specified, defaults to 0. Note that the first tier of a status effect (e.g. Regeneration I) is 0, so the second tier, for example Regeneration II, would be specified by an amplifier level of 1.
JE: <hideParticles>
: bool
BE: hideParticles: Boolean
: bool
- Specifies whether the particles and the HUD indicator[Java Edition only] of the status effect should be hidden. If not specified, defaults to
false
.
Result[edit]
Command | Trigger | Java Edition | Bedrock Edition |
---|---|---|---|
any | the arguments are not specified correctly | Unparseable | Failed |
if <targets> or player: target fails to resolve to one or more entities (named player must be online) | Failed | ||
/effect clear | if <targets> is not specified and the command executor is not a player | N/A | |
/effect clear ... | if no effect is removed from any entity | ||
/effect ... clear | if no effect is removed from any entity | N/A | Failed |
any | On success | Removes or gives the specified effect(s). |
Output[edit]
Command | Edition | Situation | Success Count | /execute store success ... | /execute store result ... |
---|---|---|---|---|---|
any | Java Edition | On fail | 0 | 0 | 0 |
On success | 1 | 1 | the number of entities that are given or revoked effect(s). | ||
Bedrock Edition | On fail | 0 | N/A | N/A | |
On success | the number of entities that are given or revoked effect(s). | N/A | N/A |
Note[edit]
- If a target already has the status effect, a new status effect with the same amplifier overrides the old duration only if it is longer, but a new status effect with a higher duration overrides any previous duration.
- ↑ Gives an effect only if 2,040,109,465 or below. If above, it does not give the effect though the success message is displayed.
Examples[edit]
- To grant a Speed II effect to the nearest player for 60 seconds:
effect give @p minecraft:speed 60 1
[Java Edition only] oreffect @p speed 60 1
[Bedrock Edition only] - To grant a Speed III effect to the nearest player for 60 seconds:
effect give @p minecraft:speed 60 2
[Java Edition only] oreffect @p speed 60 2
[Bedrock Edition only] - To clear any Haste effects from all players:
effect clear @a minecraft:haste
[Java Edition only] oreffect @a haste 0
[Bedrock Edition only] - To clear all effects from all zombies:
effect clear @e[type=zombie]
[Java Edition only] oreffect @e[type=zombie] clear
[Bedrock Edition only]
History[edit]
Java Edition | |||||
---|---|---|---|---|---|
1.5 | 13w09b | Added /effect . | |||
1.6.1 | pre | Added clear argument to /effect . | |||
1.8 | 14w06a | Added hideParticles argument to /effect | |||
Pocket Edition | |||||
1.0.5 | alpha 1.0.5.0 | Added /effect . | |||
alpha 1.0.5.3 | The amplifier on /effect can no longer have negative values. | ||||
Bedrock Edition | |||||
? | Max value for <seconds> argument was changed to 32 bit integer limit, although gives effect only at 2040109465 or below. |