mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-12-17 23:48:00 +01:00
Earth ponies will now jump automatically to stop (don't have to be in the air to use the ability) + stomping increases exhaustion in addition to consuming a little mana
This commit is contained in:
parent
465f18d5c3
commit
9b1bbd96bc
1 changed files with 16 additions and 8 deletions
|
@ -4,6 +4,7 @@ import java.util.Optional;
|
||||||
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
|
import com.minelittlepony.unicopia.AwaitTickQueue;
|
||||||
import com.minelittlepony.unicopia.Race;
|
import com.minelittlepony.unicopia.Race;
|
||||||
import com.minelittlepony.unicopia.ability.data.Hit;
|
import com.minelittlepony.unicopia.ability.data.Hit;
|
||||||
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
import com.minelittlepony.unicopia.client.render.PlayerPoser.Animation;
|
||||||
|
@ -78,8 +79,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
public Optional<Hit> prepare(Pony player) {
|
public Optional<Hit> prepare(Pony player) {
|
||||||
if (!player.asEntity().isOnGround()
|
if (player.asEntity().getVelocity().y * player.getPhysics().getGravitySignum() < 0
|
||||||
&& player.asEntity().getVelocity().y * player.getPhysics().getGravitySignum() < 0
|
|
||||||
&& !player.asEntity().getAbilities().flying) {
|
&& !player.asEntity().getAbilities().flying) {
|
||||||
thrustDownwards(player);
|
thrustDownwards(player);
|
||||||
return Hit.INSTANCE;
|
return Hit.INSTANCE;
|
||||||
|
@ -106,11 +106,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
public boolean apply(Pony iplayer, Hit data) {
|
public boolean apply(Pony iplayer, Hit data) {
|
||||||
PlayerEntity player = iplayer.asEntity();
|
PlayerEntity player = iplayer.asEntity();
|
||||||
|
|
||||||
iplayer.setAnimation(Animation.STOMP, Animation.Recipient.ANYONE, 10);
|
Runnable r = () -> {
|
||||||
|
|
||||||
thrustDownwards(iplayer);
|
|
||||||
|
|
||||||
iplayer.waitForFall(() -> {
|
|
||||||
BlockPos center = PosHelper.findSolidGroundAt(player.getEntityWorld(), player.getBlockPos(), iplayer.getPhysics().getGravitySignum());
|
BlockPos center = PosHelper.findSolidGroundAt(player.getEntityWorld(), player.getBlockPos(), iplayer.getPhysics().getGravitySignum());
|
||||||
|
|
||||||
float heavyness = 1 + EnchantmentHelper.getEquipmentLevel(UEnchantments.HEAVY, player);
|
float heavyness = 1 + EnchantmentHelper.getEquipmentLevel(UEnchantments.HEAVY, player);
|
||||||
|
@ -162,7 +158,19 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
ParticleUtils.spawnParticle(player.getWorld(), UParticles.GROUND_POUND, player.getX(), player.getY() - 1, player.getZ(), 0, 0, 0);
|
ParticleUtils.spawnParticle(player.getWorld(), UParticles.GROUND_POUND, player.getX(), player.getY() - 1, player.getZ(), 0, 0, 0);
|
||||||
|
|
||||||
iplayer.subtractEnergyCost(rad);
|
iplayer.subtractEnergyCost(rad);
|
||||||
});
|
iplayer.asEntity().addExhaustion(3);
|
||||||
|
};
|
||||||
|
|
||||||
|
if (iplayer.asEntity().isOnGround()) {
|
||||||
|
iplayer.setAnimation(Animation.STOMP, Animation.Recipient.ANYONE, 10);
|
||||||
|
iplayer.asEntity().jump();
|
||||||
|
iplayer.updateVelocity();
|
||||||
|
AwaitTickQueue.scheduleTask(iplayer.asWorld(), w -> r.run(), 5);
|
||||||
|
} else {
|
||||||
|
thrustDownwards(iplayer);
|
||||||
|
iplayer.waitForFall(r);
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue