mirror of
https://github.com/PaperMC/Paper.git
synced 2025-02-08 08:31:51 +01:00
Added add/subtract by Vector methods to Location, thanks to erisdiscord
By: Nathan Adams <dinnerbone@dinnerbone.com>
This commit is contained in:
parent
aff51bff11
commit
ad38184dc2
@ -231,6 +231,20 @@ public class Location implements Cloneable {
|
||||
z += vec.z;
|
||||
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.
|
||||
@ -266,6 +280,20 @@ public class Location implements Cloneable {
|
||||
z -= vec.z;
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user