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;
}
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;
}
Aggregations