geforkt von Mirrors/FastAsyncWorldEdit
Fix the long-range build tool's ability to build mid-air.
Dieser Commit ist enthalten in:
Ursprung
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()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Laden…
In neuem Issue referenzieren
Einen Benutzer sperren