Added add/subtract by Vector methods to Location, thanks to erisdiscord
This commit is contained in:
parent
dc78ff7c7b
commit
73949f6d2b
@ -232,6 +232,20 @@ public class Location implements Cloneable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Adds the location by a vector.
|
||||||
|
*
|
||||||
|
* @see Vector
|
||||||
|
* @param vec Vector to use
|
||||||
|
* @return the same location
|
||||||
|
*/
|
||||||
|
public Location add(Vector vec) {
|
||||||
|
this.x += vec.getX();
|
||||||
|
this.y += vec.getY();
|
||||||
|
this.z += vec.getZ();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adds the location by another. Not world-aware.
|
* Adds the location by another. Not world-aware.
|
||||||
*
|
*
|
||||||
@ -267,6 +281,20 @@ public class Location implements Cloneable {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Subtracts the location by a vector.
|
||||||
|
*
|
||||||
|
* @see Vector
|
||||||
|
* @param vec The vector to use
|
||||||
|
* @return the same location
|
||||||
|
*/
|
||||||
|
public Location subtract(Vector vec) {
|
||||||
|
this.x -= vec.getX();
|
||||||
|
this.y -= vec.getY();
|
||||||
|
this.z -= vec.getZ();
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Subtracts the location by another. Not world-aware and
|
* Subtracts the location by another. Not world-aware and
|
||||||
* orientation independent.
|
* orientation independent.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user