Search in sources :

Example 1 with MantleEffect

use of hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect in project AstralSorcery by HellFirePvP.

the class MantleEffectVicio method isUsableElytra.

public static boolean isUsableElytra(ItemStack elytraStack, PlayerEntity wearingEntity) {
    if (elytraStack.getItem() instanceof ItemMantle) {
        MantleEffect effect = ItemMantle.getEffect(wearingEntity, ConstellationsAS.vicio);
        PlayerProgress progress;
        if (wearingEntity.getEntityWorld().isRemote()) {
            progress = ResearchHelper.getClientProgress();
        } else {
            progress = ResearchHelper.getProgress(wearingEntity, LogicalSide.SERVER);
        }
        return effect != null && !progress.getPerkData().hasPerkEffect(p -> p instanceof KeyMantleFlight);
    }
    return false;
}
Also used : MantleEffect(hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect) ItemMantle(hellfirepvp.astralsorcery.common.item.armor.ItemMantle) KeyMantleFlight(hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress)

Example 2 with MantleEffect

use of hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect in project AstralSorcery by HellFirePvP.

the class ItemMantle method getEffect.

@Nullable
public static <V extends MantleEffect> V getEffect(@Nonnull ItemStack stack, @Nullable IWeakConstellation expected) {
    if (stack.isEmpty() || !(stack.getItem() instanceof ItemMantle)) {
        return null;
    }
    IConstellation cst = ((ItemMantle) stack.getItem()).getConstellation(stack);
    if (!(cst instanceof IWeakConstellation)) {
        return null;
    }
    if (expected != null && !expected.equals(cst)) {
        return null;
    }
    MantleEffect effect = ((IWeakConstellation) cst).getMantleEffect();
    if (effect == null || !effect.getConfig().enabled.get()) {
        return null;
    }
    return (V) effect;
}
Also used : MantleEffect(hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect) IConstellation(hellfirepvp.astralsorcery.common.constellation.IConstellation) IWeakConstellation(hellfirepvp.astralsorcery.common.constellation.IWeakConstellation) Nullable(javax.annotation.Nullable)

Aggregations

MantleEffect (hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect)2 IConstellation (hellfirepvp.astralsorcery.common.constellation.IConstellation)1 IWeakConstellation (hellfirepvp.astralsorcery.common.constellation.IWeakConstellation)1 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)1 ItemMantle (hellfirepvp.astralsorcery.common.item.armor.ItemMantle)1 KeyMantleFlight (hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight)1 Nullable (javax.annotation.Nullable)1