Minecraft – Area Effect Clouds: RadiusOnUse/DurationOnUse

minecraft-commandsminecraft-java-edition

In my testing the radius and duration of Area Effect Clouds can be altered when entities come into contact with them, but only if the Cloud has a potion effect to apply to the entity and the effect is of a certain group of effects. For some reason Clouds with effects like Thick and Mundane can be summoned even though those effects cannot be applied to a player.

I want to alter the duration or the radius (either or, doesn't matter) of an Area Effect Cloud when it touches an entity without applying an effect to that entity, is this possible?

Best Answer

There are two main way to do this: The "forwards" way and the "backwards" way.

The "forwards" way would be to not use the properties of the AEC at all and instead emulate it with commands by doing calculations based on the radius of the cloud and then modifying the cloud's radius based on a player being inside it or not. That's pretty complicated.

The "backwards" way is to give the AEC an effect that doesn't normally happen (like "luck") and then to simply remove that effect from every player whenever they have it. So just this in a repeating command block or ticking function:

/effect clear @a luck

If you want to get really fancy, you can put that command into a function that is called by a hidden advancement with a corresponding effects_changed (archive) trigger, that should be the solution with the best performance.