This commit is contained in:
samczsun 2017-03-09 20:15:11 -05:00 committed by cnr
parent 40648cf715
commit fc686ea497

View File

@ -320,7 +320,7 @@ public class TreasureLocation implements Listener
Location centerLocation = treasure.getCenterBlock().getLocation().add(0.5, 0.5, 0.5);
if (event.getTo().distanceSquared(centerLocation) > 9)
{
Location newTo = event.getFrom();
Location newTo = centerLocation.clone();
newTo.setPitch(event.getTo().getPitch());
newTo.setYaw(event.getTo().getYaw());
event.setTo(newTo);
@ -340,8 +340,13 @@ public class TreasureLocation implements Listener
double fromDistanceFromCenter = centerLocation.distanceSquared(fromLocation);
if (toDistanceFromCenter < fromDistanceFromCenter)
{
Location spawnLocation = new Location(player.getWorld(), 0, 64, 0);
UtilAction.velocity(player, UtilAlg.getTrajectory(player.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
Entity target = player;
while (target.getVehicle() != null)
{
target = target.getVehicle();
}
Location spawnLocation = new Location(target.getWorld(), 0, 64, 0);
UtilAction.velocity(target, UtilAlg.getTrajectory(target.getLocation(), spawnLocation).multiply(-1), 1.5, true, 0.8, 0, 1.0, true);
}
}
}