summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorNathan Adams <dinnerbone@dinnerbone.com>2011-10-11 02:04:40 +0100
committerNathan Adams <dinnerbone@dinnerbone.com>2011-10-11 02:04:40 +0100
commit73949f6d2b532ce509dab2fbfe8f9711515c2c15 (patch)
treedb24ef349b1218de8dbe993ef846f332d68aaf93 /src
parentdc78ff7c7b763893fd446ae4f8ffbbc38f0e62de (diff)
downloadbukkit-73949f6d2b532ce509dab2fbfe8f9711515c2c15.tar
bukkit-73949f6d2b532ce509dab2fbfe8f9711515c2c15.tar.gz
bukkit-73949f6d2b532ce509dab2fbfe8f9711515c2c15.tar.lz
bukkit-73949f6d2b532ce509dab2fbfe8f9711515c2c15.tar.xz
bukkit-73949f6d2b532ce509dab2fbfe8f9711515c2c15.zip
Added add/subtract by Vector methods to Location, thanks to erisdiscord
Diffstat (limited to 'src')
-rw-r--r--src/main/java/org/bukkit/Location.java28
1 files changed, 28 insertions, 0 deletions
diff --git a/src/main/java/org/bukkit/Location.java b/src/main/java/org/bukkit/Location.java
index 2659548a..70a3f1ea 100644
--- a/src/main/java/org/bukkit/Location.java
+++ b/src/main/java/org/bukkit/Location.java
@@ -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