Adds the location by another. @param vec The other location @return the same location @throws IllegalArgumentException for differing worlds @see Vector
(@NotNull Location vec)
| 353 | * @see Vector |
| 354 | */ |
| 355 | @NotNull |
| 356 | public Location add(@NotNull Location vec) { |
| 357 | if (vec == null || vec.getWorld() != getWorld()) { |
| 358 | throw new IllegalArgumentException("Cannot add Locations of differing worlds"); |
| 359 | } |
| 360 | |
| 361 | x += vec.x; |
| 362 | y += vec.y; |
| 363 | z += vec.z; |
| 364 | return this; |
| 365 | } |
| 366 | |
| 367 | /** |
| 368 | * Adds the location by a vector. |