MobEffectsPredicate
Link to mobeffectspredicate
Represents a predicate for an MCEntity's current effects.
This predicate is able to verify the presence of one or multiple MCPotionEffects on the entity, along with verifying that their EffectData is within some specified constraints. The predicate is not able to check the absence of certain effects, and will also require the specified effects to be present on the entity.
By default, any effect that is on the entity will match the predicate.
导入类
Link to 导入类
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 Copyimport crafttweaker.api.predicate.MobEffectsPredicate;
Extending AnyDefaultingVanillaWrappingPredicate
Link to extending-anydefaultingvanillawrappingpredicate
MobEffectsPredicate extends AnyDefaultingVanillaWrappingPredicate. That means all methods available in AnyDefaultingVanillaWrappingPredicate are also available in MobEffectsPredicate
使用方式
Link to 使用方式
Name: withEffect
Adds an MCPotionEffect to the ones that should be present on the entity, along with the EffectData it should have.
If the same effect had already been added to the map with a different set of effect data, then the previous configuration is replaced. Otherwise the addition completes normally.
Returns: This predicate for chaining.
Return Type: MobEffectsPredicate
ZenScript CopyMobEffectsPredicate.withEffect(effect as MCPotionEffect, builder as Consumer<EffectData>) as MobEffectsPredicate
参数 | 类型 | 描述 |
---|---|---|
参数 effect | 类型 MCPotionEffect | 描述 The effect that should be present on the entity. |
参数 生成器 | 类型 Consumer<EffectData> | 描述 A consumer to configure the EffectData for the given effect. |