Refactor ContagionEffect to use operator to resolve potion effect
athrane opened this issue ยท 0 comments
Current implementation:
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