Holds the data an MCPotionEffect should have to pass a parent predicate check.

This predicate can check various properties of the effect, such as its duration or amplifier value. It is also able to verify whether the effect has been applied by the ambient or by a potion and whether the effect has visible particles or not.

By default, no restrictions are placed on the effect's data.

Importing the class

Link to importing-the-class

It might be required for you to import the package if you encounter any issues (like casting an Array), so better be safe than sorry and add the import at the very top of the file.

ZenScript
Copy
import crafttweaker.api.predicate.EffectData;

Extending AnyDefaultingVanillaWrappingPredicate

Link to extending-anydefaultingvanillawrappingpredicate

EffectData extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in EffectData

Name: withAmbient

Indicates that the effect must be environmental.

An example of such effect is the one applied by a beacon.

If the predicate had already been set to check the opposite condition, the setting will be overwritten.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
// EffectData.withAmbient() as EffectData

myEffectData.withAmbient();

Link to g-withboundedamplifier

Name: withBoundedAmplifier

Sets both the minimum and maximum value the amplifier should be to <code>min</code> and <code>max</code> respectively.

If the amplifier had already some bounds specified, then they will be overwritten with the new values.

Both minimum and maximum values are inclusive, meaning that a value that is equal to either <code>min</code> or <code>max</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withBoundedAmplifier(min as int, max as int) as EffectData
ParameterTypeDescription
Parameter
min
Type
int
Description
The minimum value the amplifier should be.
Parameter
max
Type
int
Description
The maximum value the amplifier should be.

Name: withBoundedDuration

Sets both the minimum and maximum value the duration should be to <code>min</code> and <code>max</code> respectively.

If the duration had already some bounds specified, then they will be overwritten with the new values.

Both minimum and maximum values are inclusive, meaning that a value that is equal to either <code>min</code> or <code>max</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withBoundedDuration(min as int, max as int) as EffectData
ParameterTypeDescription
Parameter
min
Type
int
Description
The minimum value the duration should be.
Parameter
max
Type
int
Description
The maximum value the duration should be.

Name: withExactAmplifier

Sets the amplifier to exactly match the given <code>value</code>.

If the amplifier had already some bounds specified, then they will be overwritten with the new value.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withExactAmplifier(value as int) as EffectData
ParameterTypeDescription
Parameter
value
Type
int
Description
The exact value the amplifier should be.

Name: withExactDuration

Sets the duration to exactly match the given <code>value</code>.

If the duration had already some bounds specified, then they will be overwritten with the new value.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withExactDuration(value as int) as EffectData
ParameterTypeDescription
Parameter
value
Type
int
Description
The exact value the duration should be.

Name: withInvisibility

Indicates that the effect's particles must be invisible.

If the predicate had already been set to check the opposite condition, the setting will be overwritten.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
// EffectData.withInvisibility() as EffectData

myEffectData.withInvisibility();

Link to g-withmaximumamplifier

Name: withMaximumAmplifier

Sets the maximum value the amplifier should be to <code>max</code>.

If the amplifier had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in <code>max</code>. On the other hand, if the amplifier didn't have any bounds set, the maximum is set, leaving the lower end unbounded.

The maximum value is inclusive, meaning that a value that is equal to <code>max</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withMaximumAmplifier(max as int) as EffectData
ParameterTypeDescription
Parameter
max
Type
int
Description
The maximum value the amplifier should be.

Name: withMaximumDuration

Sets the maximum value the duration should be to <code>max</code>.

If the duration had already some bounds specified, then the maximum value of the bound will be overwritten with the value specified in <code>max</code>. On the other hand, if the duration didn't have any bounds set, the maximum is set, leaving the lower end unbounded.

The maximum value is inclusive, meaning that a value that is equal to <code>max</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withMaximumDuration(max as int) as EffectData
ParameterTypeDescription
Parameter
max
Type
int
Description
The maximum value the duration should be.

Link to g-withminimumamplifier

Name: withMinimumAmplifier

Sets the minimum value the amplifier should be to <code>min</code>.

If the amplifier had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in <code>min</code>. On the other hand, if the amplifier didn't have any bounds set, the minimum is set, leaving the upper end unbounded.

The minimum value is inclusive, meaning that a value that is equal to <code>min</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withMinimumAmplifier(min as int) as EffectData
ParameterTypeDescription
Parameter
min
Type
int
Description
The minimum value the amplifier should be.

Name: withMinimumDuration

Sets the minimum value the duration should be to <code>min</code>.

If the duration had already some bounds specified, then the minimum value of the bound will be overwritten with the value specified in <code>min</code>. On the other hand, if the duration didn't have any bounds set, the minimum is set, leaving the upper end unbounded.

The minimum value is inclusive, meaning that a value that is equal to <code>min</code> will pass the check.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
EffectData.withMinimumDuration(min as int) as EffectData
ParameterTypeDescription
Parameter
min
Type
int
Description
The minimum value the duration should be.

Name: withVisibility

Indicates that the effect's particles must be visible.

If the predicate had already been set to check the opposite condition, the setting will be overwritten.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
// EffectData.withVisibility() as EffectData

myEffectData.withVisibility();

Name: withoutAmbient

Indicates that the effect must not be environmental.

If the predicate had already been set to check the opposite condition, the setting will be overwritten.

Returns: This predicate for chaining.
Return Type: EffectData

ZenScript
Copy
// EffectData.withoutAmbient() as EffectData

myEffectData.withoutAmbient();