mirror of
https://github.com/Sollace/Unicopia.git
synced 2024-11-23 21:38:00 +01:00
Fixed bed-cannon-causing incorrect thrust speed. Closes #27
This commit is contained in:
parent
368e965025
commit
88f284f202
1 changed files with 10 additions and 5 deletions
|
@ -59,7 +59,7 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
@Override
|
@Override
|
||||||
public Hit tryActivate(Pony player) {
|
public Hit tryActivate(Pony player) {
|
||||||
if (!player.getMaster().isOnGround() && !player.getMaster().abilities.flying) {
|
if (!player.getMaster().isOnGround() && !player.getMaster().abilities.flying) {
|
||||||
player.getMaster().addVelocity(0, -6, 0);
|
thrustDownwards(player.getMaster());
|
||||||
return Hit.INSTANCE;
|
return Hit.INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -71,14 +71,19 @@ public class EarthPonyStompAbility implements Ability<Hit> {
|
||||||
return Hit.SERIALIZER;
|
return Hit.SERIALIZER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void thrustDownwards(PlayerEntity player) {
|
||||||
|
BlockPos ppos = player.getBlockPos();
|
||||||
|
BlockPos pos = PosHelper.findSolidGroundAt(player.getEntityWorld(), ppos);
|
||||||
|
|
||||||
|
double downV = Math.sqrt(ppos.getSquaredDistance(pos));
|
||||||
|
player.addVelocity(0, -downV, 0);
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Pony iplayer, Hit data) {
|
public void apply(Pony iplayer, Hit data) {
|
||||||
PlayerEntity player = iplayer.getMaster();
|
PlayerEntity player = iplayer.getMaster();
|
||||||
|
|
||||||
BlockPos ppos = player.getBlockPos();
|
thrustDownwards(player);
|
||||||
BlockPos pos = PosHelper.findSolidGroundAt(player.getEntityWorld(), ppos);
|
|
||||||
|
|
||||||
player.addVelocity(0, -(ppos.getSquaredDistance(pos)), 0);
|
|
||||||
|
|
||||||
iplayer.waitForFall(() -> {
|
iplayer.waitForFall(() -> {
|
||||||
BlockPos center = PosHelper.findSolidGroundAt(player.getEntityWorld(), player.getBlockPos());
|
BlockPos center = PosHelper.findSolidGroundAt(player.getEntityWorld(), player.getBlockPos());
|
||||||
|
|
Loading…
Reference in a new issue