use of com.lying.variousoddities.species.abilities.IBonusJumpAbility in project VariousOddities by Lyinginbedmon.
the class Abilities method updateBonusJumpAbilities.
public void updateBonusJumpAbilities() {
if (this.entity == null || !this.entity.isAlive())
return;
List<Ability> bonusJumps = Lists.newArrayList();
this.cachedAbilities.values().forEach((ability) -> {
if (ability instanceof IBonusJumpAbility)
bonusJumps.add(ability);
});
boolean noneValid = true;
for (Ability ability : bonusJumps) {
if (!ability.passive() && !ability.isActive())
continue;
IBonusJumpAbility jump = (IBonusJumpAbility) ability;
// Start and/or increment jump timer
if (jump.isValid(this.entity, this.entity.getEntityWorld()) && (this.currentJumpType == null || this.currentJumpType == jump.jumpType())) {
this.currentJumpType = jump.jumpType();
if (!canBonusJump)
if (bonusJumpTimer++ >= jump.getRate()) {
canBonusJump = true;
bonusJumpTimer = 0;
markDirty();
}
noneValid = false;
break;
}
}
if (bonusJumps.isEmpty() || noneValid) {
canBonusJump = false;
bonusJumpTimer = -(Reference.Values.TICKS_PER_SECOND / 2);
currentJumpType = null;
markDirty();
return;
}
}
Aggregations