mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Increase energy cost when flying over the void. Fixes #356
This commit is contained in:
parent
2cdce6504c
commit
715519e1f1
2 changed files with 19 additions and 7 deletions
|
@ -393,7 +393,9 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
private void tickGrounded() {
|
||||
prevStrafe = 0;
|
||||
strafe = 0;
|
||||
if (entity.isOnGround()) {
|
||||
ticksInAir = 0;
|
||||
}
|
||||
wallHitCooldown = MAX_WALL_HIT_CALLDOWN;
|
||||
soundPlaying = false;
|
||||
descentRate = 0;
|
||||
|
@ -524,9 +526,15 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
|
||||
mana.add(MathHelper.clamp(cost, -100, 0));
|
||||
|
||||
if (mana.getPercentFill() < 0.2) {
|
||||
pony.getMagicalReserves().getExertion().addPercent(2);
|
||||
pony.getMagicalReserves().getExhaustion().add(2 + (int)(getHorizontalMotion() * 50));
|
||||
boolean overVoid = PosHelper.isOverVoid(pony.asWorld(), pony.getOrigin(), getGravitySignum());
|
||||
|
||||
if (overVoid) {
|
||||
mana.addPercent(-2);
|
||||
}
|
||||
|
||||
if (mana.getPercentFill() < (overVoid ? 0.4F : 0.2F)) {
|
||||
pony.getMagicalReserves().getExertion().addPercent(overVoid ? 4 : 2);
|
||||
pony.getMagicalReserves().getExhaustion().add((overVoid ? 4 : 0) + 2 + (int)(getHorizontalMotion() * 50));
|
||||
|
||||
if (mana.getPercentFill() < 0.1 && ticksInAir % 10 == 0) {
|
||||
float exhaustion = (0.3F * ticksInAir) / 70;
|
||||
|
@ -537,10 +545,10 @@ public class PlayerPhysics extends EntityPhysics<PlayerEntity> implements Tickab
|
|||
entity.addExhaustion(exhaustion);
|
||||
}
|
||||
|
||||
if (pony.getMagicalReserves().getExhaustion().get() > 99 && ticksInAir % 25 == 0) {
|
||||
entity.damage(pony.damageOf(UDamageTypes.EXHAUSTION), 2);
|
||||
if (pony.getMagicalReserves().getExhaustion().getPercentFill() > 0.99F && ticksInAir % 25 == 0 && !pony.isClient()) {
|
||||
entity.damage(pony.damageOf(UDamageTypes.EXHAUSTION), entity.getWorld().random.nextBetween(2, 4));
|
||||
|
||||
if (entity.getWorld().random.nextInt(110) == 1 && !pony.isClient()) {
|
||||
if (entity.getWorld().random.nextInt(110) == 1) {
|
||||
pony.getLevel().add(1);
|
||||
if (Abilities.RAINBOOM.canUse(pony.getCompositeRace())) {
|
||||
pony.getMagicalReserves().getCharge().addPercent(4);
|
||||
|
|
|
@ -37,6 +37,10 @@ public interface PosHelper {
|
|||
return mutable.toImmutable();
|
||||
}
|
||||
|
||||
static boolean isOverVoid(World world, BlockPos pos, int signum) {
|
||||
return signum > 0 && findSolidGroundAt(world, pos, signum).getY() < world.getBottomY();
|
||||
}
|
||||
|
||||
static void fastAll(BlockPos origin, Consumer<BlockPos.Mutable> consumer, Direction... directions) {
|
||||
final BlockPos immutable = origin instanceof BlockPos.Mutable m ? m.toImmutable() : origin;
|
||||
final BlockPos.Mutable mutable = origin instanceof BlockPos.Mutable m ? m : origin.mutableCopy();
|
||||
|
|
Loading…
Reference in a new issue