Skip to content

Commit a2452cb

Browse files
committed
Add BlockPosition#toLocation
1 parent fc28a92 commit a2452cb

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
import java.lang.reflect.Constructor;
2020

21+
import org.bukkit.Location;
22+
import org.bukkit.World;
2123
import org.bukkit.util.Vector;
2224

2325
import com.comphenix.protocol.reflect.EquivalentConverter;
@@ -80,6 +82,15 @@ public Vector toVector() {
8082
return new Vector(x, y, z);
8183
}
8284

85+
/**
86+
* Convert this instance to an equivalent Location.
87+
* @param world World for the location
88+
* @return Location
89+
*/
90+
public Location toLocation(World world) {
91+
return new Location(world, x, y, z);
92+
}
93+
8394
/**
8495
* Retrieve the x-coordinate.
8596
* @return X coordinate.

0 commit comments

Comments
 (0)