Interface Position

  • All Superinterfaces:
    java.io.Serializable
    All Known Implementing Classes:
    Coordinate, PfNode, Point


    public interface Position
    extends java.io.Serializable
    A
    • Method Detail

      • toPoint

        Point toPoint​()
        Calculates it and creates new instance if not already in correct format then return a copy of itself.
        Returns:
        the point representation. Copy safe.
      • getPoint

        Point getPoint​()
        May not be copy safe.
        Returns:
        may not be copy safe
      • getCoord

        Coordinate getCoord​()
        May not be copy safe.
        Returns:
        may not be copy safe
      • toCoord

        Coordinate toCoord​()
        Calculates it and creates new instance if not already in correct format then returns copy of itself.
        Returns:
        the coordinate representation. Copy safe
      • getViewSpcX

        int getViewSpcX​()
        Calculate position in view space.
        Returns:
        Returns the center of the projected (screen) x-position where the object is rendered without regarding the camera. It also adds the cell offset.
      • getViewSpcY

        int getViewSpcY​()
        Calculate position in view space.
        Returns:
        Returns the center of the projected (view space) y-position where the object is rendered without regarding the camera.
      • getProjectionSpaceX

        int getProjectionSpaceX​(GameView View,
                                Camera camera)
        equals screen space when zoom=1 with a single, fullscreen camera.
        Parameters:
        View -
        camera -
        Returns:
      • getProjectionSpaceY

        int getProjectionSpaceY​(GameView View,
                                Camera camera)
        equals screen space when zoom=1 with a single camera.
        Parameters:
        View -
        camera -
        Returns:
      • getBlockId

        byte getBlockId​()
        Get the block at the position. Clamps positions over the map at topmost layer.
        Returns:
        If the coordiante is not in memory will crash.
      • cpy

        Position cpy​()
        Returns:
        a copy of the object.
      • isInMemoryAreaXY

        boolean isInMemoryAreaXY​()
        Checks if the coordiantes are accessable with the currently loaded chunks. Does not check for z axis (horizontal only). So the position can be udner or over the map.
        Returns:
      • isInMemoryAreaXYZ

        boolean isInMemoryAreaXYZ​()
        Checks if the position is on the chunks currently in memory. Checks all axis'.
        Returns:
        true if inside a chunk. false if currently not loaded or outside range.
      • distanceTo

        float distanceTo​(AbstractGameObject object)
        Parameters:
        object -
        Returns:
        the distance from this point to the other object
      • distanceToSquared

        float distanceToSquared​(AbstractGameObject object)
        The result is squared for fast comparison.
        Parameters:
        object -
        Returns:
        the distance from this point to the other object squared
        See Also:
        distanceTo(AbstractGameObject)
      • distanceTo

        float distanceTo​(Position pos)
        Parameters:
        pos -
        Returns:
        the distance from this pos to the other pos in game coordinates
      • distanceToSquared

        float distanceToSquared​(Position pos)
        The result is squared for fast comparison.
        Parameters:
        pos -
        Returns:
        the distance from this point to the other object squared
        See Also:
        distanceTo(Position)
      • distanceToHorizontal

        float distanceToHorizontal​(AbstractGameObject object)
        checks only x and y.
        Parameters:
        object -
        Returns:
        the distance from this point to the other point only regarding horizontal components.
      • distanceToHorizontal

        float distanceToHorizontal​(Position pos)
        checks only x and y.
        Parameters:
        pos -
        Returns:
        the distance from this pos to the other pos only regarding horizontal components.
      • distanceToHorizontalSquared

        float distanceToHorizontalSquared​(AbstractGameObject object)
        checks only x and y.
        Parameters:
        object -
        Returns:
        the distance from this point to the other point squared only regarding horizontal components.
      • distanceToHorizontalSquared

        float distanceToHorizontalSquared​(Position pos)
        checks only x and y.
        Parameters:
        pos -
        Returns:
        the distance from this pos to the other pos squared only regarding horizontal components.
      • getEntitiesNearby

        <T> java.util.LinkedList<T> getEntitiesNearby​(float radius,
                                                      java.lang.Class<T> type)
        Get entities in radius.
        Type Parameters:
        T - returns only object if type which is the filter
        Parameters:
        radius - in game dimension pixels
        type - the type you want to filter
        Returns:
        every entitie in radius
      • getEntitiesNearbyHorizontal

        <T> java.util.LinkedList<T> getEntitiesNearbyHorizontal​(float radius,
                                                                java.lang.Class<T> type)
        get entities in horizontal radius (like a pipe)
        Type Parameters:
        T -
        Parameters:
        radius - in game dimension pixels
        type - whitelist
        Returns:
        every entitie in radius
      • getEntitiesNearbyHorizontal

        java.util.LinkedList<AbstractEntity> getEntitiesNearbyHorizontal​(float radius)
        get entities in radius (horizontal only)
        Parameters:
        radius - in game dimension pixels
        Returns:
        every entitie in radius
      • getChunk

        Chunk getChunk​()
        Returns:
      • getChunkX

        int getChunkX​()
        The chunk coordinate.
        Returns:
      • getChunkY

        int getChunkY​()
        The chunk coordinate.
        Returns:
      • getZGrid

        int getZGrid​()
        Get the z in block grid coordinates of the coordinate. Faster than transforming to coordinate first.
        Returns:
        in grid coordinates.
      • getZPoint

        float getZPoint​()
        Get the z in game world coordinates.
        Returns: