mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-23 09:47:38 +00:00
Fix the long-range build tool's ability to build mid-air.
This commit is contained in:
parent
0656ef1920
commit
f46c70093c
@ -208,6 +208,9 @@ public class Location {
|
|||||||
* @return the direction vector
|
* @return the direction vector
|
||||||
*/
|
*/
|
||||||
public Vector3 getDirection() {
|
public Vector3 getDirection() {
|
||||||
|
if (Float.isNaN(getYaw()) && Float.isNaN(getPitch())) {
|
||||||
|
return Vector3.ZERO;
|
||||||
|
}
|
||||||
double yaw = Math.toRadians(this.getYaw());
|
double yaw = Math.toRadians(this.getYaw());
|
||||||
double pitch = Math.toRadians(this.getPitch());
|
double pitch = Math.toRadians(this.getPitch());
|
||||||
double xz = Math.cos(pitch);
|
double xz = Math.cos(pitch);
|
||||||
|
@ -189,11 +189,16 @@ public class TargetBlock {
|
|||||||
|
|
||||||
public Location getAnyTargetBlockFace() {
|
public Location getAnyTargetBlockFace() {
|
||||||
getAnyTargetBlock();
|
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() {
|
public Location getTargetBlockFace() {
|
||||||
getAnyTargetBlock();
|
getTargetBlock();
|
||||||
|
if (getCurrentBlock() == null) return null;
|
||||||
return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector()));
|
return getCurrentBlock().setDirection(getCurrentBlock().toVector().subtract(getPreviousBlock().toVector()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user