Subtracts the location by another. @param vec The other location @return the same location @throws IllegalArgumentException for differing worlds @see Vector
(@NotNull Location vec)
| 445 | * @see Vector |
| 446 | */ |
| 447 | @NotNull |
| 448 | public Location subtract(@NotNull Location vec) { |
| 449 | if (vec == null || vec.getWorld() != getWorld()) { |
| 450 | throw new IllegalArgumentException("Cannot add Locations of differing worlds"); |
| 451 | } |
| 452 | |
| 453 | x -= vec.x; |
| 454 | y -= vec.y; |
| 455 | z -= vec.z; |
| 456 | return this; |
| 457 | } |
| 458 | |
| 459 | /** |
| 460 | * Subtracts the location by a vector. |