Search in sources :

Example 1 with KeyMantleFlight

use of hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight in project AstralSorcery by HellFirePvP.

the class MantleEffectVicio method tickServer.

@Override
protected void tickServer(PlayerEntity player) {
    super.tickServer(player);
    PlayerProgress prog = ResearchHelper.getProgress(player, LogicalSide.SERVER);
    if (prog.getPerkData().hasPerkEffect(p -> p instanceof KeyMantleFlight) && AlignmentChargeHandler.INSTANCE.drainCharge(player, LogicalSide.SERVER, CONFIG.chargeCost.get(), true)) {
        boolean prev = player.abilities.allowFlying;
        player.abilities.allowFlying = true;
        if (!prev) {
            player.sendPlayerAbilities();
        }
        EventHelperTemporaryFlight.allowFlight(player, 20);
        if (player.abilities.isFlying && !player.isOnGround() && player.ticksExisted % 20 == 0) {
            if (!PlayerAffectionFlags.isPlayerAffected(player, CEffectVicio.FLAG)) {
                AlignmentChargeHandler.INSTANCE.drainCharge(player, LogicalSide.SERVER, CONFIG.chargeCost.get(), false);
            }
        }
    }
}
Also used : FXFacingParticle(hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle) CEffectVicio(hellfirepvp.astralsorcery.common.constellation.effect.aoe.CEffectVicio) Vector3(hellfirepvp.astralsorcery.common.util.data.Vector3) ItemMantle(hellfirepvp.astralsorcery.common.item.armor.ItemMantle) ResearchHelper(hellfirepvp.astralsorcery.common.data.research.ResearchHelper) OnlyIn(net.minecraftforge.api.distmarker.OnlyIn) PlayerEntity(net.minecraft.entity.player.PlayerEntity) ForgeConfigSpec(net.minecraftforge.common.ForgeConfigSpec) ConstellationsAS(hellfirepvp.astralsorcery.common.lib.ConstellationsAS) PlayerAffectionFlags(hellfirepvp.astralsorcery.common.event.PlayerAffectionFlags) Dist(net.minecraftforge.api.distmarker.Dist) ItemStack(net.minecraft.item.ItemStack) AlignmentChargeHandler(hellfirepvp.astralsorcery.common.auxiliary.charge.AlignmentChargeHandler) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress) MantleEffect(hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect) Minecraft(net.minecraft.client.Minecraft) KeyMantleFlight(hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight) EventHelperTemporaryFlight(hellfirepvp.astralsorcery.common.event.helper.EventHelperTemporaryFlight) Nonnull(javax.annotation.Nonnull) LogicalSide(net.minecraftforge.fml.LogicalSide) KeyMantleFlight(hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight) PlayerProgress(hellfirepvp.astralsorcery.common.data.research.PlayerProgress)

Example 2 with KeyMantleFlight

use of hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight 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)

Aggregations

MantleEffect (hellfirepvp.astralsorcery.common.constellation.mantle.MantleEffect)2 PlayerProgress (hellfirepvp.astralsorcery.common.data.research.PlayerProgress)2 ItemMantle (hellfirepvp.astralsorcery.common.item.armor.ItemMantle)2 KeyMantleFlight (hellfirepvp.astralsorcery.common.perk.node.key.KeyMantleFlight)2 FXFacingParticle (hellfirepvp.astralsorcery.client.effect.vfx.FXFacingParticle)1 AlignmentChargeHandler (hellfirepvp.astralsorcery.common.auxiliary.charge.AlignmentChargeHandler)1 CEffectVicio (hellfirepvp.astralsorcery.common.constellation.effect.aoe.CEffectVicio)1 ResearchHelper (hellfirepvp.astralsorcery.common.data.research.ResearchHelper)1 PlayerAffectionFlags (hellfirepvp.astralsorcery.common.event.PlayerAffectionFlags)1 EventHelperTemporaryFlight (hellfirepvp.astralsorcery.common.event.helper.EventHelperTemporaryFlight)1 ConstellationsAS (hellfirepvp.astralsorcery.common.lib.ConstellationsAS)1 Vector3 (hellfirepvp.astralsorcery.common.util.data.Vector3)1 Nonnull (javax.annotation.Nonnull)1 Minecraft (net.minecraft.client.Minecraft)1 PlayerEntity (net.minecraft.entity.player.PlayerEntity)1 ItemStack (net.minecraft.item.ItemStack)1 Dist (net.minecraftforge.api.distmarker.Dist)1 OnlyIn (net.minecraftforge.api.distmarker.OnlyIn)1 ForgeConfigSpec (net.minecraftforge.common.ForgeConfigSpec)1 LogicalSide (net.minecraftforge.fml.LogicalSide)1