mirror of
https://github.com/TotalFreedomMC/TF-ProjectKorra.git
synced 2024-12-22 16:05:01 +00:00
Fix Spout speed limiting (#590)
This commit is contained in:
parent
df273dce6e
commit
2fd345de8a
1 changed files with 14 additions and 16 deletions
|
@ -1088,22 +1088,20 @@ public class PKListener implements Listener {
|
|||
return;
|
||||
}
|
||||
|
||||
// else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
// Vector vel = new Vector();
|
||||
// vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||
// vel.setY(event.getTo().getY() - event.getFrom().getY());
|
||||
// vel.setZ(event.getTo().getZ() - event.getFrom().getZ());
|
||||
// // You now know the old velocity. Set to match recommended velocity
|
||||
// double currspeed = vel.length();
|
||||
// double maxspeed = .15;
|
||||
// if (currspeed > maxspeed) {
|
||||
// // only if moving set a factor
|
||||
// vel = vel.normalize().multiply(maxspeed);
|
||||
// // apply the new velocity (MAY REQUIRE A SCHEDULED TASK
|
||||
// // INSTEAD!)
|
||||
// event.getPlayer().setVelocity(vel);
|
||||
// }
|
||||
// }
|
||||
else if (CoreAbility.hasAbility(player, WaterSpout.class) || CoreAbility.hasAbility(player, AirSpout.class) || CoreAbility.hasAbility(player, SandSpout.class)) {
|
||||
Vector vel = new Vector();
|
||||
vel.setX(event.getTo().getX() - event.getFrom().getX());
|
||||
vel.setZ(event.getTo().getZ() - event.getFrom().getZ());
|
||||
|
||||
double currspeed = vel.length();
|
||||
double maxspeed = .2;
|
||||
if (currspeed > maxspeed) {
|
||||
// apply only if moving set a factor
|
||||
vel = vel.normalize().multiply(maxspeed);
|
||||
// apply the new velocity
|
||||
event.getPlayer().setVelocity(vel);
|
||||
}
|
||||
}
|
||||
|
||||
else if (Bloodbending.isBloodbent(player)) {
|
||||
double distance1, distance2;
|
||||
|
|
Loading…
Reference in a new issue