public void performEffect(LivingEntity entity, int amplifier) {
// exit if entity is undefined
if (entity == null)
return;
// exit if entity is player
if (isTypePlayerEntity(entity))
return;
// exit if entity has no effects
Optional<EffectInstance> optInstance = resolveEffectInstance(entity);
if (!optInstance.isPresent())
return;
// find entities and add effect
aoePorts.setLivingEntity1(entity);
aoePorts.setEffectInstance1(optInstance.get());
run(aoePorts, lazyInitAoeCoreOp);
}
The resolution of the effect and exit if no effect was found should implemented as operators:
ResolveEffect: resolves a effect from living entity x
Conditional operator which sets the state as negative if effect-instance isn't defined in ports
Current implementation:
The resolution of the effect and exit if no effect was found should implemented as operators: