From a2452cba6743ec80240efd439c68252a4b0b27be Mon Sep 17 00:00:00 2001 From: Dan Mulloy Date: Sat, 29 Aug 2015 12:42:47 -0400 Subject: [PATCH] Add BlockPosition#toLocation --- .../comphenix/protocol/wrappers/BlockPosition.java | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java index b86ab877..323853b1 100644 --- a/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java +++ b/ProtocolLib/src/main/java/com/comphenix/protocol/wrappers/BlockPosition.java @@ -18,6 +18,8 @@ package com.comphenix.protocol.wrappers; import java.lang.reflect.Constructor; +import org.bukkit.Location; +import org.bukkit.World; import org.bukkit.util.Vector; import com.comphenix.protocol.reflect.EquivalentConverter; @@ -80,6 +82,15 @@ public class BlockPosition { return new Vector(x, y, z); } + /** + * Convert this instance to an equivalent Location. + * @param world World for the location + * @return Location + */ + public Location toLocation(World world) { + return new Location(world, x, y, z); + } + /** * Retrieve the x-coordinate. * @return X coordinate.