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