athrane / bassebombecraft

Bassebombecraft Minecraft Mod
https://www.curseforge.com/minecraft/mc-mods/bassebombecraft
GNU General Public License v3.0
0 stars 0 forks source link

Remove type cast hack from WildfireEffect #1264

Open athrane opened 2 years ago

athrane commented 2 years ago

Affected code:

    /**
     * Create AOE effect operators.
     */
    public static Supplier<Operator2> splAoeEffectOp = () -> {

        // IsEffectActive2 + AddEffect2: HACK to type cast from entity to living entity
        Function<Ports, LivingEntity> fnGetTarget = p -> (LivingEntity) applyV(getFnGetEntity2(), p);

        // AddGraphicalEffectAtClient2: get effect duration from configuration
        Function<Ports, Double> fnGetDuration = p -> wildfireEffectDuration.get().doubleValue();

        // create operator for AOE effect
        return new Sequence2(new IsNot2(new IsEffectActive2(fnGetTarget, WILDFIRE_EFFECT.get())),
                new AddEffect2(fnGetTarget, getBcSetEffectInstance1(), WILDFIRE_EFFECT.get(),
                        wildfireEffectDuration.get(), wildfireEffectAmplifier.get()),
                new AddGraphicalEffectAtClient2(getFnGetEntity1(), getFnGetEntity2(), fnGetDuration, WILDFIRE));
    };