# LocationHelper
> Utility class for location manipulation including direction, centering, and comparison.
`gg.lode.bookshelfapi.api.util.LocationHelper`
---
## Signature
```java
public class LocationHelper
```
---
## Static Methods
| Method | Return Type | Description |
|--------|-------------|-------------|
| `getDirection(Location from, Location to)` | `Vector` | Returns the direction vector from one location to another. |
| `centerLocation(Location location)` | `Location` | Centers a location to the middle of the block (adds 0.5 to X and Z). |
| `decenterLocation(Location location)` | `Location` | Reverses centering on a location. |
| `isBlockSimilar(Location a, Location b)` | `boolean` | Checks if two locations refer to the same block. |
### Parameters
| Parameter | Type | Description |
|-----------|------|-------------|
| `from` / `to` / `a` / `b` | `Location` | Bukkit Location instances. |
| `location` | `Location` | The location to center or decenter. |
---
## Usage
```java
Location spawn = new Location(world, 100, 64, 200);
Location centered = LocationHelper.centerLocation(spawn);
// (100.5, 64, 200.5)
Vector direction = LocationHelper.getDirection(playerLoc, targetLoc);
boolean sameBlock = LocationHelper.isBlockSimilar(locA, locB);
```
---
## Related Pages
- [[WorldHelper]]
- [[EntityHelper]]