3
0
Mirror von https://github.com/IntellectualSites/FastAsyncWorldEdit.git synchronisiert 2024-12-24 18:10:08 +01:00

Fix the long-range build tool's ability to build mid-air.

Dieser Commit ist enthalten in:
wizjany 2019-03-01 19:29:34 -05:00
Ursprung 0656ef1920
Commit f46c70093c
2 geänderte Dateien mit 10 neuen und 2 gelöschten Zeilen

Datei anzeigen

@ -208,6 +208,9 @@ public class Location {
* @return the direction vector
*/
public Vector3 getDirection() {
if (Float.isNaN(getYaw()) && Float.isNaN(getPitch())) {
return Vector3.ZERO;
}
double yaw = Math.toRadians(this.getYaw());
double pitch = Math.toRadians(this.getPitch());
double xz = Math.cos(pitch);

Datei anzeigen

@ -189,11 +189,16 @@ public class TargetBlock {
public Location getAnyTargetBlockFace() {
getAnyTargetBlock();
return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector()));
Location current = getCurrentBlock();
if (current != null)
return current.setDirection(current.toVector().subtract(getPreviousBlock().toVector()));
else
return new Location(world, targetPos.toVector3(), Float.NaN, Float.NaN);
}
public Location getTargetBlockFace() {
getAnyTargetBlock();
getTargetBlock();
if (getCurrentBlock() == null) return null;
return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector()));
}