diff --git a/src/main/java/net/knarcraft/stargate/portal/PortalLocation.java b/src/main/java/net/knarcraft/stargate/portal/PortalLocation.java new file mode 100644 index 0000000..7f0eb0b --- /dev/null +++ b/src/main/java/net/knarcraft/stargate/portal/PortalLocation.java @@ -0,0 +1,159 @@ +package net.knarcraft.stargate.portal; + +import net.knarcraft.stargate.container.BlockLocation; +import net.knarcraft.stargate.container.RelativeBlockVector; +import org.bukkit.block.BlockFace; + +/** + * Keeps track of location related data for a portal + */ +public class PortalLocation { + + private BlockLocation topLeft; + private int modX; + private int modZ; + private float yaw; + private BlockLocation signLocation; + private RelativeBlockVector buttonVector; + private BlockFace buttonFacing; + + /** + * Gets the top-left block of the portal + * + * @return
The top-left block of the portal
+ */ + public BlockLocation getTopLeft() { + return topLeft; + } + + /** + * Gets the x-modifier for the portal + * + * @returnThe x-modifier for the portal
+ */ + public int getModX() { + return modX; + } + + /** + * Gets the z-modifier for the portal + * + * @returnThe z-modifier for the portal
+ */ + public int getModZ() { + return modZ; + } + + /** + * Gets the yaw for looking outwards from the portal + * + * @returnThe portal's yaw
+ */ + public float getYaw() { + return yaw; + } + + /** + * Gets the location of the portal's sign + * @returnThe location of the portal's sign
+ */ + public BlockLocation getSignLocation() { + return signLocation; + } + + /** + * The relative block vector pointing to the portal's button + * @returnThe relative location of the portal's button
+ */ + public RelativeBlockVector getButtonVector() { + return buttonVector; + } + + /** + * Gets the block face determining the button's direction + * @returnThe button's block face
+ */ + public BlockFace getButtonFacing() { + return buttonFacing; + } + + /** + * Sets the portal's top-left location + * + *Assuming the portal is a square, the top-left block is the top-left block when looking at the portal at the + * side with the portal's sign.
+ * + * @param topLeftThe new top-left block of the portal's square structure
+ * @returnThe portal location Object
+ */ + public PortalLocation setTopLeft(BlockLocation topLeft) { + this.topLeft = topLeft; + return this; + } + + /** + * Sets the portal's x-modifier + * + * @param modXThe portal's new x-modifier
+ * @returnThe portal location Object
+ */ + public PortalLocation setModX(int modX) { + this.modX = modX; + return this; + } + + /** + * Sets the portal's z-modifier + * + * @param modZThe portal's new z-modifier
+ * @returnThe portal location Object
+ */ + public PortalLocation setModZ(int modZ) { + this.modZ = modZ; + return this; + } + + /** + * Sets the portal's yaw + * + *The portal's yaw is the yaw a player would get when looking directly out from the portal
+ * + * @param yawThe portal's new yaw
+ * @returnThe portal location Object
+ */ + public PortalLocation setYaw(float yaw) { + this.yaw = yaw; + return this; + } + + /** + * Sets the location of the portal's sign + * @param signLocationThe new sign location
+ * @returnThe portal location Object
+ */ + public PortalLocation setSignLocation(BlockLocation signLocation) { + this.signLocation = signLocation; + return this; + } + + /** + * Sets the relative location of the portal's button + * @param buttonVectorThe new relative button location
+ * @returnThe portal location Object
+ */ + public PortalLocation setButtonVector(RelativeBlockVector buttonVector) { + this.buttonVector = buttonVector; + return this; + } + + /** + * Sets the block face for the direction the portal button is facing + * @param buttonFacingThe new block face of the portal's button
+ * @returnThe portal location Object
+ */ + public PortalLocation setButtonFacing(BlockFace buttonFacing) { + this.buttonFacing = buttonFacing; + return this; + } + +}