Class Calculate


  • public class Calculate
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Calculate()  
    • Method Summary

      All Methods Static Methods Concrete Methods 
      Modifier and Type Method Description
      static int getCenter​(int a, int b)
      Returns the "center" of b from a
      static int getCenteredX​(int width)  
      static int getCenteredY​(int height)  
      static boolean isEntityWithinToleranceOf​(Entity baseEntity, Entity targetEntity, byte direction, int tolerance)
      Returns whether or not the first entity is within "tolerance", or distance of, the second entity, in the specified direction (uses each entity's Entity.defaultBoundary)
      static boolean isEntityWithinToleranceOf​(EntityBoundary e1, EntityBoundary e2, byte direction, int tolerance)
      Returns whether or not the first entity is within "tolerance", or distance of, the second entity, in the specified direction
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • Calculate

        public Calculate()
    • Method Detail

      • getCenter

        public static int getCenter​(int a,
                                    int b)
        Returns the "center" of b from a
        Parameters:
        a - Base x-axis or y-axis coordinate
        b - Width or height
        Returns:
        a - (b / 2)
      • getCenteredX

        public static int getCenteredX​(int width)
      • getCenteredY

        public static int getCenteredY​(int height)
      • isEntityWithinToleranceOf

        public static boolean isEntityWithinToleranceOf​(EntityBoundary e1,
                                                        EntityBoundary e2,
                                                        byte direction,
                                                        int tolerance)
        Returns whether or not the first entity is within "tolerance", or distance of, the second entity, in the specified direction
      • isEntityWithinToleranceOf

        public static boolean isEntityWithinToleranceOf​(Entity baseEntity,
                                                        Entity targetEntity,
                                                        byte direction,
                                                        int tolerance)
        Returns whether or not the first entity is within "tolerance", or distance of, the second entity, in the specified direction (uses each entity's Entity.defaultBoundary)